[Java] Print error stack trace when tests fail
[ldk-java] / ts / bindings.c.body
1 #include "js-wasm.h"
2 #include <stdatomic.h>
3 #include <lightning.h>
4
5 // These should be provided...somehow...
6 void *memset(void *s, int c, size_t n);
7 void *memcpy(void *dest, const void *src, size_t n);
8 int memcmp(const void *s1, const void *s2, size_t n);
9
10 extern void __attribute__((noreturn)) abort(void);
11 static inline void assert(bool expression) {
12         if (!expression) { abort(); }
13 }
14
15 uint32_t __attribute__((export_name("test_bigint_pass_deadbeef0badf00d"))) test_bigint_pass_deadbeef0badf00d(uint64_t val) {
16         return val == 0xdeadbeef0badf00dULL;
17 }
18
19
20 void *malloc(size_t size);
21 void free(void *ptr);
22
23 #define MALLOC(a, _) malloc(a)
24 #define do_MALLOC(a, _b, _c) malloc(a)
25 #define FREE(p) if ((unsigned long)(p) > 4096) { free(p); }
26 #define DO_ASSERT(a) (void)(a)
27 #define CHECK(a)
28 #define CHECK_ACCESS(p)
29 #define CHECK_INNER_FIELD_ACCESS_OR_NULL(v)
30
31 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
32 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
33 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
34 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
35
36 _Static_assert(sizeof(void*) == 4, "Pointers mut be 32 bits");
37
38 #define DECL_ARR_TYPE(ty, name) \
39         struct name##array { \
40                 uint64_t arr_len; /* uint32_t would suffice but we want to align uint64_ts as well */ \
41                 ty elems[]; \
42         }; \
43         typedef struct name##array * name##Array; \
44         static inline name##Array init_##name##Array(size_t arr_len, int lineno) { \
45                 name##Array arr = (name##Array)do_MALLOC(arr_len * sizeof(ty) + sizeof(uint64_t), #name" array init", lineno); \
46                 arr->arr_len = arr_len; \
47                 return arr; \
48         }
49
50 DECL_ARR_TYPE(int64_t, int64_t);
51 DECL_ARR_TYPE(uint64_t, uint64_t);
52 DECL_ARR_TYPE(int8_t, int8_t);
53 DECL_ARR_TYPE(int16_t, int16_t);
54 DECL_ARR_TYPE(uint32_t, uint32_t);
55 DECL_ARR_TYPE(void*, ptr);
56 DECL_ARR_TYPE(char, char);
57 typedef charArray jstring;
58
59 static inline jstring str_ref_to_ts(const char* chars, size_t len) {
60         charArray arr = init_charArray(len, __LINE__);
61         memcpy(arr->elems, chars, len);
62         return arr;
63 }
64 static inline LDKStr str_ref_to_owned_c(const jstring str) {
65         char* newchars = MALLOC(str->arr_len + 1, "String chars");
66         memcpy(newchars, str->elems, str->arr_len);
67         newchars[str->arr_len] = 0;
68         LDKStr res = {
69                 .chars = newchars,
70                 .len = str->arr_len,
71                 .chars_is_owned = true
72         };
73         return res;
74 }
75
76 typedef bool jboolean;
77
78 uint32_t __attribute__((export_name("TS_malloc"))) TS_malloc(uint32_t size) {
79         return (uint32_t)MALLOC(size, "JS-Called malloc");
80 }
81 void __attribute__((export_name("TS_free"))) TS_free(uint32_t ptr) {
82         FREE((void*)ptr);
83 }
84
85 jstring __attribute__((export_name("TS_get_ldk_c_bindings_version"))) TS_get_ldk_c_bindings_version() {
86         const char *res = check_get_ldk_bindings_version();
87         if (res == NULL) return NULL;
88         return str_ref_to_ts(res, strlen(res));
89 }
90 jstring __attribute__((export_name("TS_get_ldk_version"))) get_ldk_version() {
91         const char *res = check_get_ldk_version();
92         if (res == NULL) return NULL;
93         return str_ref_to_ts(res, strlen(res));
94 }
95 #include "version.c"
96 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
97
98 static inline void* untag_ptr(uint64_t ptr) {
99         if (ptr < 4096) return (void*)ptr;
100         if (sizeof(void*) == 4) {
101                 // For 32-bit systems, store pointers as 64-bit ints and use the 31st bit
102                 return (void*)(uintptr_t)ptr;
103         } else {
104                 // For 64-bit systems, assume the top byte is used for tagging, then
105                 // use bit 9 ^ bit 10.
106                 uint64_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
107                 uintptr_t p = (ptr & ~(1ULL << 55)) | (tenth_bit << 55);
108 #ifdef LDK_DEBUG_BUILD
109                 // On debug builds we also use the 11th bit as a debug flag
110                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
111                 CHECK(tenth_bit != eleventh_bit);
112                 p ^= 1ULL << 53;
113 #endif
114                 return (void*)p;
115         }
116 }
117 static inline bool ptr_is_owned(uint64_t ptr) {
118         if(ptr < 4096) return true;
119         if (sizeof(void*) == 4) {
120                 return ptr & (1ULL << 32);
121         } else {
122                 uintptr_t ninth_bit = (((uintptr_t)ptr) & (1ULL << 55)) >> 55;
123                 uintptr_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
124 #ifdef LDK_DEBUG_BUILD
125                 // On debug builds we also use the 11th bit as a debug flag
126                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
127                 CHECK(tenth_bit != eleventh_bit);
128 #endif
129                 return (ninth_bit ^ tenth_bit) ? true : false;
130         }
131 }
132 static inline uint64_t tag_ptr(const void* ptr, bool is_owned) {
133         if ((uintptr_t)ptr < 4096) return (uint64_t)ptr;
134         if (sizeof(void*) == 4) {
135                 return (((uint64_t)ptr) | ((is_owned ? 1ULL : 0) << 32));
136         } else {
137                 CHECK(sizeof(uintptr_t) == 8);
138                 uintptr_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
139                 uintptr_t t = (((uintptr_t)ptr) | (((is_owned ? 1ULL : 0ULL) ^ tenth_bit) << 55));
140 #ifdef LDK_DEBUG_BUILD
141                 uintptr_t ninth_bit = (((uintptr_t)ptr) & (1ULL << 55)) >> 55;
142                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
143                 CHECK(ninth_bit == tenth_bit);
144                 CHECK(ninth_bit == eleventh_bit);
145                 t ^= 1ULL << 53;
146 #endif
147                 CHECK(ptr_is_owned(t) == is_owned);
148                 CHECK(untag_ptr(t) == ptr);
149                 return t;
150         }
151 }
152
153 static inline LDKBlindedFailure LDKBlindedFailure_from_js(int32_t ord) {
154         switch (ord) {
155                 case 0: return LDKBlindedFailure_FromIntroductionNode;
156                 case 1: return LDKBlindedFailure_FromBlindedNode;
157         }
158         abort();
159 }
160 static inline int32_t LDKBlindedFailure_to_js(LDKBlindedFailure val) {
161         switch (val) {
162                 case LDKBlindedFailure_FromIntroductionNode: return 0;
163                 case LDKBlindedFailure_FromBlindedNode: return 1;
164                 default: abort();
165         }
166 }
167 static inline LDKBolt11SemanticError LDKBolt11SemanticError_from_js(int32_t ord) {
168         switch (ord) {
169                 case 0: return LDKBolt11SemanticError_NoPaymentHash;
170                 case 1: return LDKBolt11SemanticError_MultiplePaymentHashes;
171                 case 2: return LDKBolt11SemanticError_NoDescription;
172                 case 3: return LDKBolt11SemanticError_MultipleDescriptions;
173                 case 4: return LDKBolt11SemanticError_NoPaymentSecret;
174                 case 5: return LDKBolt11SemanticError_MultiplePaymentSecrets;
175                 case 6: return LDKBolt11SemanticError_InvalidFeatures;
176                 case 7: return LDKBolt11SemanticError_InvalidRecoveryId;
177                 case 8: return LDKBolt11SemanticError_InvalidSignature;
178                 case 9: return LDKBolt11SemanticError_ImpreciseAmount;
179         }
180         abort();
181 }
182 static inline int32_t LDKBolt11SemanticError_to_js(LDKBolt11SemanticError val) {
183         switch (val) {
184                 case LDKBolt11SemanticError_NoPaymentHash: return 0;
185                 case LDKBolt11SemanticError_MultiplePaymentHashes: return 1;
186                 case LDKBolt11SemanticError_NoDescription: return 2;
187                 case LDKBolt11SemanticError_MultipleDescriptions: return 3;
188                 case LDKBolt11SemanticError_NoPaymentSecret: return 4;
189                 case LDKBolt11SemanticError_MultiplePaymentSecrets: return 5;
190                 case LDKBolt11SemanticError_InvalidFeatures: return 6;
191                 case LDKBolt11SemanticError_InvalidRecoveryId: return 7;
192                 case LDKBolt11SemanticError_InvalidSignature: return 8;
193                 case LDKBolt11SemanticError_ImpreciseAmount: return 9;
194                 default: abort();
195         }
196 }
197 static inline LDKBolt12SemanticError LDKBolt12SemanticError_from_js(int32_t ord) {
198         switch (ord) {
199                 case 0: return LDKBolt12SemanticError_AlreadyExpired;
200                 case 1: return LDKBolt12SemanticError_UnsupportedChain;
201                 case 2: return LDKBolt12SemanticError_UnexpectedChain;
202                 case 3: return LDKBolt12SemanticError_MissingAmount;
203                 case 4: return LDKBolt12SemanticError_InvalidAmount;
204                 case 5: return LDKBolt12SemanticError_InsufficientAmount;
205                 case 6: return LDKBolt12SemanticError_UnexpectedAmount;
206                 case 7: return LDKBolt12SemanticError_UnsupportedCurrency;
207                 case 8: return LDKBolt12SemanticError_UnknownRequiredFeatures;
208                 case 9: return LDKBolt12SemanticError_UnexpectedFeatures;
209                 case 10: return LDKBolt12SemanticError_MissingDescription;
210                 case 11: return LDKBolt12SemanticError_MissingSigningPubkey;
211                 case 12: return LDKBolt12SemanticError_InvalidSigningPubkey;
212                 case 13: return LDKBolt12SemanticError_UnexpectedSigningPubkey;
213                 case 14: return LDKBolt12SemanticError_MissingQuantity;
214                 case 15: return LDKBolt12SemanticError_InvalidQuantity;
215                 case 16: return LDKBolt12SemanticError_UnexpectedQuantity;
216                 case 17: return LDKBolt12SemanticError_InvalidMetadata;
217                 case 18: return LDKBolt12SemanticError_UnexpectedMetadata;
218                 case 19: return LDKBolt12SemanticError_MissingPayerMetadata;
219                 case 20: return LDKBolt12SemanticError_MissingPayerId;
220                 case 21: return LDKBolt12SemanticError_DuplicatePaymentId;
221                 case 22: return LDKBolt12SemanticError_MissingPaths;
222                 case 23: return LDKBolt12SemanticError_UnexpectedPaths;
223                 case 24: return LDKBolt12SemanticError_InvalidPayInfo;
224                 case 25: return LDKBolt12SemanticError_MissingCreationTime;
225                 case 26: return LDKBolt12SemanticError_MissingPaymentHash;
226                 case 27: return LDKBolt12SemanticError_MissingSignature;
227         }
228         abort();
229 }
230 static inline int32_t LDKBolt12SemanticError_to_js(LDKBolt12SemanticError val) {
231         switch (val) {
232                 case LDKBolt12SemanticError_AlreadyExpired: return 0;
233                 case LDKBolt12SemanticError_UnsupportedChain: return 1;
234                 case LDKBolt12SemanticError_UnexpectedChain: return 2;
235                 case LDKBolt12SemanticError_MissingAmount: return 3;
236                 case LDKBolt12SemanticError_InvalidAmount: return 4;
237                 case LDKBolt12SemanticError_InsufficientAmount: return 5;
238                 case LDKBolt12SemanticError_UnexpectedAmount: return 6;
239                 case LDKBolt12SemanticError_UnsupportedCurrency: return 7;
240                 case LDKBolt12SemanticError_UnknownRequiredFeatures: return 8;
241                 case LDKBolt12SemanticError_UnexpectedFeatures: return 9;
242                 case LDKBolt12SemanticError_MissingDescription: return 10;
243                 case LDKBolt12SemanticError_MissingSigningPubkey: return 11;
244                 case LDKBolt12SemanticError_InvalidSigningPubkey: return 12;
245                 case LDKBolt12SemanticError_UnexpectedSigningPubkey: return 13;
246                 case LDKBolt12SemanticError_MissingQuantity: return 14;
247                 case LDKBolt12SemanticError_InvalidQuantity: return 15;
248                 case LDKBolt12SemanticError_UnexpectedQuantity: return 16;
249                 case LDKBolt12SemanticError_InvalidMetadata: return 17;
250                 case LDKBolt12SemanticError_UnexpectedMetadata: return 18;
251                 case LDKBolt12SemanticError_MissingPayerMetadata: return 19;
252                 case LDKBolt12SemanticError_MissingPayerId: return 20;
253                 case LDKBolt12SemanticError_DuplicatePaymentId: return 21;
254                 case LDKBolt12SemanticError_MissingPaths: return 22;
255                 case LDKBolt12SemanticError_UnexpectedPaths: return 23;
256                 case LDKBolt12SemanticError_InvalidPayInfo: return 24;
257                 case LDKBolt12SemanticError_MissingCreationTime: return 25;
258                 case LDKBolt12SemanticError_MissingPaymentHash: return 26;
259                 case LDKBolt12SemanticError_MissingSignature: return 27;
260                 default: abort();
261         }
262 }
263 static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_js(int32_t ord) {
264         switch (ord) {
265                 case 0: return LDKCOption_NoneZ_Some;
266                 case 1: return LDKCOption_NoneZ_None;
267         }
268         abort();
269 }
270 static inline int32_t LDKCOption_NoneZ_to_js(LDKCOption_NoneZ val) {
271         switch (val) {
272                 case LDKCOption_NoneZ_Some: return 0;
273                 case LDKCOption_NoneZ_None: return 1;
274                 default: abort();
275         }
276 }
277 static inline LDKChannelMonitorUpdateStatus LDKChannelMonitorUpdateStatus_from_js(int32_t ord) {
278         switch (ord) {
279                 case 0: return LDKChannelMonitorUpdateStatus_Completed;
280                 case 1: return LDKChannelMonitorUpdateStatus_InProgress;
281                 case 2: return LDKChannelMonitorUpdateStatus_UnrecoverableError;
282         }
283         abort();
284 }
285 static inline int32_t LDKChannelMonitorUpdateStatus_to_js(LDKChannelMonitorUpdateStatus val) {
286         switch (val) {
287                 case LDKChannelMonitorUpdateStatus_Completed: return 0;
288                 case LDKChannelMonitorUpdateStatus_InProgress: return 1;
289                 case LDKChannelMonitorUpdateStatus_UnrecoverableError: return 2;
290                 default: abort();
291         }
292 }
293 static inline LDKChannelShutdownState LDKChannelShutdownState_from_js(int32_t ord) {
294         switch (ord) {
295                 case 0: return LDKChannelShutdownState_NotShuttingDown;
296                 case 1: return LDKChannelShutdownState_ShutdownInitiated;
297                 case 2: return LDKChannelShutdownState_ResolvingHTLCs;
298                 case 3: return LDKChannelShutdownState_NegotiatingClosingFee;
299                 case 4: return LDKChannelShutdownState_ShutdownComplete;
300         }
301         abort();
302 }
303 static inline int32_t LDKChannelShutdownState_to_js(LDKChannelShutdownState val) {
304         switch (val) {
305                 case LDKChannelShutdownState_NotShuttingDown: return 0;
306                 case LDKChannelShutdownState_ShutdownInitiated: return 1;
307                 case LDKChannelShutdownState_ResolvingHTLCs: return 2;
308                 case LDKChannelShutdownState_NegotiatingClosingFee: return 3;
309                 case LDKChannelShutdownState_ShutdownComplete: return 4;
310                 default: abort();
311         }
312 }
313 static inline LDKConfirmationTarget LDKConfirmationTarget_from_js(int32_t ord) {
314         switch (ord) {
315                 case 0: return LDKConfirmationTarget_OnChainSweep;
316                 case 1: return LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee;
317                 case 2: return LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee;
318                 case 3: return LDKConfirmationTarget_AnchorChannelFee;
319                 case 4: return LDKConfirmationTarget_NonAnchorChannelFee;
320                 case 5: return LDKConfirmationTarget_ChannelCloseMinimum;
321                 case 6: return LDKConfirmationTarget_OutputSpendingFee;
322         }
323         abort();
324 }
325 static inline int32_t LDKConfirmationTarget_to_js(LDKConfirmationTarget val) {
326         switch (val) {
327                 case LDKConfirmationTarget_OnChainSweep: return 0;
328                 case LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee: return 1;
329                 case LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee: return 2;
330                 case LDKConfirmationTarget_AnchorChannelFee: return 3;
331                 case LDKConfirmationTarget_NonAnchorChannelFee: return 4;
332                 case LDKConfirmationTarget_ChannelCloseMinimum: return 5;
333                 case LDKConfirmationTarget_OutputSpendingFee: return 6;
334                 default: abort();
335         }
336 }
337 static inline LDKCreationError LDKCreationError_from_js(int32_t ord) {
338         switch (ord) {
339                 case 0: return LDKCreationError_DescriptionTooLong;
340                 case 1: return LDKCreationError_RouteTooLong;
341                 case 2: return LDKCreationError_TimestampOutOfBounds;
342                 case 3: return LDKCreationError_InvalidAmount;
343                 case 4: return LDKCreationError_MissingRouteHints;
344                 case 5: return LDKCreationError_MinFinalCltvExpiryDeltaTooShort;
345         }
346         abort();
347 }
348 static inline int32_t LDKCreationError_to_js(LDKCreationError val) {
349         switch (val) {
350                 case LDKCreationError_DescriptionTooLong: return 0;
351                 case LDKCreationError_RouteTooLong: return 1;
352                 case LDKCreationError_TimestampOutOfBounds: return 2;
353                 case LDKCreationError_InvalidAmount: return 3;
354                 case LDKCreationError_MissingRouteHints: return 4;
355                 case LDKCreationError_MinFinalCltvExpiryDeltaTooShort: return 5;
356                 default: abort();
357         }
358 }
359 static inline LDKCurrency LDKCurrency_from_js(int32_t ord) {
360         switch (ord) {
361                 case 0: return LDKCurrency_Bitcoin;
362                 case 1: return LDKCurrency_BitcoinTestnet;
363                 case 2: return LDKCurrency_Regtest;
364                 case 3: return LDKCurrency_Simnet;
365                 case 4: return LDKCurrency_Signet;
366         }
367         abort();
368 }
369 static inline int32_t LDKCurrency_to_js(LDKCurrency val) {
370         switch (val) {
371                 case LDKCurrency_Bitcoin: return 0;
372                 case LDKCurrency_BitcoinTestnet: return 1;
373                 case LDKCurrency_Regtest: return 2;
374                 case LDKCurrency_Simnet: return 3;
375                 case LDKCurrency_Signet: return 4;
376                 default: abort();
377         }
378 }
379 static inline LDKDirection LDKDirection_from_js(int32_t ord) {
380         switch (ord) {
381                 case 0: return LDKDirection_NodeOne;
382                 case 1: return LDKDirection_NodeTwo;
383         }
384         abort();
385 }
386 static inline int32_t LDKDirection_to_js(LDKDirection val) {
387         switch (val) {
388                 case LDKDirection_NodeOne: return 0;
389                 case LDKDirection_NodeTwo: return 1;
390                 default: abort();
391         }
392 }
393 static inline LDKHTLCClaim LDKHTLCClaim_from_js(int32_t ord) {
394         switch (ord) {
395                 case 0: return LDKHTLCClaim_OfferedTimeout;
396                 case 1: return LDKHTLCClaim_OfferedPreimage;
397                 case 2: return LDKHTLCClaim_AcceptedTimeout;
398                 case 3: return LDKHTLCClaim_AcceptedPreimage;
399                 case 4: return LDKHTLCClaim_Revocation;
400         }
401         abort();
402 }
403 static inline int32_t LDKHTLCClaim_to_js(LDKHTLCClaim val) {
404         switch (val) {
405                 case LDKHTLCClaim_OfferedTimeout: return 0;
406                 case LDKHTLCClaim_OfferedPreimage: return 1;
407                 case LDKHTLCClaim_AcceptedTimeout: return 2;
408                 case LDKHTLCClaim_AcceptedPreimage: return 3;
409                 case LDKHTLCClaim_Revocation: return 4;
410                 default: abort();
411         }
412 }
413 static inline LDKIOError LDKIOError_from_js(int32_t ord) {
414         switch (ord) {
415                 case 0: return LDKIOError_NotFound;
416                 case 1: return LDKIOError_PermissionDenied;
417                 case 2: return LDKIOError_ConnectionRefused;
418                 case 3: return LDKIOError_ConnectionReset;
419                 case 4: return LDKIOError_ConnectionAborted;
420                 case 5: return LDKIOError_NotConnected;
421                 case 6: return LDKIOError_AddrInUse;
422                 case 7: return LDKIOError_AddrNotAvailable;
423                 case 8: return LDKIOError_BrokenPipe;
424                 case 9: return LDKIOError_AlreadyExists;
425                 case 10: return LDKIOError_WouldBlock;
426                 case 11: return LDKIOError_InvalidInput;
427                 case 12: return LDKIOError_InvalidData;
428                 case 13: return LDKIOError_TimedOut;
429                 case 14: return LDKIOError_WriteZero;
430                 case 15: return LDKIOError_Interrupted;
431                 case 16: return LDKIOError_Other;
432                 case 17: return LDKIOError_UnexpectedEof;
433         }
434         abort();
435 }
436 static inline int32_t LDKIOError_to_js(LDKIOError val) {
437         switch (val) {
438                 case LDKIOError_NotFound: return 0;
439                 case LDKIOError_PermissionDenied: return 1;
440                 case LDKIOError_ConnectionRefused: return 2;
441                 case LDKIOError_ConnectionReset: return 3;
442                 case LDKIOError_ConnectionAborted: return 4;
443                 case LDKIOError_NotConnected: return 5;
444                 case LDKIOError_AddrInUse: return 6;
445                 case LDKIOError_AddrNotAvailable: return 7;
446                 case LDKIOError_BrokenPipe: return 8;
447                 case LDKIOError_AlreadyExists: return 9;
448                 case LDKIOError_WouldBlock: return 10;
449                 case LDKIOError_InvalidInput: return 11;
450                 case LDKIOError_InvalidData: return 12;
451                 case LDKIOError_TimedOut: return 13;
452                 case LDKIOError_WriteZero: return 14;
453                 case LDKIOError_Interrupted: return 15;
454                 case LDKIOError_Other: return 16;
455                 case LDKIOError_UnexpectedEof: return 17;
456                 default: abort();
457         }
458 }
459 static inline LDKLevel LDKLevel_from_js(int32_t ord) {
460         switch (ord) {
461                 case 0: return LDKLevel_Gossip;
462                 case 1: return LDKLevel_Trace;
463                 case 2: return LDKLevel_Debug;
464                 case 3: return LDKLevel_Info;
465                 case 4: return LDKLevel_Warn;
466                 case 5: return LDKLevel_Error;
467         }
468         abort();
469 }
470 static inline int32_t LDKLevel_to_js(LDKLevel val) {
471         switch (val) {
472                 case LDKLevel_Gossip: return 0;
473                 case LDKLevel_Trace: return 1;
474                 case LDKLevel_Debug: return 2;
475                 case LDKLevel_Info: return 3;
476                 case LDKLevel_Warn: return 4;
477                 case LDKLevel_Error: return 5;
478                 default: abort();
479         }
480 }
481 static inline LDKNetwork LDKNetwork_from_js(int32_t ord) {
482         switch (ord) {
483                 case 0: return LDKNetwork_Bitcoin;
484                 case 1: return LDKNetwork_Testnet;
485                 case 2: return LDKNetwork_Regtest;
486                 case 3: return LDKNetwork_Signet;
487         }
488         abort();
489 }
490 static inline int32_t LDKNetwork_to_js(LDKNetwork val) {
491         switch (val) {
492                 case LDKNetwork_Bitcoin: return 0;
493                 case LDKNetwork_Testnet: return 1;
494                 case LDKNetwork_Regtest: return 2;
495                 case LDKNetwork_Signet: return 3;
496                 default: abort();
497         }
498 }
499 static inline LDKPaymentFailureReason LDKPaymentFailureReason_from_js(int32_t ord) {
500         switch (ord) {
501                 case 0: return LDKPaymentFailureReason_RecipientRejected;
502                 case 1: return LDKPaymentFailureReason_UserAbandoned;
503                 case 2: return LDKPaymentFailureReason_RetriesExhausted;
504                 case 3: return LDKPaymentFailureReason_PaymentExpired;
505                 case 4: return LDKPaymentFailureReason_RouteNotFound;
506                 case 5: return LDKPaymentFailureReason_UnexpectedError;
507         }
508         abort();
509 }
510 static inline int32_t LDKPaymentFailureReason_to_js(LDKPaymentFailureReason val) {
511         switch (val) {
512                 case LDKPaymentFailureReason_RecipientRejected: return 0;
513                 case LDKPaymentFailureReason_UserAbandoned: return 1;
514                 case LDKPaymentFailureReason_RetriesExhausted: return 2;
515                 case LDKPaymentFailureReason_PaymentExpired: return 3;
516                 case LDKPaymentFailureReason_RouteNotFound: return 4;
517                 case LDKPaymentFailureReason_UnexpectedError: return 5;
518                 default: abort();
519         }
520 }
521 static inline LDKRecipient LDKRecipient_from_js(int32_t ord) {
522         switch (ord) {
523                 case 0: return LDKRecipient_Node;
524                 case 1: return LDKRecipient_PhantomNode;
525         }
526         abort();
527 }
528 static inline int32_t LDKRecipient_to_js(LDKRecipient val) {
529         switch (val) {
530                 case LDKRecipient_Node: return 0;
531                 case LDKRecipient_PhantomNode: return 1;
532                 default: abort();
533         }
534 }
535 static inline LDKRetryableSendFailure LDKRetryableSendFailure_from_js(int32_t ord) {
536         switch (ord) {
537                 case 0: return LDKRetryableSendFailure_PaymentExpired;
538                 case 1: return LDKRetryableSendFailure_RouteNotFound;
539                 case 2: return LDKRetryableSendFailure_DuplicatePayment;
540         }
541         abort();
542 }
543 static inline int32_t LDKRetryableSendFailure_to_js(LDKRetryableSendFailure val) {
544         switch (val) {
545                 case LDKRetryableSendFailure_PaymentExpired: return 0;
546                 case LDKRetryableSendFailure_RouteNotFound: return 1;
547                 case LDKRetryableSendFailure_DuplicatePayment: return 2;
548                 default: abort();
549         }
550 }
551 static inline LDKSecp256k1Error LDKSecp256k1Error_from_js(int32_t ord) {
552         switch (ord) {
553                 case 0: return LDKSecp256k1Error_IncorrectSignature;
554                 case 1: return LDKSecp256k1Error_InvalidMessage;
555                 case 2: return LDKSecp256k1Error_InvalidPublicKey;
556                 case 3: return LDKSecp256k1Error_InvalidSignature;
557                 case 4: return LDKSecp256k1Error_InvalidSecretKey;
558                 case 5: return LDKSecp256k1Error_InvalidSharedSecret;
559                 case 6: return LDKSecp256k1Error_InvalidRecoveryId;
560                 case 7: return LDKSecp256k1Error_InvalidTweak;
561                 case 8: return LDKSecp256k1Error_NotEnoughMemory;
562                 case 9: return LDKSecp256k1Error_InvalidPublicKeySum;
563                 case 10: return LDKSecp256k1Error_InvalidParityValue;
564         }
565         abort();
566 }
567 static inline int32_t LDKSecp256k1Error_to_js(LDKSecp256k1Error val) {
568         switch (val) {
569                 case LDKSecp256k1Error_IncorrectSignature: return 0;
570                 case LDKSecp256k1Error_InvalidMessage: return 1;
571                 case LDKSecp256k1Error_InvalidPublicKey: return 2;
572                 case LDKSecp256k1Error_InvalidSignature: return 3;
573                 case LDKSecp256k1Error_InvalidSecretKey: return 4;
574                 case LDKSecp256k1Error_InvalidSharedSecret: return 5;
575                 case LDKSecp256k1Error_InvalidRecoveryId: return 6;
576                 case LDKSecp256k1Error_InvalidTweak: return 7;
577                 case LDKSecp256k1Error_NotEnoughMemory: return 8;
578                 case LDKSecp256k1Error_InvalidPublicKeySum: return 9;
579                 case LDKSecp256k1Error_InvalidParityValue: return 10;
580                 default: abort();
581         }
582 }
583 static inline LDKShortChannelIdError LDKShortChannelIdError_from_js(int32_t ord) {
584         switch (ord) {
585                 case 0: return LDKShortChannelIdError_BlockOverflow;
586                 case 1: return LDKShortChannelIdError_TxIndexOverflow;
587                 case 2: return LDKShortChannelIdError_VoutIndexOverflow;
588         }
589         abort();
590 }
591 static inline int32_t LDKShortChannelIdError_to_js(LDKShortChannelIdError val) {
592         switch (val) {
593                 case LDKShortChannelIdError_BlockOverflow: return 0;
594                 case LDKShortChannelIdError_TxIndexOverflow: return 1;
595                 case LDKShortChannelIdError_VoutIndexOverflow: return 2;
596                 default: abort();
597         }
598 }
599 static inline LDKSiPrefix LDKSiPrefix_from_js(int32_t ord) {
600         switch (ord) {
601                 case 0: return LDKSiPrefix_Milli;
602                 case 1: return LDKSiPrefix_Micro;
603                 case 2: return LDKSiPrefix_Nano;
604                 case 3: return LDKSiPrefix_Pico;
605         }
606         abort();
607 }
608 static inline int32_t LDKSiPrefix_to_js(LDKSiPrefix val) {
609         switch (val) {
610                 case LDKSiPrefix_Milli: return 0;
611                 case LDKSiPrefix_Micro: return 1;
612                 case LDKSiPrefix_Nano: return 2;
613                 case LDKSiPrefix_Pico: return 3;
614                 default: abort();
615         }
616 }
617 static inline LDKSocketAddressParseError LDKSocketAddressParseError_from_js(int32_t ord) {
618         switch (ord) {
619                 case 0: return LDKSocketAddressParseError_SocketAddrParse;
620                 case 1: return LDKSocketAddressParseError_InvalidInput;
621                 case 2: return LDKSocketAddressParseError_InvalidPort;
622                 case 3: return LDKSocketAddressParseError_InvalidOnionV3;
623         }
624         abort();
625 }
626 static inline int32_t LDKSocketAddressParseError_to_js(LDKSocketAddressParseError val) {
627         switch (val) {
628                 case LDKSocketAddressParseError_SocketAddrParse: return 0;
629                 case LDKSocketAddressParseError_InvalidInput: return 1;
630                 case LDKSocketAddressParseError_InvalidPort: return 2;
631                 case LDKSocketAddressParseError_InvalidOnionV3: return 3;
632                 default: abort();
633         }
634 }
635 static inline LDKUtxoLookupError LDKUtxoLookupError_from_js(int32_t ord) {
636         switch (ord) {
637                 case 0: return LDKUtxoLookupError_UnknownChain;
638                 case 1: return LDKUtxoLookupError_UnknownTx;
639         }
640         abort();
641 }
642 static inline int32_t LDKUtxoLookupError_to_js(LDKUtxoLookupError val) {
643         switch (val) {
644                 case LDKUtxoLookupError_UnknownChain: return 0;
645                 case LDKUtxoLookupError_UnknownTx: return 1;
646                 default: abort();
647         }
648 }
649 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
650         LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
651         memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
652         return ret;
653 }
654 struct LDKThirtyTwoBytes BigEndianScalar_get_bytes (struct LDKBigEndianScalar* thing) {
655         LDKThirtyTwoBytes ret = { .data = *thing->big_endian_bytes };
656         return ret;
657 }
658 int8_tArray  __attribute__((export_name("TS_BigEndianScalar_get_bytes"))) TS_BigEndianScalar_get_bytes(uint64_t thing) {
659         LDKBigEndianScalar* thing_conv = (LDKBigEndianScalar*)untag_ptr(thing);
660         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
661         memcpy(ret_arr->elems, BigEndianScalar_get_bytes(thing_conv).data, 32);
662         return ret_arr;
663 }
664
665 static void BigEndianScalar_free (struct LDKBigEndianScalar thing) {}
666 void  __attribute__((export_name("TS_BigEndianScalar_free"))) TS_BigEndianScalar_free(uint64_t thing) {
667         if (!ptr_is_owned(thing)) return;
668         void* thing_ptr = untag_ptr(thing);
669         CHECK_ACCESS(thing_ptr);
670         LDKBigEndianScalar thing_conv = *(LDKBigEndianScalar*)(thing_ptr);
671         FREE(untag_ptr(thing));
672         BigEndianScalar_free(thing_conv);
673 }
674
675 uint32_t __attribute__((export_name("TS_LDKBech32Error_ty_from_ptr"))) TS_LDKBech32Error_ty_from_ptr(uint64_t ptr) {
676         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
677         switch(obj->tag) {
678                 case LDKBech32Error_MissingSeparator: return 0;
679                 case LDKBech32Error_InvalidChecksum: return 1;
680                 case LDKBech32Error_InvalidLength: return 2;
681                 case LDKBech32Error_InvalidChar: return 3;
682                 case LDKBech32Error_InvalidData: return 4;
683                 case LDKBech32Error_InvalidPadding: return 5;
684                 case LDKBech32Error_MixedCase: return 6;
685                 default: abort();
686         }
687 }
688 int32_t __attribute__((export_name("TS_LDKBech32Error_InvalidChar_get_invalid_char"))) TS_LDKBech32Error_InvalidChar_get_invalid_char(uint64_t ptr) {
689         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
690         assert(obj->tag == LDKBech32Error_InvalidChar);
691         int32_t invalid_char_conv = obj->invalid_char;
692         return invalid_char_conv;
693 }
694 int8_t __attribute__((export_name("TS_LDKBech32Error_InvalidData_get_invalid_data"))) TS_LDKBech32Error_InvalidData_get_invalid_data(uint64_t ptr) {
695         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
696         assert(obj->tag == LDKBech32Error_InvalidData);
697         int8_t invalid_data_conv = obj->invalid_data;
698         return invalid_data_conv;
699 }
700 static inline struct LDKRefundMaybeWithDerivedMetadataBuilder CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_ok(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
701         LDKRefundMaybeWithDerivedMetadataBuilder ret = *owner->contents.result;
702         ret.is_owned = false;
703         return ret;
704 }
705 uint64_t  __attribute__((export_name("TS_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_ok"))) TS_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_ok(uint64_t owner) {
706         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
707         LDKRefundMaybeWithDerivedMetadataBuilder ret_var = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_ok(owner_conv);
708         uint64_t ret_ref = 0;
709         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
710         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
711         return ret_ref;
712 }
713
714 static inline enum LDKBolt12SemanticError CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_err(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
715 CHECK(!owner->result_ok);
716         return Bolt12SemanticError_clone(&*owner->contents.err);
717 }
718 uint32_t  __attribute__((export_name("TS_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_err"))) TS_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_err(uint64_t owner) {
719         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
720         uint32_t ret_conv = LDKBolt12SemanticError_to_js(CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_err(owner_conv));
721         return ret_conv;
722 }
723
724 static inline struct LDKRefund CResult_RefundBolt12SemanticErrorZ_get_ok(LDKCResult_RefundBolt12SemanticErrorZ *NONNULL_PTR owner){
725         LDKRefund ret = *owner->contents.result;
726         ret.is_owned = false;
727         return ret;
728 }
729 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12SemanticErrorZ_get_ok"))) TS_CResult_RefundBolt12SemanticErrorZ_get_ok(uint64_t owner) {
730         LDKCResult_RefundBolt12SemanticErrorZ* owner_conv = (LDKCResult_RefundBolt12SemanticErrorZ*)untag_ptr(owner);
731         LDKRefund ret_var = CResult_RefundBolt12SemanticErrorZ_get_ok(owner_conv);
732         uint64_t ret_ref = 0;
733         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
734         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
735         return ret_ref;
736 }
737
738 static inline enum LDKBolt12SemanticError CResult_RefundBolt12SemanticErrorZ_get_err(LDKCResult_RefundBolt12SemanticErrorZ *NONNULL_PTR owner){
739 CHECK(!owner->result_ok);
740         return Bolt12SemanticError_clone(&*owner->contents.err);
741 }
742 uint32_t  __attribute__((export_name("TS_CResult_RefundBolt12SemanticErrorZ_get_err"))) TS_CResult_RefundBolt12SemanticErrorZ_get_err(uint64_t owner) {
743         LDKCResult_RefundBolt12SemanticErrorZ* owner_conv = (LDKCResult_RefundBolt12SemanticErrorZ*)untag_ptr(owner);
744         uint32_t ret_conv = LDKBolt12SemanticError_to_js(CResult_RefundBolt12SemanticErrorZ_get_err(owner_conv));
745         return ret_conv;
746 }
747
748 uint32_t __attribute__((export_name("TS_LDKCOption_u64Z_ty_from_ptr"))) TS_LDKCOption_u64Z_ty_from_ptr(uint64_t ptr) {
749         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
750         switch(obj->tag) {
751                 case LDKCOption_u64Z_Some: return 0;
752                 case LDKCOption_u64Z_None: return 1;
753                 default: abort();
754         }
755 }
756 int64_t __attribute__((export_name("TS_LDKCOption_u64Z_Some_get_some"))) TS_LDKCOption_u64Z_Some_get_some(uint64_t ptr) {
757         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
758         assert(obj->tag == LDKCOption_u64Z_Some);
759         int64_t some_conv = obj->some;
760         return some_conv;
761 }
762 static inline LDKCVec_BlindedPathZ CVec_BlindedPathZ_clone(const LDKCVec_BlindedPathZ *orig) {
763         LDKCVec_BlindedPathZ ret = { .data = MALLOC(sizeof(LDKBlindedPath) * orig->datalen, "LDKCVec_BlindedPathZ clone bytes"), .datalen = orig->datalen };
764         for (size_t i = 0; i < ret.datalen; i++) {
765                 ret.data[i] = BlindedPath_clone(&orig->data[i]);
766         }
767         return ret;
768 }
769 static inline struct LDKRefund CResult_RefundBolt12ParseErrorZ_get_ok(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR owner){
770         LDKRefund ret = *owner->contents.result;
771         ret.is_owned = false;
772         return ret;
773 }
774 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_get_ok"))) TS_CResult_RefundBolt12ParseErrorZ_get_ok(uint64_t owner) {
775         LDKCResult_RefundBolt12ParseErrorZ* owner_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(owner);
776         LDKRefund ret_var = CResult_RefundBolt12ParseErrorZ_get_ok(owner_conv);
777         uint64_t ret_ref = 0;
778         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
779         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
780         return ret_ref;
781 }
782
783 static inline struct LDKBolt12ParseError CResult_RefundBolt12ParseErrorZ_get_err(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR owner){
784         LDKBolt12ParseError ret = *owner->contents.err;
785         ret.is_owned = false;
786         return ret;
787 }
788 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_get_err"))) TS_CResult_RefundBolt12ParseErrorZ_get_err(uint64_t owner) {
789         LDKCResult_RefundBolt12ParseErrorZ* owner_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(owner);
790         LDKBolt12ParseError ret_var = CResult_RefundBolt12ParseErrorZ_get_err(owner_conv);
791         uint64_t ret_ref = 0;
792         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
793         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
794         return ret_ref;
795 }
796
797 uint32_t __attribute__((export_name("TS_LDKRetry_ty_from_ptr"))) TS_LDKRetry_ty_from_ptr(uint64_t ptr) {
798         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
799         switch(obj->tag) {
800                 case LDKRetry_Attempts: return 0;
801                 default: abort();
802         }
803 }
804 int32_t __attribute__((export_name("TS_LDKRetry_Attempts_get_attempts"))) TS_LDKRetry_Attempts_get_attempts(uint64_t ptr) {
805         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
806         assert(obj->tag == LDKRetry_Attempts);
807         int32_t attempts_conv = obj->attempts;
808         return attempts_conv;
809 }
810 uint32_t __attribute__((export_name("TS_LDKDecodeError_ty_from_ptr"))) TS_LDKDecodeError_ty_from_ptr(uint64_t ptr) {
811         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
812         switch(obj->tag) {
813                 case LDKDecodeError_UnknownVersion: return 0;
814                 case LDKDecodeError_UnknownRequiredFeature: return 1;
815                 case LDKDecodeError_InvalidValue: return 2;
816                 case LDKDecodeError_ShortRead: return 3;
817                 case LDKDecodeError_BadLengthDescriptor: return 4;
818                 case LDKDecodeError_Io: return 5;
819                 case LDKDecodeError_UnsupportedCompression: return 6;
820                 case LDKDecodeError_DangerousValue: return 7;
821                 default: abort();
822         }
823 }
824 uint32_t __attribute__((export_name("TS_LDKDecodeError_Io_get_io"))) TS_LDKDecodeError_Io_get_io(uint64_t ptr) {
825         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
826         assert(obj->tag == LDKDecodeError_Io);
827         uint32_t io_conv = LDKIOError_to_js(obj->io);
828         return io_conv;
829 }
830 static inline struct LDKRetry CResult_RetryDecodeErrorZ_get_ok(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR owner){
831 CHECK(owner->result_ok);
832         return Retry_clone(&*owner->contents.result);
833 }
834 uint64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_get_ok"))) TS_CResult_RetryDecodeErrorZ_get_ok(uint64_t owner) {
835         LDKCResult_RetryDecodeErrorZ* owner_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(owner);
836         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
837         *ret_copy = CResult_RetryDecodeErrorZ_get_ok(owner_conv);
838         uint64_t ret_ref = tag_ptr(ret_copy, true);
839         return ret_ref;
840 }
841
842 static inline struct LDKDecodeError CResult_RetryDecodeErrorZ_get_err(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR owner){
843 CHECK(!owner->result_ok);
844         return DecodeError_clone(&*owner->contents.err);
845 }
846 uint64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_get_err"))) TS_CResult_RetryDecodeErrorZ_get_err(uint64_t owner) {
847         LDKCResult_RetryDecodeErrorZ* owner_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(owner);
848         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
849         *ret_copy = CResult_RetryDecodeErrorZ_get_err(owner_conv);
850         uint64_t ret_ref = tag_ptr(ret_copy, true);
851         return ret_ref;
852 }
853
854 uint32_t __attribute__((export_name("TS_LDKAPIError_ty_from_ptr"))) TS_LDKAPIError_ty_from_ptr(uint64_t ptr) {
855         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
856         switch(obj->tag) {
857                 case LDKAPIError_APIMisuseError: return 0;
858                 case LDKAPIError_FeeRateTooHigh: return 1;
859                 case LDKAPIError_InvalidRoute: return 2;
860                 case LDKAPIError_ChannelUnavailable: return 3;
861                 case LDKAPIError_MonitorUpdateInProgress: return 4;
862                 case LDKAPIError_IncompatibleShutdownScript: return 5;
863                 default: abort();
864         }
865 }
866 jstring __attribute__((export_name("TS_LDKAPIError_APIMisuseError_get_err"))) TS_LDKAPIError_APIMisuseError_get_err(uint64_t ptr) {
867         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
868         assert(obj->tag == LDKAPIError_APIMisuseError);
869         LDKStr err_str = obj->api_misuse_error.err;
870                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
871         return err_conv;
872 }
873 jstring __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_err"))) TS_LDKAPIError_FeeRateTooHigh_get_err(uint64_t ptr) {
874         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
875         assert(obj->tag == LDKAPIError_FeeRateTooHigh);
876         LDKStr err_str = obj->fee_rate_too_high.err;
877                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
878         return err_conv;
879 }
880 int32_t __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_feerate"))) TS_LDKAPIError_FeeRateTooHigh_get_feerate(uint64_t ptr) {
881         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
882         assert(obj->tag == LDKAPIError_FeeRateTooHigh);
883         int32_t feerate_conv = obj->fee_rate_too_high.feerate;
884         return feerate_conv;
885 }
886 jstring __attribute__((export_name("TS_LDKAPIError_InvalidRoute_get_err"))) TS_LDKAPIError_InvalidRoute_get_err(uint64_t ptr) {
887         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
888         assert(obj->tag == LDKAPIError_InvalidRoute);
889         LDKStr err_str = obj->invalid_route.err;
890                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
891         return err_conv;
892 }
893 jstring __attribute__((export_name("TS_LDKAPIError_ChannelUnavailable_get_err"))) TS_LDKAPIError_ChannelUnavailable_get_err(uint64_t ptr) {
894         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
895         assert(obj->tag == LDKAPIError_ChannelUnavailable);
896         LDKStr err_str = obj->channel_unavailable.err;
897                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
898         return err_conv;
899 }
900 uint64_t __attribute__((export_name("TS_LDKAPIError_IncompatibleShutdownScript_get_script"))) TS_LDKAPIError_IncompatibleShutdownScript_get_script(uint64_t ptr) {
901         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
902         assert(obj->tag == LDKAPIError_IncompatibleShutdownScript);
903         LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
904                         uint64_t script_ref = 0;
905                         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
906                         script_ref = tag_ptr(script_var.inner, false);
907         return script_ref;
908 }
909 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
910 CHECK(owner->result_ok);
911         return *owner->contents.result;
912 }
913 void  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_ok"))) TS_CResult_NoneAPIErrorZ_get_ok(uint64_t owner) {
914         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
915         CResult_NoneAPIErrorZ_get_ok(owner_conv);
916 }
917
918 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
919 CHECK(!owner->result_ok);
920         return APIError_clone(&*owner->contents.err);
921 }
922 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_err"))) TS_CResult_NoneAPIErrorZ_get_err(uint64_t owner) {
923         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
924         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
925         *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
926         uint64_t ret_ref = tag_ptr(ret_copy, true);
927         return ret_ref;
928 }
929
930 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
931         LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
932         for (size_t i = 0; i < ret.datalen; i++) {
933                 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
934         }
935         return ret;
936 }
937 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
938         LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
939         for (size_t i = 0; i < ret.datalen; i++) {
940                 ret.data[i] = APIError_clone(&orig->data[i]);
941         }
942         return ret;
943 }
944 uint32_t __attribute__((export_name("TS_LDKCOption_ThirtyTwoBytesZ_ty_from_ptr"))) TS_LDKCOption_ThirtyTwoBytesZ_ty_from_ptr(uint64_t ptr) {
945         LDKCOption_ThirtyTwoBytesZ *obj = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(ptr);
946         switch(obj->tag) {
947                 case LDKCOption_ThirtyTwoBytesZ_Some: return 0;
948                 case LDKCOption_ThirtyTwoBytesZ_None: return 1;
949                 default: abort();
950         }
951 }
952 int8_tArray __attribute__((export_name("TS_LDKCOption_ThirtyTwoBytesZ_Some_get_some"))) TS_LDKCOption_ThirtyTwoBytesZ_Some_get_some(uint64_t ptr) {
953         LDKCOption_ThirtyTwoBytesZ *obj = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(ptr);
954         assert(obj->tag == LDKCOption_ThirtyTwoBytesZ_Some);
955         int8_tArray some_arr = init_int8_tArray(32, __LINE__);
956         memcpy(some_arr->elems, obj->some.data, 32);
957         return some_arr;
958 }
959 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_u8ZZ_ty_from_ptr"))) TS_LDKCOption_CVec_u8ZZ_ty_from_ptr(uint64_t ptr) {
960         LDKCOption_CVec_u8ZZ *obj = (LDKCOption_CVec_u8ZZ*)untag_ptr(ptr);
961         switch(obj->tag) {
962                 case LDKCOption_CVec_u8ZZ_Some: return 0;
963                 case LDKCOption_CVec_u8ZZ_None: return 1;
964                 default: abort();
965         }
966 }
967 int8_tArray __attribute__((export_name("TS_LDKCOption_CVec_u8ZZ_Some_get_some"))) TS_LDKCOption_CVec_u8ZZ_Some_get_some(uint64_t ptr) {
968         LDKCOption_CVec_u8ZZ *obj = (LDKCOption_CVec_u8ZZ*)untag_ptr(ptr);
969         assert(obj->tag == LDKCOption_CVec_u8ZZ_Some);
970         LDKCVec_u8Z some_var = obj->some;
971                         int8_tArray some_arr = init_int8_tArray(some_var.datalen, __LINE__);
972                         memcpy(some_arr->elems, some_var.data, some_var.datalen);
973         return some_arr;
974 }
975 static inline struct LDKRecipientOnionFields CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
976         LDKRecipientOnionFields ret = *owner->contents.result;
977         ret.is_owned = false;
978         return ret;
979 }
980 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_get_ok"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(uint64_t owner) {
981         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
982         LDKRecipientOnionFields ret_var = CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(owner_conv);
983         uint64_t ret_ref = 0;
984         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
985         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
986         return ret_ref;
987 }
988
989 static inline struct LDKDecodeError CResult_RecipientOnionFieldsDecodeErrorZ_get_err(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
990 CHECK(!owner->result_ok);
991         return DecodeError_clone(&*owner->contents.err);
992 }
993 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_get_err"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_get_err(uint64_t owner) {
994         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
995         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
996         *ret_copy = CResult_RecipientOnionFieldsDecodeErrorZ_get_err(owner_conv);
997         uint64_t ret_ref = tag_ptr(ret_copy, true);
998         return ret_ref;
999 }
1000
1001 static inline uint64_t C2Tuple_u64CVec_u8ZZ_get_a(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR owner){
1002         return owner->a;
1003 }
1004 int64_t  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_get_a"))) TS_C2Tuple_u64CVec_u8ZZ_get_a(uint64_t owner) {
1005         LDKC2Tuple_u64CVec_u8ZZ* owner_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(owner);
1006         int64_t ret_conv = C2Tuple_u64CVec_u8ZZ_get_a(owner_conv);
1007         return ret_conv;
1008 }
1009
1010 static inline struct LDKCVec_u8Z C2Tuple_u64CVec_u8ZZ_get_b(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR owner){
1011         return CVec_u8Z_clone(&owner->b);
1012 }
1013 int8_tArray  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_get_b"))) TS_C2Tuple_u64CVec_u8ZZ_get_b(uint64_t owner) {
1014         LDKC2Tuple_u64CVec_u8ZZ* owner_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(owner);
1015         LDKCVec_u8Z ret_var = C2Tuple_u64CVec_u8ZZ_get_b(owner_conv);
1016         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
1017         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
1018         CVec_u8Z_free(ret_var);
1019         return ret_arr;
1020 }
1021
1022 static inline LDKCVec_C2Tuple_u64CVec_u8ZZZ CVec_C2Tuple_u64CVec_u8ZZZ_clone(const LDKCVec_C2Tuple_u64CVec_u8ZZZ *orig) {
1023         LDKCVec_C2Tuple_u64CVec_u8ZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ) * orig->datalen, "LDKCVec_C2Tuple_u64CVec_u8ZZZ clone bytes"), .datalen = orig->datalen };
1024         for (size_t i = 0; i < ret.datalen; i++) {
1025                 ret.data[i] = C2Tuple_u64CVec_u8ZZ_clone(&orig->data[i]);
1026         }
1027         return ret;
1028 }
1029 static inline struct LDKRecipientOnionFields CResult_RecipientOnionFieldsNoneZ_get_ok(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR owner){
1030         LDKRecipientOnionFields ret = *owner->contents.result;
1031         ret.is_owned = false;
1032         return ret;
1033 }
1034 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_get_ok"))) TS_CResult_RecipientOnionFieldsNoneZ_get_ok(uint64_t owner) {
1035         LDKCResult_RecipientOnionFieldsNoneZ* owner_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(owner);
1036         LDKRecipientOnionFields ret_var = CResult_RecipientOnionFieldsNoneZ_get_ok(owner_conv);
1037         uint64_t ret_ref = 0;
1038         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1039         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1040         return ret_ref;
1041 }
1042
1043 static inline void CResult_RecipientOnionFieldsNoneZ_get_err(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR owner){
1044 CHECK(!owner->result_ok);
1045         return *owner->contents.err;
1046 }
1047 void  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_get_err"))) TS_CResult_RecipientOnionFieldsNoneZ_get_err(uint64_t owner) {
1048         LDKCResult_RecipientOnionFieldsNoneZ* owner_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(owner);
1049         CResult_RecipientOnionFieldsNoneZ_get_err(owner_conv);
1050 }
1051
1052 static inline struct LDKUnsignedBolt12Invoice CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_get_ok(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR owner){
1053         LDKUnsignedBolt12Invoice ret = *owner->contents.result;
1054         ret.is_owned = false;
1055         return ret;
1056 }
1057 uint64_t  __attribute__((export_name("TS_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_get_ok"))) TS_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_get_ok(uint64_t owner) {
1058         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* owner_conv = (LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(owner);
1059         LDKUnsignedBolt12Invoice ret_var = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_get_ok(owner_conv);
1060         uint64_t ret_ref = 0;
1061         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1062         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1063         return ret_ref;
1064 }
1065
1066 static inline enum LDKBolt12SemanticError CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_get_err(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR owner){
1067 CHECK(!owner->result_ok);
1068         return Bolt12SemanticError_clone(&*owner->contents.err);
1069 }
1070 uint32_t  __attribute__((export_name("TS_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_get_err"))) TS_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_get_err(uint64_t owner) {
1071         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* owner_conv = (LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(owner);
1072         uint32_t ret_conv = LDKBolt12SemanticError_to_js(CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_get_err(owner_conv));
1073         return ret_conv;
1074 }
1075
1076 static inline struct LDKBolt12Invoice CResult_Bolt12InvoiceBolt12SemanticErrorZ_get_ok(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR owner){
1077         LDKBolt12Invoice ret = *owner->contents.result;
1078         ret.is_owned = false;
1079         return ret;
1080 }
1081 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceBolt12SemanticErrorZ_get_ok"))) TS_CResult_Bolt12InvoiceBolt12SemanticErrorZ_get_ok(uint64_t owner) {
1082         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(owner);
1083         LDKBolt12Invoice ret_var = CResult_Bolt12InvoiceBolt12SemanticErrorZ_get_ok(owner_conv);
1084         uint64_t ret_ref = 0;
1085         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1086         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1087         return ret_ref;
1088 }
1089
1090 static inline enum LDKBolt12SemanticError CResult_Bolt12InvoiceBolt12SemanticErrorZ_get_err(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR owner){
1091 CHECK(!owner->result_ok);
1092         return Bolt12SemanticError_clone(&*owner->contents.err);
1093 }
1094 uint32_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceBolt12SemanticErrorZ_get_err"))) TS_CResult_Bolt12InvoiceBolt12SemanticErrorZ_get_err(uint64_t owner) {
1095         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(owner);
1096         uint32_t ret_conv = LDKBolt12SemanticError_to_js(CResult_Bolt12InvoiceBolt12SemanticErrorZ_get_err(owner_conv));
1097         return ret_conv;
1098 }
1099
1100 static inline struct LDKSchnorrSignature CResult_SchnorrSignatureNoneZ_get_ok(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR owner){
1101 CHECK(owner->result_ok);
1102         return *owner->contents.result;
1103 }
1104 int8_tArray  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_get_ok"))) TS_CResult_SchnorrSignatureNoneZ_get_ok(uint64_t owner) {
1105         LDKCResult_SchnorrSignatureNoneZ* owner_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(owner);
1106         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
1107         memcpy(ret_arr->elems, CResult_SchnorrSignatureNoneZ_get_ok(owner_conv).compact_form, 64);
1108         return ret_arr;
1109 }
1110
1111 static inline void CResult_SchnorrSignatureNoneZ_get_err(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR owner){
1112 CHECK(!owner->result_ok);
1113         return *owner->contents.err;
1114 }
1115 void  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_get_err"))) TS_CResult_SchnorrSignatureNoneZ_get_err(uint64_t owner) {
1116         LDKCResult_SchnorrSignatureNoneZ* owner_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(owner);
1117         CResult_SchnorrSignatureNoneZ_get_err(owner_conv);
1118 }
1119
1120 static inline LDKCVec_ThirtyTwoBytesZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_ThirtyTwoBytesZ *orig) {
1121         LDKCVec_ThirtyTwoBytesZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_ThirtyTwoBytesZ clone bytes"), .datalen = orig->datalen };
1122         for (size_t i = 0; i < ret.datalen; i++) {
1123                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
1124         }
1125         return ret;
1126 }
1127 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_ThirtyTwoBytesZZ_ty_from_ptr"))) TS_LDKCOption_CVec_ThirtyTwoBytesZZ_ty_from_ptr(uint64_t ptr) {
1128         LDKCOption_CVec_ThirtyTwoBytesZZ *obj = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(ptr);
1129         switch(obj->tag) {
1130                 case LDKCOption_CVec_ThirtyTwoBytesZZ_Some: return 0;
1131                 case LDKCOption_CVec_ThirtyTwoBytesZZ_None: return 1;
1132                 default: abort();
1133         }
1134 }
1135 ptrArray __attribute__((export_name("TS_LDKCOption_CVec_ThirtyTwoBytesZZ_Some_get_some"))) TS_LDKCOption_CVec_ThirtyTwoBytesZZ_Some_get_some(uint64_t ptr) {
1136         LDKCOption_CVec_ThirtyTwoBytesZZ *obj = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(ptr);
1137         assert(obj->tag == LDKCOption_CVec_ThirtyTwoBytesZZ_Some);
1138         LDKCVec_ThirtyTwoBytesZ some_var = obj->some;
1139                         ptrArray some_arr = NULL;
1140                         some_arr = init_ptrArray(some_var.datalen, __LINE__);
1141                         int8_tArray *some_arr_ptr = (int8_tArray*)(((uint8_t*)some_arr) + 8);
1142                         for (size_t m = 0; m < some_var.datalen; m++) {
1143                                 int8_tArray some_conv_12_arr = init_int8_tArray(32, __LINE__);
1144                                 memcpy(some_conv_12_arr->elems, some_var.data[m].data, 32);
1145                                 some_arr_ptr[m] = some_conv_12_arr;
1146                         }
1147                         
1148         return some_arr;
1149 }
1150 uint32_t __attribute__((export_name("TS_LDKAmount_ty_from_ptr"))) TS_LDKAmount_ty_from_ptr(uint64_t ptr) {
1151         LDKAmount *obj = (LDKAmount*)untag_ptr(ptr);
1152         switch(obj->tag) {
1153                 case LDKAmount_Bitcoin: return 0;
1154                 case LDKAmount_Currency: return 1;
1155                 default: abort();
1156         }
1157 }
1158 int64_t __attribute__((export_name("TS_LDKAmount_Bitcoin_get_amount_msats"))) TS_LDKAmount_Bitcoin_get_amount_msats(uint64_t ptr) {
1159         LDKAmount *obj = (LDKAmount*)untag_ptr(ptr);
1160         assert(obj->tag == LDKAmount_Bitcoin);
1161         int64_t amount_msats_conv = obj->bitcoin.amount_msats;
1162         return amount_msats_conv;
1163 }
1164 int8_tArray __attribute__((export_name("TS_LDKAmount_Currency_get_iso4217_code"))) TS_LDKAmount_Currency_get_iso4217_code(uint64_t ptr) {
1165         LDKAmount *obj = (LDKAmount*)untag_ptr(ptr);
1166         assert(obj->tag == LDKAmount_Currency);
1167         int8_tArray iso4217_code_arr = init_int8_tArray(3, __LINE__);
1168         memcpy(iso4217_code_arr->elems, obj->currency.iso4217_code.data, 3);
1169         return iso4217_code_arr;
1170 }
1171 int64_t __attribute__((export_name("TS_LDKAmount_Currency_get_amount"))) TS_LDKAmount_Currency_get_amount(uint64_t ptr) {
1172         LDKAmount *obj = (LDKAmount*)untag_ptr(ptr);
1173         assert(obj->tag == LDKAmount_Currency);
1174         int64_t amount_conv = obj->currency.amount;
1175         return amount_conv;
1176 }
1177 uint32_t __attribute__((export_name("TS_LDKCOption_AmountZ_ty_from_ptr"))) TS_LDKCOption_AmountZ_ty_from_ptr(uint64_t ptr) {
1178         LDKCOption_AmountZ *obj = (LDKCOption_AmountZ*)untag_ptr(ptr);
1179         switch(obj->tag) {
1180                 case LDKCOption_AmountZ_Some: return 0;
1181                 case LDKCOption_AmountZ_None: return 1;
1182                 default: abort();
1183         }
1184 }
1185 uint64_t __attribute__((export_name("TS_LDKCOption_AmountZ_Some_get_some"))) TS_LDKCOption_AmountZ_Some_get_some(uint64_t ptr) {
1186         LDKCOption_AmountZ *obj = (LDKCOption_AmountZ*)untag_ptr(ptr);
1187         assert(obj->tag == LDKCOption_AmountZ_Some);
1188         uint64_t some_ref = tag_ptr(&obj->some, false);
1189         return some_ref;
1190 }
1191 uint32_t __attribute__((export_name("TS_LDKQuantity_ty_from_ptr"))) TS_LDKQuantity_ty_from_ptr(uint64_t ptr) {
1192         LDKQuantity *obj = (LDKQuantity*)untag_ptr(ptr);
1193         switch(obj->tag) {
1194                 case LDKQuantity_Bounded: return 0;
1195                 case LDKQuantity_Unbounded: return 1;
1196                 case LDKQuantity_One: return 2;
1197                 default: abort();
1198         }
1199 }
1200 int64_t __attribute__((export_name("TS_LDKQuantity_Bounded_get_bounded"))) TS_LDKQuantity_Bounded_get_bounded(uint64_t ptr) {
1201         LDKQuantity *obj = (LDKQuantity*)untag_ptr(ptr);
1202         assert(obj->tag == LDKQuantity_Bounded);
1203         int64_t bounded_conv = obj->bounded;
1204         return bounded_conv;
1205 }
1206 uint32_t __attribute__((export_name("TS_LDKCOption_QuantityZ_ty_from_ptr"))) TS_LDKCOption_QuantityZ_ty_from_ptr(uint64_t ptr) {
1207         LDKCOption_QuantityZ *obj = (LDKCOption_QuantityZ*)untag_ptr(ptr);
1208         switch(obj->tag) {
1209                 case LDKCOption_QuantityZ_Some: return 0;
1210                 case LDKCOption_QuantityZ_None: return 1;
1211                 default: abort();
1212         }
1213 }
1214 uint64_t __attribute__((export_name("TS_LDKCOption_QuantityZ_Some_get_some"))) TS_LDKCOption_QuantityZ_Some_get_some(uint64_t ptr) {
1215         LDKCOption_QuantityZ *obj = (LDKCOption_QuantityZ*)untag_ptr(ptr);
1216         assert(obj->tag == LDKCOption_QuantityZ_Some);
1217         uint64_t some_ref = tag_ptr(&obj->some, false);
1218         return some_ref;
1219 }
1220 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesNoneZ_get_ok(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR owner){
1221 CHECK(owner->result_ok);
1222         return ThirtyTwoBytes_clone(&*owner->contents.result);
1223 }
1224 int8_tArray  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_get_ok"))) TS_CResult_ThirtyTwoBytesNoneZ_get_ok(uint64_t owner) {
1225         LDKCResult_ThirtyTwoBytesNoneZ* owner_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(owner);
1226         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
1227         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesNoneZ_get_ok(owner_conv).data, 32);
1228         return ret_arr;
1229 }
1230
1231 static inline void CResult_ThirtyTwoBytesNoneZ_get_err(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR owner){
1232 CHECK(!owner->result_ok);
1233         return *owner->contents.err;
1234 }
1235 void  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_get_err"))) TS_CResult_ThirtyTwoBytesNoneZ_get_err(uint64_t owner) {
1236         LDKCResult_ThirtyTwoBytesNoneZ* owner_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(owner);
1237         CResult_ThirtyTwoBytesNoneZ_get_err(owner_conv);
1238 }
1239
1240 static inline struct LDKBlindedPayInfo CResult_BlindedPayInfoDecodeErrorZ_get_ok(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
1241         LDKBlindedPayInfo ret = *owner->contents.result;
1242         ret.is_owned = false;
1243         return ret;
1244 }
1245 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_get_ok"))) TS_CResult_BlindedPayInfoDecodeErrorZ_get_ok(uint64_t owner) {
1246         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
1247         LDKBlindedPayInfo ret_var = CResult_BlindedPayInfoDecodeErrorZ_get_ok(owner_conv);
1248         uint64_t ret_ref = 0;
1249         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1250         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1251         return ret_ref;
1252 }
1253
1254 static inline struct LDKDecodeError CResult_BlindedPayInfoDecodeErrorZ_get_err(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
1255 CHECK(!owner->result_ok);
1256         return DecodeError_clone(&*owner->contents.err);
1257 }
1258 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_get_err"))) TS_CResult_BlindedPayInfoDecodeErrorZ_get_err(uint64_t owner) {
1259         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
1260         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1261         *ret_copy = CResult_BlindedPayInfoDecodeErrorZ_get_err(owner_conv);
1262         uint64_t ret_ref = tag_ptr(ret_copy, true);
1263         return ret_ref;
1264 }
1265
1266 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1267         LDKDelayedPaymentOutputDescriptor ret = *owner->contents.result;
1268         ret.is_owned = false;
1269         return ret;
1270 }
1271 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
1272         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1273         LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
1274         uint64_t ret_ref = 0;
1275         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1276         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1277         return ret_ref;
1278 }
1279
1280 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1281 CHECK(!owner->result_ok);
1282         return DecodeError_clone(&*owner->contents.err);
1283 }
1284 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
1285         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1286         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1287         *ret_copy = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
1288         uint64_t ret_ref = tag_ptr(ret_copy, true);
1289         return ret_ref;
1290 }
1291
1292 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1293         LDKStaticPaymentOutputDescriptor ret = *owner->contents.result;
1294         ret.is_owned = false;
1295         return ret;
1296 }
1297 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
1298         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1299         LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
1300         uint64_t ret_ref = 0;
1301         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1302         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1303         return ret_ref;
1304 }
1305
1306 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1307 CHECK(!owner->result_ok);
1308         return DecodeError_clone(&*owner->contents.err);
1309 }
1310 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
1311         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1312         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1313         *ret_copy = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
1314         uint64_t ret_ref = tag_ptr(ret_copy, true);
1315         return ret_ref;
1316 }
1317
1318 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_ty_from_ptr"))) TS_LDKSpendableOutputDescriptor_ty_from_ptr(uint64_t ptr) {
1319         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1320         switch(obj->tag) {
1321                 case LDKSpendableOutputDescriptor_StaticOutput: return 0;
1322                 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: return 1;
1323                 case LDKSpendableOutputDescriptor_StaticPaymentOutput: return 2;
1324                 default: abort();
1325         }
1326 }
1327 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint(uint64_t ptr) {
1328         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1329         assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1330         LDKOutPoint outpoint_var = obj->static_output.outpoint;
1331                         uint64_t outpoint_ref = 0;
1332                         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
1333                         outpoint_ref = tag_ptr(outpoint_var.inner, false);
1334         return outpoint_ref;
1335 }
1336 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_output"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_output(uint64_t ptr) {
1337         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1338         assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1339         LDKTxOut* output_ref = &obj->static_output.output;
1340         return tag_ptr(output_ref, false);
1341 }
1342 int8_tArray __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_channel_keys_id"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_channel_keys_id(uint64_t ptr) {
1343         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1344         assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1345         int8_tArray channel_keys_id_arr = init_int8_tArray(32, __LINE__);
1346         memcpy(channel_keys_id_arr->elems, obj->static_output.channel_keys_id.data, 32);
1347         return channel_keys_id_arr;
1348 }
1349 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output"))) TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output(uint64_t ptr) {
1350         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1351         assert(obj->tag == LDKSpendableOutputDescriptor_DelayedPaymentOutput);
1352         LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1353                         uint64_t delayed_payment_output_ref = 0;
1354                         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
1355                         delayed_payment_output_ref = tag_ptr(delayed_payment_output_var.inner, false);
1356         return delayed_payment_output_ref;
1357 }
1358 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output"))) TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output(uint64_t ptr) {
1359         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1360         assert(obj->tag == LDKSpendableOutputDescriptor_StaticPaymentOutput);
1361         LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1362                         uint64_t static_payment_output_ref = 0;
1363                         CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
1364                         static_payment_output_ref = tag_ptr(static_payment_output_var.inner, false);
1365         return static_payment_output_ref;
1366 }
1367 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1368 CHECK(owner->result_ok);
1369         return SpendableOutputDescriptor_clone(&*owner->contents.result);
1370 }
1371 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
1372         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1373         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
1374         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
1375         uint64_t ret_ref = tag_ptr(ret_copy, true);
1376         return ret_ref;
1377 }
1378
1379 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1380 CHECK(!owner->result_ok);
1381         return DecodeError_clone(&*owner->contents.err);
1382 }
1383 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
1384         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1385         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1386         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
1387         uint64_t ret_ref = tag_ptr(ret_copy, true);
1388         return ret_ref;
1389 }
1390
1391 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1392         LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1393         for (size_t i = 0; i < ret.datalen; i++) {
1394                 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1395         }
1396         return ret;
1397 }
1398 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
1399         LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
1400         for (size_t i = 0; i < ret.datalen; i++) {
1401                 ret.data[i] = TxOut_clone(&orig->data[i]);
1402         }
1403         return ret;
1404 }
1405 uint32_t __attribute__((export_name("TS_LDKCOption_u32Z_ty_from_ptr"))) TS_LDKCOption_u32Z_ty_from_ptr(uint64_t ptr) {
1406         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
1407         switch(obj->tag) {
1408                 case LDKCOption_u32Z_Some: return 0;
1409                 case LDKCOption_u32Z_None: return 1;
1410                 default: abort();
1411         }
1412 }
1413 int32_t __attribute__((export_name("TS_LDKCOption_u32Z_Some_get_some"))) TS_LDKCOption_u32Z_Some_get_some(uint64_t ptr) {
1414         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
1415         assert(obj->tag == LDKCOption_u32Z_Some);
1416         int32_t some_conv = obj->some;
1417         return some_conv;
1418 }
1419 static inline struct LDKCVec_u8Z C2Tuple_CVec_u8Zu64Z_get_a(LDKC2Tuple_CVec_u8Zu64Z *NONNULL_PTR owner){
1420         return CVec_u8Z_clone(&owner->a);
1421 }
1422 int8_tArray  __attribute__((export_name("TS_C2Tuple_CVec_u8Zu64Z_get_a"))) TS_C2Tuple_CVec_u8Zu64Z_get_a(uint64_t owner) {
1423         LDKC2Tuple_CVec_u8Zu64Z* owner_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(owner);
1424         LDKCVec_u8Z ret_var = C2Tuple_CVec_u8Zu64Z_get_a(owner_conv);
1425         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
1426         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
1427         CVec_u8Z_free(ret_var);
1428         return ret_arr;
1429 }
1430
1431 static inline uint64_t C2Tuple_CVec_u8Zu64Z_get_b(LDKC2Tuple_CVec_u8Zu64Z *NONNULL_PTR owner){
1432         return owner->b;
1433 }
1434 int64_t  __attribute__((export_name("TS_C2Tuple_CVec_u8Zu64Z_get_b"))) TS_C2Tuple_CVec_u8Zu64Z_get_b(uint64_t owner) {
1435         LDKC2Tuple_CVec_u8Zu64Z* owner_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(owner);
1436         int64_t ret_conv = C2Tuple_CVec_u8Zu64Z_get_b(owner_conv);
1437         return ret_conv;
1438 }
1439
1440 static inline struct LDKC2Tuple_CVec_u8Zu64Z CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_ok(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ *NONNULL_PTR owner){
1441 CHECK(owner->result_ok);
1442         return C2Tuple_CVec_u8Zu64Z_clone(&*owner->contents.result);
1443 }
1444 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_ok"))) TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_ok(uint64_t owner) {
1445         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* owner_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(owner);
1446         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
1447         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_ok(owner_conv);
1448         return tag_ptr(ret_conv, true);
1449 }
1450
1451 static inline void CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_err(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ *NONNULL_PTR owner){
1452 CHECK(!owner->result_ok);
1453         return *owner->contents.err;
1454 }
1455 void  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_err"))) TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_err(uint64_t owner) {
1456         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* owner_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(owner);
1457         CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_err(owner_conv);
1458 }
1459
1460 static inline struct LDKChannelDerivationParameters CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR owner){
1461         LDKChannelDerivationParameters ret = *owner->contents.result;
1462         ret.is_owned = false;
1463         return ret;
1464 }
1465 uint64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_get_ok"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(uint64_t owner) {
1466         LDKCResult_ChannelDerivationParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(owner);
1467         LDKChannelDerivationParameters ret_var = CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(owner_conv);
1468         uint64_t ret_ref = 0;
1469         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1470         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1471         return ret_ref;
1472 }
1473
1474 static inline struct LDKDecodeError CResult_ChannelDerivationParametersDecodeErrorZ_get_err(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR owner){
1475 CHECK(!owner->result_ok);
1476         return DecodeError_clone(&*owner->contents.err);
1477 }
1478 uint64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_get_err"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_get_err(uint64_t owner) {
1479         LDKCResult_ChannelDerivationParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(owner);
1480         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1481         *ret_copy = CResult_ChannelDerivationParametersDecodeErrorZ_get_err(owner_conv);
1482         uint64_t ret_ref = tag_ptr(ret_copy, true);
1483         return ret_ref;
1484 }
1485
1486 static inline struct LDKHTLCDescriptor CResult_HTLCDescriptorDecodeErrorZ_get_ok(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR owner){
1487         LDKHTLCDescriptor ret = *owner->contents.result;
1488         ret.is_owned = false;
1489         return ret;
1490 }
1491 uint64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_get_ok"))) TS_CResult_HTLCDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
1492         LDKCResult_HTLCDescriptorDecodeErrorZ* owner_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(owner);
1493         LDKHTLCDescriptor ret_var = CResult_HTLCDescriptorDecodeErrorZ_get_ok(owner_conv);
1494         uint64_t ret_ref = 0;
1495         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1496         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1497         return ret_ref;
1498 }
1499
1500 static inline struct LDKDecodeError CResult_HTLCDescriptorDecodeErrorZ_get_err(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR owner){
1501 CHECK(!owner->result_ok);
1502         return DecodeError_clone(&*owner->contents.err);
1503 }
1504 uint64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_get_err"))) TS_CResult_HTLCDescriptorDecodeErrorZ_get_err(uint64_t owner) {
1505         LDKCResult_HTLCDescriptorDecodeErrorZ* owner_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(owner);
1506         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1507         *ret_copy = CResult_HTLCDescriptorDecodeErrorZ_get_err(owner_conv);
1508         uint64_t ret_ref = tag_ptr(ret_copy, true);
1509         return ret_ref;
1510 }
1511
1512 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
1513 CHECK(owner->result_ok);
1514         return *owner->contents.result;
1515 }
1516 void  __attribute__((export_name("TS_CResult_NoneNoneZ_get_ok"))) TS_CResult_NoneNoneZ_get_ok(uint64_t owner) {
1517         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
1518         CResult_NoneNoneZ_get_ok(owner_conv);
1519 }
1520
1521 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
1522 CHECK(!owner->result_ok);
1523         return *owner->contents.err;
1524 }
1525 void  __attribute__((export_name("TS_CResult_NoneNoneZ_get_err"))) TS_CResult_NoneNoneZ_get_err(uint64_t owner) {
1526         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
1527         CResult_NoneNoneZ_get_err(owner_conv);
1528 }
1529
1530 static inline struct LDKPublicKey CResult_PublicKeyNoneZ_get_ok(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
1531 CHECK(owner->result_ok);
1532         return *owner->contents.result;
1533 }
1534 int8_tArray  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_get_ok"))) TS_CResult_PublicKeyNoneZ_get_ok(uint64_t owner) {
1535         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
1536         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
1537         memcpy(ret_arr->elems, CResult_PublicKeyNoneZ_get_ok(owner_conv).compressed_form, 33);
1538         return ret_arr;
1539 }
1540
1541 static inline void CResult_PublicKeyNoneZ_get_err(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
1542 CHECK(!owner->result_ok);
1543         return *owner->contents.err;
1544 }
1545 void  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_get_err"))) TS_CResult_PublicKeyNoneZ_get_err(uint64_t owner) {
1546         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
1547         CResult_PublicKeyNoneZ_get_err(owner_conv);
1548 }
1549
1550 uint32_t __attribute__((export_name("TS_LDKCOption_BigEndianScalarZ_ty_from_ptr"))) TS_LDKCOption_BigEndianScalarZ_ty_from_ptr(uint64_t ptr) {
1551         LDKCOption_BigEndianScalarZ *obj = (LDKCOption_BigEndianScalarZ*)untag_ptr(ptr);
1552         switch(obj->tag) {
1553                 case LDKCOption_BigEndianScalarZ_Some: return 0;
1554                 case LDKCOption_BigEndianScalarZ_None: return 1;
1555                 default: abort();
1556         }
1557 }
1558 uint64_t __attribute__((export_name("TS_LDKCOption_BigEndianScalarZ_Some_get_some"))) TS_LDKCOption_BigEndianScalarZ_Some_get_some(uint64_t ptr) {
1559         LDKCOption_BigEndianScalarZ *obj = (LDKCOption_BigEndianScalarZ*)untag_ptr(ptr);
1560         assert(obj->tag == LDKCOption_BigEndianScalarZ_Some);
1561         LDKBigEndianScalar* some_ref = &obj->some;
1562         return tag_ptr(some_ref, false);
1563 }
1564 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
1565 CHECK(owner->result_ok);
1566         return *owner->contents.result;
1567 }
1568 int8_tArray  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_ok"))) TS_CResult_RecoverableSignatureNoneZ_get_ok(uint64_t owner) {
1569         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
1570         int8_tArray ret_arr = init_int8_tArray(68, __LINE__);
1571         memcpy(ret_arr->elems, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form, 68);
1572         return ret_arr;
1573 }
1574
1575 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
1576 CHECK(!owner->result_ok);
1577         return *owner->contents.err;
1578 }
1579 void  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_err"))) TS_CResult_RecoverableSignatureNoneZ_get_err(uint64_t owner) {
1580         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
1581         CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
1582 }
1583
1584 static inline struct LDKECDSASignature CResult_ECDSASignatureNoneZ_get_ok(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR owner){
1585 CHECK(owner->result_ok);
1586         return *owner->contents.result;
1587 }
1588 int8_tArray  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_get_ok"))) TS_CResult_ECDSASignatureNoneZ_get_ok(uint64_t owner) {
1589         LDKCResult_ECDSASignatureNoneZ* owner_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(owner);
1590         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
1591         memcpy(ret_arr->elems, CResult_ECDSASignatureNoneZ_get_ok(owner_conv).compact_form, 64);
1592         return ret_arr;
1593 }
1594
1595 static inline void CResult_ECDSASignatureNoneZ_get_err(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR owner){
1596 CHECK(!owner->result_ok);
1597         return *owner->contents.err;
1598 }
1599 void  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_get_err"))) TS_CResult_ECDSASignatureNoneZ_get_err(uint64_t owner) {
1600         LDKCResult_ECDSASignatureNoneZ* owner_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(owner);
1601         CResult_ECDSASignatureNoneZ_get_err(owner_conv);
1602 }
1603
1604 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
1605 CHECK(owner->result_ok);
1606         return *owner->contents.result;
1607 }
1608 int8_tArray  __attribute__((export_name("TS_CResult_TransactionNoneZ_get_ok"))) TS_CResult_TransactionNoneZ_get_ok(uint64_t owner) {
1609         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
1610         LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
1611         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
1612         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
1613         return ret_arr;
1614 }
1615
1616 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
1617 CHECK(!owner->result_ok);
1618         return *owner->contents.err;
1619 }
1620 void  __attribute__((export_name("TS_CResult_TransactionNoneZ_get_err"))) TS_CResult_TransactionNoneZ_get_err(uint64_t owner) {
1621         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
1622         CResult_TransactionNoneZ_get_err(owner_conv);
1623 }
1624
1625 static inline struct LDKECDSASignature C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR owner){
1626         return owner->a;
1627 }
1628 int8_tArray  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(uint64_t owner) {
1629         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* owner_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(owner);
1630         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
1631         memcpy(ret_arr->elems, C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(owner_conv).compact_form, 64);
1632         return ret_arr;
1633 }
1634
1635 static inline struct LDKCVec_ECDSASignatureZ C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR owner){
1636         return owner->b;
1637 }
1638 ptrArray  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(uint64_t owner) {
1639         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* owner_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(owner);
1640         LDKCVec_ECDSASignatureZ ret_var = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(owner_conv);
1641         ptrArray ret_arr = NULL;
1642         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
1643         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
1644         for (size_t m = 0; m < ret_var.datalen; m++) {
1645                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
1646                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
1647                 ret_arr_ptr[m] = ret_conv_12_arr;
1648         }
1649         
1650         return ret_arr;
1651 }
1652
1653 static inline struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR owner){
1654 CHECK(owner->result_ok);
1655         return C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(&*owner->contents.result);
1656 }
1657 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(uint64_t owner) {
1658         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(owner);
1659         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
1660         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(owner_conv);
1661         return tag_ptr(ret_conv, true);
1662 }
1663
1664 static inline void CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR owner){
1665 CHECK(!owner->result_ok);
1666         return *owner->contents.err;
1667 }
1668 void  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(uint64_t owner) {
1669         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(owner);
1670         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(owner_conv);
1671 }
1672
1673 typedef struct LDKChannelSigner_JCalls {
1674         atomic_size_t refcnt;
1675         uint32_t instance_ptr;
1676 } LDKChannelSigner_JCalls;
1677 static void LDKChannelSigner_JCalls_free(void* this_arg) {
1678         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1679         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1680                 FREE(j_calls);
1681         }
1682 }
1683 LDKPublicKey get_per_commitment_point_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
1684         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1685         int64_t idx_conv = idx;
1686         int8_tArray ret = (int8_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 0, idx_conv, 0, 0, 0, 0, 0);
1687         LDKPublicKey ret_ref;
1688         CHECK(ret->arr_len == 33);
1689         memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret);
1690         return ret_ref;
1691 }
1692 LDKThirtyTwoBytes release_commitment_secret_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
1693         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1694         int64_t idx_conv = idx;
1695         int8_tArray ret = (int8_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 1, idx_conv, 0, 0, 0, 0, 0);
1696         LDKThirtyTwoBytes ret_ref;
1697         CHECK(ret->arr_len == 32);
1698         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
1699         return ret_ref;
1700 }
1701 LDKCResult_NoneNoneZ validate_holder_commitment_LDKChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages) {
1702         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1703         LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
1704         uint64_t holder_tx_ref = 0;
1705         holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
1706         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
1707         holder_tx_ref = tag_ptr(holder_tx_var.inner, holder_tx_var.is_owned);
1708         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_var = outbound_htlc_preimages;
1709         ptrArray outbound_htlc_preimages_arr = NULL;
1710         outbound_htlc_preimages_arr = init_ptrArray(outbound_htlc_preimages_var.datalen, __LINE__);
1711         int8_tArray *outbound_htlc_preimages_arr_ptr = (int8_tArray*)(((uint8_t*)outbound_htlc_preimages_arr) + 8);
1712         for (size_t m = 0; m < outbound_htlc_preimages_var.datalen; m++) {
1713                 int8_tArray outbound_htlc_preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
1714                 memcpy(outbound_htlc_preimages_conv_12_arr->elems, outbound_htlc_preimages_var.data[m].data, 32);
1715                 outbound_htlc_preimages_arr_ptr[m] = outbound_htlc_preimages_conv_12_arr;
1716         }
1717         
1718         FREE(outbound_htlc_preimages_var.data);
1719         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);
1720         void* ret_ptr = untag_ptr(ret);
1721         CHECK_ACCESS(ret_ptr);
1722         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
1723         FREE(untag_ptr(ret));
1724         return ret_conv;
1725 }
1726 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
1727         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1728         int64_t idx_conv = idx;
1729         int8_tArray secret_arr = init_int8_tArray(32, __LINE__);
1730         memcpy(secret_arr->elems, *secret, 32);
1731         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 3, idx_conv, (uint32_t)secret_arr, 0, 0, 0, 0);
1732         void* ret_ptr = untag_ptr(ret);
1733         CHECK_ACCESS(ret_ptr);
1734         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
1735         FREE(untag_ptr(ret));
1736         return ret_conv;
1737 }
1738 LDKThirtyTwoBytes channel_keys_id_LDKChannelSigner_jcall(const void* this_arg) {
1739         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1740         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 4, 0, 0, 0, 0, 0, 0);
1741         LDKThirtyTwoBytes ret_ref;
1742         CHECK(ret->arr_len == 32);
1743         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
1744         return ret_ref;
1745 }
1746 void provide_channel_parameters_LDKChannelSigner_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
1747         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1748         LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
1749         uint64_t channel_parameters_ref = 0;
1750         channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
1751         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
1752         channel_parameters_ref = tag_ptr(channel_parameters_var.inner, channel_parameters_var.is_owned);
1753         js_invoke_function_buuuuu(j_calls->instance_ptr, 5, channel_parameters_ref, 0, 0, 0, 0, 0);
1754 }
1755 static void LDKChannelSigner_JCalls_cloned(LDKChannelSigner* new_obj) {
1756         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) new_obj->this_arg;
1757         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1758 }
1759 static inline LDKChannelSigner LDKChannelSigner_init (JSValue o, uint64_t pubkeys) {
1760         LDKChannelSigner_JCalls *calls = MALLOC(sizeof(LDKChannelSigner_JCalls), "LDKChannelSigner_JCalls");
1761         atomic_init(&calls->refcnt, 1);
1762         calls->instance_ptr = o;
1763
1764         LDKChannelPublicKeys pubkeys_conv;
1765         pubkeys_conv.inner = untag_ptr(pubkeys);
1766         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
1767         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
1768
1769         LDKChannelSigner ret = {
1770                 .this_arg = (void*) calls,
1771                 .get_per_commitment_point = get_per_commitment_point_LDKChannelSigner_jcall,
1772                 .release_commitment_secret = release_commitment_secret_LDKChannelSigner_jcall,
1773                 .validate_holder_commitment = validate_holder_commitment_LDKChannelSigner_jcall,
1774                 .validate_counterparty_revocation = validate_counterparty_revocation_LDKChannelSigner_jcall,
1775                 .channel_keys_id = channel_keys_id_LDKChannelSigner_jcall,
1776                 .provide_channel_parameters = provide_channel_parameters_LDKChannelSigner_jcall,
1777                 .free = LDKChannelSigner_JCalls_free,
1778                 .pubkeys = pubkeys_conv,
1779                 .set_pubkeys = NULL,
1780         };
1781         return ret;
1782 }
1783 uint64_t  __attribute__((export_name("TS_LDKChannelSigner_new"))) TS_LDKChannelSigner_new(JSValue o, uint64_t pubkeys) {
1784         LDKChannelSigner *res_ptr = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
1785         *res_ptr = LDKChannelSigner_init(o, pubkeys);
1786         return tag_ptr(res_ptr, true);
1787 }
1788 int8_tArray  __attribute__((export_name("TS_ChannelSigner_get_per_commitment_point"))) TS_ChannelSigner_get_per_commitment_point(uint64_t this_arg, int64_t idx) {
1789         void* this_arg_ptr = untag_ptr(this_arg);
1790         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1791         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1792         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
1793         memcpy(ret_arr->elems, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
1794         return ret_arr;
1795 }
1796
1797 int8_tArray  __attribute__((export_name("TS_ChannelSigner_release_commitment_secret"))) TS_ChannelSigner_release_commitment_secret(uint64_t this_arg, int64_t idx) {
1798         void* this_arg_ptr = untag_ptr(this_arg);
1799         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1800         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1801         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
1802         memcpy(ret_arr->elems, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
1803         return ret_arr;
1804 }
1805
1806 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) {
1807         void* this_arg_ptr = untag_ptr(this_arg);
1808         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1809         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1810         LDKHolderCommitmentTransaction holder_tx_conv;
1811         holder_tx_conv.inner = untag_ptr(holder_tx);
1812         holder_tx_conv.is_owned = ptr_is_owned(holder_tx);
1813         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
1814         holder_tx_conv.is_owned = false;
1815         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_constr;
1816         outbound_htlc_preimages_constr.datalen = outbound_htlc_preimages->arr_len;
1817         if (outbound_htlc_preimages_constr.datalen > 0)
1818                 outbound_htlc_preimages_constr.data = MALLOC(outbound_htlc_preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
1819         else
1820                 outbound_htlc_preimages_constr.data = NULL;
1821         int8_tArray* outbound_htlc_preimages_vals = (void*) outbound_htlc_preimages->elems;
1822         for (size_t m = 0; m < outbound_htlc_preimages_constr.datalen; m++) {
1823                 int8_tArray outbound_htlc_preimages_conv_12 = outbound_htlc_preimages_vals[m];
1824                 LDKThirtyTwoBytes outbound_htlc_preimages_conv_12_ref;
1825                 CHECK(outbound_htlc_preimages_conv_12->arr_len == 32);
1826                 memcpy(outbound_htlc_preimages_conv_12_ref.data, outbound_htlc_preimages_conv_12->elems, 32); FREE(outbound_htlc_preimages_conv_12);
1827                 outbound_htlc_preimages_constr.data[m] = outbound_htlc_preimages_conv_12_ref;
1828         }
1829         FREE(outbound_htlc_preimages);
1830         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
1831         *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, outbound_htlc_preimages_constr);
1832         return tag_ptr(ret_conv, true);
1833 }
1834
1835 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) {
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         uint8_t secret_arr[32];
1840         CHECK(secret->arr_len == 32);
1841         memcpy(secret_arr, secret->elems, 32); FREE(secret);
1842         uint8_t (*secret_ref)[32] = &secret_arr;
1843         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
1844         *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
1845         return tag_ptr(ret_conv, true);
1846 }
1847
1848 int8_tArray  __attribute__((export_name("TS_ChannelSigner_channel_keys_id"))) TS_ChannelSigner_channel_keys_id(uint64_t this_arg) {
1849         void* this_arg_ptr = untag_ptr(this_arg);
1850         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1851         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1852         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
1853         memcpy(ret_arr->elems, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
1854         return ret_arr;
1855 }
1856
1857 void  __attribute__((export_name("TS_ChannelSigner_provide_channel_parameters"))) TS_ChannelSigner_provide_channel_parameters(uint64_t this_arg, uint64_t channel_parameters) {
1858         void* this_arg_ptr = untag_ptr(this_arg);
1859         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1860         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1861         LDKChannelTransactionParameters channel_parameters_conv;
1862         channel_parameters_conv.inner = untag_ptr(channel_parameters);
1863         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
1864         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
1865         channel_parameters_conv.is_owned = false;
1866         (this_arg_conv->provide_channel_parameters)(this_arg_conv->this_arg, &channel_parameters_conv);
1867 }
1868
1869 LDKChannelPublicKeys LDKChannelSigner_set_get_pubkeys(LDKChannelSigner* this_arg) {
1870         if (this_arg->set_pubkeys != NULL)
1871                 this_arg->set_pubkeys(this_arg);
1872         return this_arg->pubkeys;
1873 }
1874 uint64_t  __attribute__((export_name("TS_ChannelSigner_get_pubkeys"))) TS_ChannelSigner_get_pubkeys(uint64_t this_arg) {
1875         void* this_arg_ptr = untag_ptr(this_arg);
1876         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1877         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1878         LDKChannelPublicKeys ret_var = LDKChannelSigner_set_get_pubkeys(this_arg_conv);
1879         uint64_t ret_ref = 0;
1880         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1881         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1882         return ret_ref;
1883 }
1884
1885 typedef struct LDKEcdsaChannelSigner_JCalls {
1886         atomic_size_t refcnt;
1887         uint32_t instance_ptr;
1888         LDKChannelSigner_JCalls* ChannelSigner;
1889 } LDKEcdsaChannelSigner_JCalls;
1890 static void LDKEcdsaChannelSigner_JCalls_free(void* this_arg) {
1891         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1892         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1893                 FREE(j_calls);
1894         }
1895 }
1896 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) {
1897         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1898         LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
1899         uint64_t commitment_tx_ref = 0;
1900         commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
1901         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
1902         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
1903         LDKCVec_ThirtyTwoBytesZ inbound_htlc_preimages_var = inbound_htlc_preimages;
1904         ptrArray inbound_htlc_preimages_arr = NULL;
1905         inbound_htlc_preimages_arr = init_ptrArray(inbound_htlc_preimages_var.datalen, __LINE__);
1906         int8_tArray *inbound_htlc_preimages_arr_ptr = (int8_tArray*)(((uint8_t*)inbound_htlc_preimages_arr) + 8);
1907         for (size_t m = 0; m < inbound_htlc_preimages_var.datalen; m++) {
1908                 int8_tArray inbound_htlc_preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
1909                 memcpy(inbound_htlc_preimages_conv_12_arr->elems, inbound_htlc_preimages_var.data[m].data, 32);
1910                 inbound_htlc_preimages_arr_ptr[m] = inbound_htlc_preimages_conv_12_arr;
1911         }
1912         
1913         FREE(inbound_htlc_preimages_var.data);
1914         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_var = outbound_htlc_preimages;
1915         ptrArray outbound_htlc_preimages_arr = NULL;
1916         outbound_htlc_preimages_arr = init_ptrArray(outbound_htlc_preimages_var.datalen, __LINE__);
1917         int8_tArray *outbound_htlc_preimages_arr_ptr = (int8_tArray*)(((uint8_t*)outbound_htlc_preimages_arr) + 8);
1918         for (size_t m = 0; m < outbound_htlc_preimages_var.datalen; m++) {
1919                 int8_tArray outbound_htlc_preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
1920                 memcpy(outbound_htlc_preimages_conv_12_arr->elems, outbound_htlc_preimages_var.data[m].data, 32);
1921                 outbound_htlc_preimages_arr_ptr[m] = outbound_htlc_preimages_conv_12_arr;
1922         }
1923         
1924         FREE(outbound_htlc_preimages_var.data);
1925         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);
1926         void* ret_ptr = untag_ptr(ret);
1927         CHECK_ACCESS(ret_ptr);
1928         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)(ret_ptr);
1929         FREE(untag_ptr(ret));
1930         return ret_conv;
1931 }
1932 LDKCResult_ECDSASignatureNoneZ sign_holder_commitment_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
1933         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1934         LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
1935         uint64_t commitment_tx_ref = 0;
1936         commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
1937         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
1938         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
1939         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 7, commitment_tx_ref, 0, 0, 0, 0, 0);
1940         void* ret_ptr = untag_ptr(ret);
1941         CHECK_ACCESS(ret_ptr);
1942         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1943         FREE(untag_ptr(ret));
1944         return ret_conv;
1945 }
1946 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]) {
1947         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1948         LDKTransaction justice_tx_var = justice_tx;
1949         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
1950         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
1951         Transaction_free(justice_tx_var);
1952         uint32_t input_conv = input;
1953         int64_t amount_conv = amount;
1954         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
1955         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
1956         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);
1957         void* ret_ptr = untag_ptr(ret);
1958         CHECK_ACCESS(ret_ptr);
1959         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1960         FREE(untag_ptr(ret));
1961         return ret_conv;
1962 }
1963 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) {
1964         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1965         LDKTransaction justice_tx_var = justice_tx;
1966         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
1967         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
1968         Transaction_free(justice_tx_var);
1969         uint32_t input_conv = input;
1970         int64_t amount_conv = amount;
1971         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
1972         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
1973         LDKHTLCOutputInCommitment htlc_var = *htlc;
1974         uint64_t htlc_ref = 0;
1975         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
1976         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
1977         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
1978         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);
1979         void* ret_ptr = untag_ptr(ret);
1980         CHECK_ACCESS(ret_ptr);
1981         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1982         FREE(untag_ptr(ret));
1983         return ret_conv;
1984 }
1985 LDKCResult_ECDSASignatureNoneZ sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, const LDKHTLCDescriptor * htlc_descriptor) {
1986         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1987         LDKTransaction htlc_tx_var = htlc_tx;
1988         int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen, __LINE__);
1989         memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen);
1990         Transaction_free(htlc_tx_var);
1991         uint32_t input_conv = input;
1992         LDKHTLCDescriptor htlc_descriptor_var = *htlc_descriptor;
1993         uint64_t htlc_descriptor_ref = 0;
1994         htlc_descriptor_var = HTLCDescriptor_clone(&htlc_descriptor_var);
1995         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptor_var);
1996         htlc_descriptor_ref = tag_ptr(htlc_descriptor_var.inner, htlc_descriptor_var.is_owned);
1997         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);
1998         void* ret_ptr = untag_ptr(ret);
1999         CHECK_ACCESS(ret_ptr);
2000         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
2001         FREE(untag_ptr(ret));
2002         return ret_conv;
2003 }
2004 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) {
2005         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2006         LDKTransaction htlc_tx_var = htlc_tx;
2007         int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen, __LINE__);
2008         memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen);
2009         Transaction_free(htlc_tx_var);
2010         uint32_t input_conv = input;
2011         int64_t amount_conv = amount;
2012         int8_tArray per_commitment_point_arr = init_int8_tArray(33, __LINE__);
2013         memcpy(per_commitment_point_arr->elems, per_commitment_point.compressed_form, 33);
2014         LDKHTLCOutputInCommitment htlc_var = *htlc;
2015         uint64_t htlc_ref = 0;
2016         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
2017         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
2018         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
2019         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);
2020         void* ret_ptr = untag_ptr(ret);
2021         CHECK_ACCESS(ret_ptr);
2022         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
2023         FREE(untag_ptr(ret));
2024         return ret_conv;
2025 }
2026 LDKCResult_ECDSASignatureNoneZ sign_closing_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
2027         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2028         LDKClosingTransaction closing_tx_var = *closing_tx;
2029         uint64_t closing_tx_ref = 0;
2030         closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
2031         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
2032         closing_tx_ref = tag_ptr(closing_tx_var.inner, closing_tx_var.is_owned);
2033         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 12, closing_tx_ref, 0, 0, 0, 0, 0);
2034         void* ret_ptr = untag_ptr(ret);
2035         CHECK_ACCESS(ret_ptr);
2036         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
2037         FREE(untag_ptr(ret));
2038         return ret_conv;
2039 }
2040 LDKCResult_ECDSASignatureNoneZ sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction anchor_tx, uintptr_t input) {
2041         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2042         LDKTransaction anchor_tx_var = anchor_tx;
2043         int8_tArray anchor_tx_arr = init_int8_tArray(anchor_tx_var.datalen, __LINE__);
2044         memcpy(anchor_tx_arr->elems, anchor_tx_var.data, anchor_tx_var.datalen);
2045         Transaction_free(anchor_tx_var);
2046         uint32_t input_conv = input;
2047         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 13, (uint32_t)anchor_tx_arr, input_conv, 0, 0, 0, 0);
2048         void* ret_ptr = untag_ptr(ret);
2049         CHECK_ACCESS(ret_ptr);
2050         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
2051         FREE(untag_ptr(ret));
2052         return ret_conv;
2053 }
2054 LDKCResult_ECDSASignatureNoneZ sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
2055         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2056         LDKUnsignedChannelAnnouncement msg_var = *msg;
2057         uint64_t msg_ref = 0;
2058         msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
2059         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2060         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
2061         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 14, msg_ref, 0, 0, 0, 0, 0);
2062         void* ret_ptr = untag_ptr(ret);
2063         CHECK_ACCESS(ret_ptr);
2064         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
2065         FREE(untag_ptr(ret));
2066         return ret_conv;
2067 }
2068 static void LDKEcdsaChannelSigner_JCalls_cloned(LDKEcdsaChannelSigner* new_obj) {
2069         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) new_obj->this_arg;
2070         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2071         atomic_fetch_add_explicit(&j_calls->ChannelSigner->refcnt, 1, memory_order_release);
2072 }
2073 static inline LDKEcdsaChannelSigner LDKEcdsaChannelSigner_init (JSValue o, JSValue ChannelSigner, uint64_t pubkeys) {
2074         LDKEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKEcdsaChannelSigner_JCalls), "LDKEcdsaChannelSigner_JCalls");
2075         atomic_init(&calls->refcnt, 1);
2076         calls->instance_ptr = o;
2077
2078         LDKChannelPublicKeys pubkeys_conv;
2079         pubkeys_conv.inner = untag_ptr(pubkeys);
2080         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
2081         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
2082
2083         LDKEcdsaChannelSigner ret = {
2084                 .this_arg = (void*) calls,
2085                 .sign_counterparty_commitment = sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall,
2086                 .sign_holder_commitment = sign_holder_commitment_LDKEcdsaChannelSigner_jcall,
2087                 .sign_justice_revoked_output = sign_justice_revoked_output_LDKEcdsaChannelSigner_jcall,
2088                 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKEcdsaChannelSigner_jcall,
2089                 .sign_holder_htlc_transaction = sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall,
2090                 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKEcdsaChannelSigner_jcall,
2091                 .sign_closing_transaction = sign_closing_transaction_LDKEcdsaChannelSigner_jcall,
2092                 .sign_holder_anchor_input = sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall,
2093                 .sign_channel_announcement_with_funding_key = sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall,
2094                 .free = LDKEcdsaChannelSigner_JCalls_free,
2095                 .ChannelSigner = LDKChannelSigner_init(ChannelSigner, pubkeys),
2096         };
2097         calls->ChannelSigner = ret.ChannelSigner.this_arg;
2098         return ret;
2099 }
2100 uint64_t  __attribute__((export_name("TS_LDKEcdsaChannelSigner_new"))) TS_LDKEcdsaChannelSigner_new(JSValue o, JSValue ChannelSigner, uint64_t pubkeys) {
2101         LDKEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
2102         *res_ptr = LDKEcdsaChannelSigner_init(o, ChannelSigner, pubkeys);
2103         return tag_ptr(res_ptr, true);
2104 }
2105 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) {
2106         void* this_arg_ptr = untag_ptr(this_arg);
2107         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2108         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2109         LDKCommitmentTransaction commitment_tx_conv;
2110         commitment_tx_conv.inner = untag_ptr(commitment_tx);
2111         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
2112         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
2113         commitment_tx_conv.is_owned = false;
2114         LDKCVec_ThirtyTwoBytesZ inbound_htlc_preimages_constr;
2115         inbound_htlc_preimages_constr.datalen = inbound_htlc_preimages->arr_len;
2116         if (inbound_htlc_preimages_constr.datalen > 0)
2117                 inbound_htlc_preimages_constr.data = MALLOC(inbound_htlc_preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
2118         else
2119                 inbound_htlc_preimages_constr.data = NULL;
2120         int8_tArray* inbound_htlc_preimages_vals = (void*) inbound_htlc_preimages->elems;
2121         for (size_t m = 0; m < inbound_htlc_preimages_constr.datalen; m++) {
2122                 int8_tArray inbound_htlc_preimages_conv_12 = inbound_htlc_preimages_vals[m];
2123                 LDKThirtyTwoBytes inbound_htlc_preimages_conv_12_ref;
2124                 CHECK(inbound_htlc_preimages_conv_12->arr_len == 32);
2125                 memcpy(inbound_htlc_preimages_conv_12_ref.data, inbound_htlc_preimages_conv_12->elems, 32); FREE(inbound_htlc_preimages_conv_12);
2126                 inbound_htlc_preimages_constr.data[m] = inbound_htlc_preimages_conv_12_ref;
2127         }
2128         FREE(inbound_htlc_preimages);
2129         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_constr;
2130         outbound_htlc_preimages_constr.datalen = outbound_htlc_preimages->arr_len;
2131         if (outbound_htlc_preimages_constr.datalen > 0)
2132                 outbound_htlc_preimages_constr.data = MALLOC(outbound_htlc_preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
2133         else
2134                 outbound_htlc_preimages_constr.data = NULL;
2135         int8_tArray* outbound_htlc_preimages_vals = (void*) outbound_htlc_preimages->elems;
2136         for (size_t m = 0; m < outbound_htlc_preimages_constr.datalen; m++) {
2137                 int8_tArray outbound_htlc_preimages_conv_12 = outbound_htlc_preimages_vals[m];
2138                 LDKThirtyTwoBytes outbound_htlc_preimages_conv_12_ref;
2139                 CHECK(outbound_htlc_preimages_conv_12->arr_len == 32);
2140                 memcpy(outbound_htlc_preimages_conv_12_ref.data, outbound_htlc_preimages_conv_12->elems, 32); FREE(outbound_htlc_preimages_conv_12);
2141                 outbound_htlc_preimages_constr.data[m] = outbound_htlc_preimages_conv_12_ref;
2142         }
2143         FREE(outbound_htlc_preimages);
2144         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
2145         *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, inbound_htlc_preimages_constr, outbound_htlc_preimages_constr);
2146         return tag_ptr(ret_conv, true);
2147 }
2148
2149 uint64_t  __attribute__((export_name("TS_EcdsaChannelSigner_sign_holder_commitment"))) TS_EcdsaChannelSigner_sign_holder_commitment(uint64_t this_arg, uint64_t commitment_tx) {
2150         void* this_arg_ptr = untag_ptr(this_arg);
2151         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2152         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2153         LDKHolderCommitmentTransaction commitment_tx_conv;
2154         commitment_tx_conv.inner = untag_ptr(commitment_tx);
2155         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
2156         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
2157         commitment_tx_conv.is_owned = false;
2158         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2159         *ret_conv = (this_arg_conv->sign_holder_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
2160         return tag_ptr(ret_conv, true);
2161 }
2162
2163 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) {
2164         void* this_arg_ptr = untag_ptr(this_arg);
2165         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2166         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2167         LDKTransaction justice_tx_ref;
2168         justice_tx_ref.datalen = justice_tx->arr_len;
2169         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2170         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
2171         justice_tx_ref.data_is_owned = true;
2172         uint8_t per_commitment_key_arr[32];
2173         CHECK(per_commitment_key->arr_len == 32);
2174         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
2175         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2176         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2177         *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
2178         return tag_ptr(ret_conv, true);
2179 }
2180
2181 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) {
2182         void* this_arg_ptr = untag_ptr(this_arg);
2183         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2184         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2185         LDKTransaction justice_tx_ref;
2186         justice_tx_ref.datalen = justice_tx->arr_len;
2187         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2188         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
2189         justice_tx_ref.data_is_owned = true;
2190         uint8_t per_commitment_key_arr[32];
2191         CHECK(per_commitment_key->arr_len == 32);
2192         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
2193         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2194         LDKHTLCOutputInCommitment htlc_conv;
2195         htlc_conv.inner = untag_ptr(htlc);
2196         htlc_conv.is_owned = ptr_is_owned(htlc);
2197         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
2198         htlc_conv.is_owned = false;
2199         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2200         *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);
2201         return tag_ptr(ret_conv, true);
2202 }
2203
2204 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) {
2205         void* this_arg_ptr = untag_ptr(this_arg);
2206         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2207         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2208         LDKTransaction htlc_tx_ref;
2209         htlc_tx_ref.datalen = htlc_tx->arr_len;
2210         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2211         memcpy(htlc_tx_ref.data, htlc_tx->elems, htlc_tx_ref.datalen); FREE(htlc_tx);
2212         htlc_tx_ref.data_is_owned = true;
2213         LDKHTLCDescriptor htlc_descriptor_conv;
2214         htlc_descriptor_conv.inner = untag_ptr(htlc_descriptor);
2215         htlc_descriptor_conv.is_owned = ptr_is_owned(htlc_descriptor);
2216         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptor_conv);
2217         htlc_descriptor_conv.is_owned = false;
2218         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2219         *ret_conv = (this_arg_conv->sign_holder_htlc_transaction)(this_arg_conv->this_arg, htlc_tx_ref, input, &htlc_descriptor_conv);
2220         return tag_ptr(ret_conv, true);
2221 }
2222
2223 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) {
2224         void* this_arg_ptr = untag_ptr(this_arg);
2225         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2226         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2227         LDKTransaction htlc_tx_ref;
2228         htlc_tx_ref.datalen = htlc_tx->arr_len;
2229         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2230         memcpy(htlc_tx_ref.data, htlc_tx->elems, htlc_tx_ref.datalen); FREE(htlc_tx);
2231         htlc_tx_ref.data_is_owned = true;
2232         LDKPublicKey per_commitment_point_ref;
2233         CHECK(per_commitment_point->arr_len == 33);
2234         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
2235         LDKHTLCOutputInCommitment htlc_conv;
2236         htlc_conv.inner = untag_ptr(htlc);
2237         htlc_conv.is_owned = ptr_is_owned(htlc);
2238         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
2239         htlc_conv.is_owned = false;
2240         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2241         *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);
2242         return tag_ptr(ret_conv, true);
2243 }
2244
2245 uint64_t  __attribute__((export_name("TS_EcdsaChannelSigner_sign_closing_transaction"))) TS_EcdsaChannelSigner_sign_closing_transaction(uint64_t this_arg, uint64_t closing_tx) {
2246         void* this_arg_ptr = untag_ptr(this_arg);
2247         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2248         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2249         LDKClosingTransaction closing_tx_conv;
2250         closing_tx_conv.inner = untag_ptr(closing_tx);
2251         closing_tx_conv.is_owned = ptr_is_owned(closing_tx);
2252         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
2253         closing_tx_conv.is_owned = false;
2254         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2255         *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
2256         return tag_ptr(ret_conv, true);
2257 }
2258
2259 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) {
2260         void* this_arg_ptr = untag_ptr(this_arg);
2261         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2262         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2263         LDKTransaction anchor_tx_ref;
2264         anchor_tx_ref.datalen = anchor_tx->arr_len;
2265         anchor_tx_ref.data = MALLOC(anchor_tx_ref.datalen, "LDKTransaction Bytes");
2266         memcpy(anchor_tx_ref.data, anchor_tx->elems, anchor_tx_ref.datalen); FREE(anchor_tx);
2267         anchor_tx_ref.data_is_owned = true;
2268         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2269         *ret_conv = (this_arg_conv->sign_holder_anchor_input)(this_arg_conv->this_arg, anchor_tx_ref, input);
2270         return tag_ptr(ret_conv, true);
2271 }
2272
2273 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) {
2274         void* this_arg_ptr = untag_ptr(this_arg);
2275         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2276         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2277         LDKUnsignedChannelAnnouncement msg_conv;
2278         msg_conv.inner = untag_ptr(msg);
2279         msg_conv.is_owned = ptr_is_owned(msg);
2280         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
2281         msg_conv.is_owned = false;
2282         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2283         *ret_conv = (this_arg_conv->sign_channel_announcement_with_funding_key)(this_arg_conv->this_arg, &msg_conv);
2284         return tag_ptr(ret_conv, true);
2285 }
2286
2287 typedef struct LDKWriteableEcdsaChannelSigner_JCalls {
2288         atomic_size_t refcnt;
2289         uint32_t instance_ptr;
2290         LDKEcdsaChannelSigner_JCalls* EcdsaChannelSigner;
2291         LDKChannelSigner_JCalls* ChannelSigner;
2292 } LDKWriteableEcdsaChannelSigner_JCalls;
2293 static void LDKWriteableEcdsaChannelSigner_JCalls_free(void* this_arg) {
2294         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
2295         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2296                 FREE(j_calls);
2297         }
2298 }
2299 LDKCVec_u8Z write_LDKWriteableEcdsaChannelSigner_jcall(const void* this_arg) {
2300         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
2301         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 15, 0, 0, 0, 0, 0, 0);
2302         LDKCVec_u8Z ret_ref;
2303         ret_ref.datalen = ret->arr_len;
2304         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2305         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
2306         return ret_ref;
2307 }
2308 static void LDKWriteableEcdsaChannelSigner_JCalls_cloned(LDKWriteableEcdsaChannelSigner* new_obj) {
2309         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) new_obj->this_arg;
2310         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2311         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->refcnt, 1, memory_order_release);
2312         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->ChannelSigner->refcnt, 1, memory_order_release);
2313 }
2314 static inline LDKWriteableEcdsaChannelSigner LDKWriteableEcdsaChannelSigner_init (JSValue o, JSValue EcdsaChannelSigner, JSValue ChannelSigner, uint64_t pubkeys) {
2315         LDKWriteableEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner_JCalls), "LDKWriteableEcdsaChannelSigner_JCalls");
2316         atomic_init(&calls->refcnt, 1);
2317         calls->instance_ptr = o;
2318
2319         LDKChannelPublicKeys pubkeys_conv;
2320         pubkeys_conv.inner = untag_ptr(pubkeys);
2321         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
2322         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
2323
2324         LDKWriteableEcdsaChannelSigner ret = {
2325                 .this_arg = (void*) calls,
2326                 .write = write_LDKWriteableEcdsaChannelSigner_jcall,
2327                 .cloned = LDKWriteableEcdsaChannelSigner_JCalls_cloned,
2328                 .free = LDKWriteableEcdsaChannelSigner_JCalls_free,
2329                 .EcdsaChannelSigner = LDKEcdsaChannelSigner_init(EcdsaChannelSigner, ChannelSigner, pubkeys),
2330         };
2331         calls->EcdsaChannelSigner = ret.EcdsaChannelSigner.this_arg;
2332         calls->ChannelSigner = ret.EcdsaChannelSigner.ChannelSigner.this_arg;
2333         return ret;
2334 }
2335 uint64_t  __attribute__((export_name("TS_LDKWriteableEcdsaChannelSigner_new"))) TS_LDKWriteableEcdsaChannelSigner_new(JSValue o, JSValue EcdsaChannelSigner, JSValue ChannelSigner, uint64_t pubkeys) {
2336         LDKWriteableEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
2337         *res_ptr = LDKWriteableEcdsaChannelSigner_init(o, EcdsaChannelSigner, ChannelSigner, pubkeys);
2338         return tag_ptr(res_ptr, true);
2339 }
2340 int8_tArray  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_write"))) TS_WriteableEcdsaChannelSigner_write(uint64_t this_arg) {
2341         void* this_arg_ptr = untag_ptr(this_arg);
2342         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2343         LDKWriteableEcdsaChannelSigner* this_arg_conv = (LDKWriteableEcdsaChannelSigner*)this_arg_ptr;
2344         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2345         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2346         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2347         CVec_u8Z_free(ret_var);
2348         return ret_arr;
2349 }
2350
2351 static inline struct LDKWriteableEcdsaChannelSigner CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
2352 CHECK(owner->result_ok);
2353         return WriteableEcdsaChannelSigner_clone(&*owner->contents.result);
2354 }
2355 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(uint64_t owner) {
2356         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
2357         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
2358         *ret_ret = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(owner_conv);
2359         return tag_ptr(ret_ret, true);
2360 }
2361
2362 static inline struct LDKDecodeError CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
2363 CHECK(!owner->result_ok);
2364         return DecodeError_clone(&*owner->contents.err);
2365 }
2366 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(uint64_t owner) {
2367         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
2368         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2369         *ret_copy = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(owner_conv);
2370         uint64_t ret_ref = tag_ptr(ret_copy, true);
2371         return ret_ref;
2372 }
2373
2374 static inline struct LDKCVec_u8Z CResult_CVec_u8ZNoneZ_get_ok(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR owner){
2375 CHECK(owner->result_ok);
2376         return CVec_u8Z_clone(&*owner->contents.result);
2377 }
2378 int8_tArray  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_get_ok"))) TS_CResult_CVec_u8ZNoneZ_get_ok(uint64_t owner) {
2379         LDKCResult_CVec_u8ZNoneZ* owner_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(owner);
2380         LDKCVec_u8Z ret_var = CResult_CVec_u8ZNoneZ_get_ok(owner_conv);
2381         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2382         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2383         CVec_u8Z_free(ret_var);
2384         return ret_arr;
2385 }
2386
2387 static inline void CResult_CVec_u8ZNoneZ_get_err(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR owner){
2388 CHECK(!owner->result_ok);
2389         return *owner->contents.err;
2390 }
2391 void  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_get_err"))) TS_CResult_CVec_u8ZNoneZ_get_err(uint64_t owner) {
2392         LDKCResult_CVec_u8ZNoneZ* owner_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(owner);
2393         CResult_CVec_u8ZNoneZ_get_err(owner_conv);
2394 }
2395
2396 static inline struct LDKShutdownScript CResult_ShutdownScriptNoneZ_get_ok(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR owner){
2397         LDKShutdownScript ret = *owner->contents.result;
2398         ret.is_owned = false;
2399         return ret;
2400 }
2401 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_get_ok"))) TS_CResult_ShutdownScriptNoneZ_get_ok(uint64_t owner) {
2402         LDKCResult_ShutdownScriptNoneZ* owner_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(owner);
2403         LDKShutdownScript ret_var = CResult_ShutdownScriptNoneZ_get_ok(owner_conv);
2404         uint64_t ret_ref = 0;
2405         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2406         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2407         return ret_ref;
2408 }
2409
2410 static inline void CResult_ShutdownScriptNoneZ_get_err(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR owner){
2411 CHECK(!owner->result_ok);
2412         return *owner->contents.err;
2413 }
2414 void  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_get_err"))) TS_CResult_ShutdownScriptNoneZ_get_err(uint64_t owner) {
2415         LDKCResult_ShutdownScriptNoneZ* owner_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(owner);
2416         CResult_ShutdownScriptNoneZ_get_err(owner_conv);
2417 }
2418
2419 uint32_t __attribute__((export_name("TS_LDKCOption_u16Z_ty_from_ptr"))) TS_LDKCOption_u16Z_ty_from_ptr(uint64_t ptr) {
2420         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
2421         switch(obj->tag) {
2422                 case LDKCOption_u16Z_Some: return 0;
2423                 case LDKCOption_u16Z_None: return 1;
2424                 default: abort();
2425         }
2426 }
2427 int16_t __attribute__((export_name("TS_LDKCOption_u16Z_Some_get_some"))) TS_LDKCOption_u16Z_Some_get_some(uint64_t ptr) {
2428         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
2429         assert(obj->tag == LDKCOption_u16Z_Some);
2430         int16_t some_conv = obj->some;
2431         return some_conv;
2432 }
2433 uint32_t __attribute__((export_name("TS_LDKCOption_boolZ_ty_from_ptr"))) TS_LDKCOption_boolZ_ty_from_ptr(uint64_t ptr) {
2434         LDKCOption_boolZ *obj = (LDKCOption_boolZ*)untag_ptr(ptr);
2435         switch(obj->tag) {
2436                 case LDKCOption_boolZ_Some: return 0;
2437                 case LDKCOption_boolZ_None: return 1;
2438                 default: abort();
2439         }
2440 }
2441 jboolean __attribute__((export_name("TS_LDKCOption_boolZ_Some_get_some"))) TS_LDKCOption_boolZ_Some_get_some(uint64_t ptr) {
2442         LDKCOption_boolZ *obj = (LDKCOption_boolZ*)untag_ptr(ptr);
2443         assert(obj->tag == LDKCOption_boolZ_Some);
2444         jboolean some_conv = obj->some;
2445         return some_conv;
2446 }
2447 static inline struct LDKWitness CResult_WitnessNoneZ_get_ok(LDKCResult_WitnessNoneZ *NONNULL_PTR owner){
2448 CHECK(owner->result_ok);
2449         return Witness_clone(&*owner->contents.result);
2450 }
2451 int8_tArray  __attribute__((export_name("TS_CResult_WitnessNoneZ_get_ok"))) TS_CResult_WitnessNoneZ_get_ok(uint64_t owner) {
2452         LDKCResult_WitnessNoneZ* owner_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(owner);
2453         LDKWitness ret_var = CResult_WitnessNoneZ_get_ok(owner_conv);
2454         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2455         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2456         Witness_free(ret_var);
2457         return ret_arr;
2458 }
2459
2460 static inline void CResult_WitnessNoneZ_get_err(LDKCResult_WitnessNoneZ *NONNULL_PTR owner){
2461 CHECK(!owner->result_ok);
2462         return *owner->contents.err;
2463 }
2464 void  __attribute__((export_name("TS_CResult_WitnessNoneZ_get_err"))) TS_CResult_WitnessNoneZ_get_err(uint64_t owner) {
2465         LDKCResult_WitnessNoneZ* owner_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(owner);
2466         CResult_WitnessNoneZ_get_err(owner_conv);
2467 }
2468
2469 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
2470         LDKInMemorySigner ret = *owner->contents.result;
2471         ret.is_owned = false;
2472         return ret;
2473 }
2474 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_get_ok(uint64_t owner) {
2475         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
2476         LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
2477         uint64_t ret_ref = 0;
2478         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2479         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2480         return ret_ref;
2481 }
2482
2483 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
2484 CHECK(!owner->result_ok);
2485         return DecodeError_clone(&*owner->contents.err);
2486 }
2487 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_err"))) TS_CResult_InMemorySignerDecodeErrorZ_get_err(uint64_t owner) {
2488         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
2489         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2490         *ret_copy = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
2491         uint64_t ret_ref = tag_ptr(ret_copy, true);
2492         return ret_ref;
2493 }
2494
2495 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
2496         LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
2497         for (size_t i = 0; i < ret.datalen; i++) {
2498                 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
2499         }
2500         return ret;
2501 }
2502 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
2503         LDKRoute ret = *owner->contents.result;
2504         ret.is_owned = false;
2505         return ret;
2506 }
2507 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_ok"))) TS_CResult_RouteLightningErrorZ_get_ok(uint64_t owner) {
2508         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
2509         LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
2510         uint64_t ret_ref = 0;
2511         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2512         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2513         return ret_ref;
2514 }
2515
2516 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
2517         LDKLightningError ret = *owner->contents.err;
2518         ret.is_owned = false;
2519         return ret;
2520 }
2521 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_err"))) TS_CResult_RouteLightningErrorZ_get_err(uint64_t owner) {
2522         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
2523         LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
2524         uint64_t ret_ref = 0;
2525         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2526         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2527         return ret_ref;
2528 }
2529
2530 static inline struct LDKBlindedPayInfo C2Tuple_BlindedPayInfoBlindedPathZ_get_a(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
2531         LDKBlindedPayInfo ret = owner->a;
2532         ret.is_owned = false;
2533         return ret;
2534 }
2535 uint64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_get_a"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_get_a(uint64_t owner) {
2536         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
2537         LDKBlindedPayInfo ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_a(owner_conv);
2538         uint64_t ret_ref = 0;
2539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2540         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2541         return ret_ref;
2542 }
2543
2544 static inline struct LDKBlindedPath C2Tuple_BlindedPayInfoBlindedPathZ_get_b(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
2545         LDKBlindedPath ret = owner->b;
2546         ret.is_owned = false;
2547         return ret;
2548 }
2549 uint64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_get_b"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_get_b(uint64_t owner) {
2550         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
2551         LDKBlindedPath ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_b(owner_conv);
2552         uint64_t ret_ref = 0;
2553         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2554         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2555         return ret_ref;
2556 }
2557
2558 static inline LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_clone(const LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ *orig) {
2559         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ) * orig->datalen, "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ clone bytes"), .datalen = orig->datalen };
2560         for (size_t i = 0; i < ret.datalen; i++) {
2561                 ret.data[i] = C2Tuple_BlindedPayInfoBlindedPathZ_clone(&orig->data[i]);
2562         }
2563         return ret;
2564 }
2565 static inline struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_ok(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ *NONNULL_PTR owner){
2566 CHECK(owner->result_ok);
2567         return CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_clone(&*owner->contents.result);
2568 }
2569 uint64_tArray  __attribute__((export_name("TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_ok"))) TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_ok(uint64_t owner) {
2570         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(owner);
2571         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ ret_var = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_ok(owner_conv);
2572         uint64_tArray ret_arr = NULL;
2573         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
2574         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
2575         for (size_t l = 0; l < ret_var.datalen; l++) {
2576                 LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv_37_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
2577                 *ret_conv_37_conv = ret_var.data[l];
2578                 ret_arr_ptr[l] = tag_ptr(ret_conv_37_conv, true);
2579         }
2580         
2581         FREE(ret_var.data);
2582         return ret_arr;
2583 }
2584
2585 static inline void CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_err(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ *NONNULL_PTR owner){
2586 CHECK(!owner->result_ok);
2587         return *owner->contents.err;
2588 }
2589 void  __attribute__((export_name("TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_err"))) TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_err(uint64_t owner) {
2590         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(owner);
2591         CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_err(owner_conv);
2592 }
2593
2594 static inline struct LDKOnionMessagePath CResult_OnionMessagePathNoneZ_get_ok(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR owner){
2595         LDKOnionMessagePath ret = *owner->contents.result;
2596         ret.is_owned = false;
2597         return ret;
2598 }
2599 uint64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_get_ok"))) TS_CResult_OnionMessagePathNoneZ_get_ok(uint64_t owner) {
2600         LDKCResult_OnionMessagePathNoneZ* owner_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(owner);
2601         LDKOnionMessagePath ret_var = CResult_OnionMessagePathNoneZ_get_ok(owner_conv);
2602         uint64_t ret_ref = 0;
2603         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2604         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2605         return ret_ref;
2606 }
2607
2608 static inline void CResult_OnionMessagePathNoneZ_get_err(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR owner){
2609 CHECK(!owner->result_ok);
2610         return *owner->contents.err;
2611 }
2612 void  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_get_err"))) TS_CResult_OnionMessagePathNoneZ_get_err(uint64_t owner) {
2613         LDKCResult_OnionMessagePathNoneZ* owner_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(owner);
2614         CResult_OnionMessagePathNoneZ_get_err(owner_conv);
2615 }
2616
2617 static inline struct LDKCVec_BlindedPathZ CResult_CVec_BlindedPathZNoneZ_get_ok(LDKCResult_CVec_BlindedPathZNoneZ *NONNULL_PTR owner){
2618 CHECK(owner->result_ok);
2619         return CVec_BlindedPathZ_clone(&*owner->contents.result);
2620 }
2621 uint64_tArray  __attribute__((export_name("TS_CResult_CVec_BlindedPathZNoneZ_get_ok"))) TS_CResult_CVec_BlindedPathZNoneZ_get_ok(uint64_t owner) {
2622         LDKCResult_CVec_BlindedPathZNoneZ* owner_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(owner);
2623         LDKCVec_BlindedPathZ ret_var = CResult_CVec_BlindedPathZNoneZ_get_ok(owner_conv);
2624         uint64_tArray ret_arr = NULL;
2625         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
2626         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
2627         for (size_t n = 0; n < ret_var.datalen; n++) {
2628                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
2629                 uint64_t ret_conv_13_ref = 0;
2630                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
2631                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
2632                 ret_arr_ptr[n] = ret_conv_13_ref;
2633         }
2634         
2635         FREE(ret_var.data);
2636         return ret_arr;
2637 }
2638
2639 static inline void CResult_CVec_BlindedPathZNoneZ_get_err(LDKCResult_CVec_BlindedPathZNoneZ *NONNULL_PTR owner){
2640 CHECK(!owner->result_ok);
2641         return *owner->contents.err;
2642 }
2643 void  __attribute__((export_name("TS_CResult_CVec_BlindedPathZNoneZ_get_err"))) TS_CResult_CVec_BlindedPathZNoneZ_get_err(uint64_t owner) {
2644         LDKCResult_CVec_BlindedPathZNoneZ* owner_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(owner);
2645         CResult_CVec_BlindedPathZNoneZ_get_err(owner_conv);
2646 }
2647
2648 static inline struct LDKInFlightHtlcs CResult_InFlightHtlcsDecodeErrorZ_get_ok(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
2649         LDKInFlightHtlcs ret = *owner->contents.result;
2650         ret.is_owned = false;
2651         return ret;
2652 }
2653 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_get_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_get_ok(uint64_t owner) {
2654         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
2655         LDKInFlightHtlcs ret_var = CResult_InFlightHtlcsDecodeErrorZ_get_ok(owner_conv);
2656         uint64_t ret_ref = 0;
2657         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2658         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2659         return ret_ref;
2660 }
2661
2662 static inline struct LDKDecodeError CResult_InFlightHtlcsDecodeErrorZ_get_err(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
2663 CHECK(!owner->result_ok);
2664         return DecodeError_clone(&*owner->contents.err);
2665 }
2666 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_get_err"))) TS_CResult_InFlightHtlcsDecodeErrorZ_get_err(uint64_t owner) {
2667         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
2668         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2669         *ret_copy = CResult_InFlightHtlcsDecodeErrorZ_get_err(owner_conv);
2670         uint64_t ret_ref = tag_ptr(ret_copy, true);
2671         return ret_ref;
2672 }
2673
2674 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
2675         LDKRouteHop ret = *owner->contents.result;
2676         ret.is_owned = false;
2677         return ret;
2678 }
2679 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHopDecodeErrorZ_get_ok(uint64_t owner) {
2680         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
2681         LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
2682         uint64_t ret_ref = 0;
2683         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2684         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2685         return ret_ref;
2686 }
2687
2688 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
2689 CHECK(!owner->result_ok);
2690         return DecodeError_clone(&*owner->contents.err);
2691 }
2692 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_err"))) TS_CResult_RouteHopDecodeErrorZ_get_err(uint64_t owner) {
2693         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
2694         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2695         *ret_copy = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
2696         uint64_t ret_ref = tag_ptr(ret_copy, true);
2697         return ret_ref;
2698 }
2699
2700 static inline LDKCVec_BlindedHopZ CVec_BlindedHopZ_clone(const LDKCVec_BlindedHopZ *orig) {
2701         LDKCVec_BlindedHopZ ret = { .data = MALLOC(sizeof(LDKBlindedHop) * orig->datalen, "LDKCVec_BlindedHopZ clone bytes"), .datalen = orig->datalen };
2702         for (size_t i = 0; i < ret.datalen; i++) {
2703                 ret.data[i] = BlindedHop_clone(&orig->data[i]);
2704         }
2705         return ret;
2706 }
2707 static inline struct LDKBlindedTail CResult_BlindedTailDecodeErrorZ_get_ok(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
2708         LDKBlindedTail ret = *owner->contents.result;
2709         ret.is_owned = false;
2710         return ret;
2711 }
2712 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_get_ok"))) TS_CResult_BlindedTailDecodeErrorZ_get_ok(uint64_t owner) {
2713         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
2714         LDKBlindedTail ret_var = CResult_BlindedTailDecodeErrorZ_get_ok(owner_conv);
2715         uint64_t ret_ref = 0;
2716         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2717         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2718         return ret_ref;
2719 }
2720
2721 static inline struct LDKDecodeError CResult_BlindedTailDecodeErrorZ_get_err(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
2722 CHECK(!owner->result_ok);
2723         return DecodeError_clone(&*owner->contents.err);
2724 }
2725 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_get_err"))) TS_CResult_BlindedTailDecodeErrorZ_get_err(uint64_t owner) {
2726         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
2727         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2728         *ret_copy = CResult_BlindedTailDecodeErrorZ_get_err(owner_conv);
2729         uint64_t ret_ref = tag_ptr(ret_copy, true);
2730         return ret_ref;
2731 }
2732
2733 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
2734         LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
2735         for (size_t i = 0; i < ret.datalen; i++) {
2736                 ret.data[i] = RouteHop_clone(&orig->data[i]);
2737         }
2738         return ret;
2739 }
2740 static inline LDKCVec_PathZ CVec_PathZ_clone(const LDKCVec_PathZ *orig) {
2741         LDKCVec_PathZ ret = { .data = MALLOC(sizeof(LDKPath) * orig->datalen, "LDKCVec_PathZ clone bytes"), .datalen = orig->datalen };
2742         for (size_t i = 0; i < ret.datalen; i++) {
2743                 ret.data[i] = Path_clone(&orig->data[i]);
2744         }
2745         return ret;
2746 }
2747 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
2748         LDKRoute ret = *owner->contents.result;
2749         ret.is_owned = false;
2750         return ret;
2751 }
2752 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_ok"))) TS_CResult_RouteDecodeErrorZ_get_ok(uint64_t owner) {
2753         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
2754         LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
2755         uint64_t ret_ref = 0;
2756         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2757         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2758         return ret_ref;
2759 }
2760
2761 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
2762 CHECK(!owner->result_ok);
2763         return DecodeError_clone(&*owner->contents.err);
2764 }
2765 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_err"))) TS_CResult_RouteDecodeErrorZ_get_err(uint64_t owner) {
2766         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
2767         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2768         *ret_copy = CResult_RouteDecodeErrorZ_get_err(owner_conv);
2769         uint64_t ret_ref = tag_ptr(ret_copy, true);
2770         return ret_ref;
2771 }
2772
2773 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
2774         LDKRouteParameters ret = *owner->contents.result;
2775         ret.is_owned = false;
2776         return ret;
2777 }
2778 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_ok"))) TS_CResult_RouteParametersDecodeErrorZ_get_ok(uint64_t owner) {
2779         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
2780         LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
2781         uint64_t ret_ref = 0;
2782         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2783         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2784         return ret_ref;
2785 }
2786
2787 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
2788 CHECK(!owner->result_ok);
2789         return DecodeError_clone(&*owner->contents.err);
2790 }
2791 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_err"))) TS_CResult_RouteParametersDecodeErrorZ_get_err(uint64_t owner) {
2792         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
2793         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2794         *ret_copy = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
2795         uint64_t ret_ref = tag_ptr(ret_copy, true);
2796         return ret_ref;
2797 }
2798
2799 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
2800         LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
2801         memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
2802         return ret;
2803 }
2804 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
2805         LDKPaymentParameters ret = *owner->contents.result;
2806         ret.is_owned = false;
2807         return ret;
2808 }
2809 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_get_ok(uint64_t owner) {
2810         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
2811         LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
2812         uint64_t ret_ref = 0;
2813         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2814         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2815         return ret_ref;
2816 }
2817
2818 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
2819 CHECK(!owner->result_ok);
2820         return DecodeError_clone(&*owner->contents.err);
2821 }
2822 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_err"))) TS_CResult_PaymentParametersDecodeErrorZ_get_err(uint64_t owner) {
2823         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
2824         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2825         *ret_copy = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
2826         uint64_t ret_ref = tag_ptr(ret_copy, true);
2827         return ret_ref;
2828 }
2829
2830 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
2831         LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
2832         for (size_t i = 0; i < ret.datalen; i++) {
2833                 ret.data[i] = RouteHint_clone(&orig->data[i]);
2834         }
2835         return ret;
2836 }
2837 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
2838         LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
2839         for (size_t i = 0; i < ret.datalen; i++) {
2840                 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
2841         }
2842         return ret;
2843 }
2844 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
2845         LDKRouteHint ret = *owner->contents.result;
2846         ret.is_owned = false;
2847         return ret;
2848 }
2849 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_ok"))) TS_CResult_RouteHintDecodeErrorZ_get_ok(uint64_t owner) {
2850         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
2851         LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
2852         uint64_t ret_ref = 0;
2853         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2854         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2855         return ret_ref;
2856 }
2857
2858 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
2859 CHECK(!owner->result_ok);
2860         return DecodeError_clone(&*owner->contents.err);
2861 }
2862 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_err"))) TS_CResult_RouteHintDecodeErrorZ_get_err(uint64_t owner) {
2863         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
2864         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2865         *ret_copy = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
2866         uint64_t ret_ref = tag_ptr(ret_copy, true);
2867         return ret_ref;
2868 }
2869
2870 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
2871         LDKRouteHintHop ret = *owner->contents.result;
2872         ret.is_owned = false;
2873         return ret;
2874 }
2875 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_get_ok(uint64_t owner) {
2876         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
2877         LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
2878         uint64_t ret_ref = 0;
2879         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2880         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2881         return ret_ref;
2882 }
2883
2884 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
2885 CHECK(!owner->result_ok);
2886         return DecodeError_clone(&*owner->contents.err);
2887 }
2888 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_err"))) TS_CResult_RouteHintHopDecodeErrorZ_get_err(uint64_t owner) {
2889         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
2890         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2891         *ret_copy = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
2892         uint64_t ret_ref = tag_ptr(ret_copy, true);
2893         return ret_ref;
2894 }
2895
2896 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
2897         LDKFixedPenaltyScorer ret = *owner->contents.result;
2898         ret.is_owned = false;
2899         return ret;
2900 }
2901 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(uint64_t owner) {
2902         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
2903         LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
2904         uint64_t ret_ref = 0;
2905         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2906         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2907         return ret_ref;
2908 }
2909
2910 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
2911 CHECK(!owner->result_ok);
2912         return DecodeError_clone(&*owner->contents.err);
2913 }
2914 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err(uint64_t owner) {
2915         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
2916         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2917         *ret_copy = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
2918         uint64_t ret_ref = tag_ptr(ret_copy, true);
2919         return ret_ref;
2920 }
2921
2922 static inline LDKCVec_NodeIdZ CVec_NodeIdZ_clone(const LDKCVec_NodeIdZ *orig) {
2923         LDKCVec_NodeIdZ ret = { .data = MALLOC(sizeof(LDKNodeId) * orig->datalen, "LDKCVec_NodeIdZ clone bytes"), .datalen = orig->datalen };
2924         for (size_t i = 0; i < ret.datalen; i++) {
2925                 ret.data[i] = NodeId_clone(&orig->data[i]);
2926         }
2927         return ret;
2928 }
2929 static inline uint64_t C2Tuple_u64u64Z_get_a(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
2930         return owner->a;
2931 }
2932 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_get_a"))) TS_C2Tuple_u64u64Z_get_a(uint64_t owner) {
2933         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
2934         int64_t ret_conv = C2Tuple_u64u64Z_get_a(owner_conv);
2935         return ret_conv;
2936 }
2937
2938 static inline uint64_t C2Tuple_u64u64Z_get_b(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
2939         return owner->b;
2940 }
2941 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_get_b"))) TS_C2Tuple_u64u64Z_get_b(uint64_t owner) {
2942         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
2943         int64_t ret_conv = C2Tuple_u64u64Z_get_b(owner_conv);
2944         return ret_conv;
2945 }
2946
2947 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u64ZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_u64u64ZZ_ty_from_ptr(uint64_t ptr) {
2948         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
2949         switch(obj->tag) {
2950                 case LDKCOption_C2Tuple_u64u64ZZ_Some: return 0;
2951                 case LDKCOption_C2Tuple_u64u64ZZ_None: return 1;
2952                 default: abort();
2953         }
2954 }
2955 uint64_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u64ZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_u64u64ZZ_Some_get_some(uint64_t ptr) {
2956         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
2957         assert(obj->tag == LDKCOption_C2Tuple_u64u64ZZ_Some);
2958         LDKC2Tuple_u64u64Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
2959         *some_conv = obj->some;
2960                         *some_conv = C2Tuple_u64u64Z_clone(some_conv);
2961         return tag_ptr(some_conv, true);
2962 }
2963 static inline struct LDKThirtyTwoU16s C2Tuple_Z_get_a(LDKC2Tuple_Z *NONNULL_PTR owner){
2964         return owner->a;
2965 }
2966 int16_tArray  __attribute__((export_name("TS_C2Tuple_Z_get_a"))) TS_C2Tuple_Z_get_a(uint64_t owner) {
2967         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
2968         int16_tArray ret_arr = init_int16_tArray(32, __LINE__);
2969         memcpy(ret_arr->elems, C2Tuple_Z_get_a(owner_conv).data, 32 * 2);
2970         return ret_arr;
2971 }
2972
2973 static inline struct LDKThirtyTwoU16s C2Tuple_Z_get_b(LDKC2Tuple_Z *NONNULL_PTR owner){
2974         return owner->b;
2975 }
2976 int16_tArray  __attribute__((export_name("TS_C2Tuple_Z_get_b"))) TS_C2Tuple_Z_get_b(uint64_t owner) {
2977         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
2978         int16_tArray ret_arr = init_int16_tArray(32, __LINE__);
2979         memcpy(ret_arr->elems, C2Tuple_Z_get_b(owner_conv).data, 32 * 2);
2980         return ret_arr;
2981 }
2982
2983 static inline struct LDKThirtyTwoU16s C2Tuple__u1632_u1632Z_get_a(LDKC2Tuple__u1632_u1632Z *NONNULL_PTR owner){
2984         return owner->a;
2985 }
2986 int16_tArray  __attribute__((export_name("TS_C2Tuple__u1632_u1632Z_get_a"))) TS_C2Tuple__u1632_u1632Z_get_a(uint64_t owner) {
2987         LDKC2Tuple__u1632_u1632Z* owner_conv = (LDKC2Tuple__u1632_u1632Z*)untag_ptr(owner);
2988         int16_tArray ret_arr = init_int16_tArray(32, __LINE__);
2989         memcpy(ret_arr->elems, C2Tuple__u1632_u1632Z_get_a(owner_conv).data, 32 * 2);
2990         return ret_arr;
2991 }
2992
2993 static inline struct LDKThirtyTwoU16s C2Tuple__u1632_u1632Z_get_b(LDKC2Tuple__u1632_u1632Z *NONNULL_PTR owner){
2994         return owner->b;
2995 }
2996 int16_tArray  __attribute__((export_name("TS_C2Tuple__u1632_u1632Z_get_b"))) TS_C2Tuple__u1632_u1632Z_get_b(uint64_t owner) {
2997         LDKC2Tuple__u1632_u1632Z* owner_conv = (LDKC2Tuple__u1632_u1632Z*)untag_ptr(owner);
2998         int16_tArray ret_arr = init_int16_tArray(32, __LINE__);
2999         memcpy(ret_arr->elems, C2Tuple__u1632_u1632Z_get_b(owner_conv).data, 32 * 2);
3000         return ret_arr;
3001 }
3002
3003 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_ty_from_ptr(uint64_t ptr) {
3004         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *obj = (LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)untag_ptr(ptr);
3005         switch(obj->tag) {
3006                 case LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some: return 0;
3007                 case LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None: return 1;
3008                 default: abort();
3009         }
3010 }
3011 uint64_t __attribute__((export_name("TS_LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_get_some(uint64_t ptr) {
3012         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *obj = (LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)untag_ptr(ptr);
3013         assert(obj->tag == LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some);
3014         LDKC2Tuple__u1632_u1632Z* some_conv = &obj->some;
3015                         // WARNING: we really need to clone here, but no clone is available for LDKC2Tuple__u1632_u1632Z
3016         return tag_ptr(some_conv, false);
3017 }
3018 uint32_t __attribute__((export_name("TS_LDKCOption_f64Z_ty_from_ptr"))) TS_LDKCOption_f64Z_ty_from_ptr(uint64_t ptr) {
3019         LDKCOption_f64Z *obj = (LDKCOption_f64Z*)untag_ptr(ptr);
3020         switch(obj->tag) {
3021                 case LDKCOption_f64Z_Some: return 0;
3022                 case LDKCOption_f64Z_None: return 1;
3023                 default: abort();
3024         }
3025 }
3026 double __attribute__((export_name("TS_LDKCOption_f64Z_Some_get_some"))) TS_LDKCOption_f64Z_Some_get_some(uint64_t ptr) {
3027         LDKCOption_f64Z *obj = (LDKCOption_f64Z*)untag_ptr(ptr);
3028         assert(obj->tag == LDKCOption_f64Z_Some);
3029         double some_conv = obj->some;
3030         return some_conv;
3031 }
3032 typedef struct LDKLogger_JCalls {
3033         atomic_size_t refcnt;
3034         uint32_t instance_ptr;
3035 } LDKLogger_JCalls;
3036 static void LDKLogger_JCalls_free(void* this_arg) {
3037         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3038         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3039                 FREE(j_calls);
3040         }
3041 }
3042 void log_LDKLogger_jcall(const void* this_arg, LDKRecord record) {
3043         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3044         LDKRecord record_var = record;
3045         uint64_t record_ref = 0;
3046         CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
3047         record_ref = tag_ptr(record_var.inner, record_var.is_owned);
3048         js_invoke_function_buuuuu(j_calls->instance_ptr, 16, record_ref, 0, 0, 0, 0, 0);
3049 }
3050 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
3051         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
3052         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3053 }
3054 static inline LDKLogger LDKLogger_init (JSValue o) {
3055         LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
3056         atomic_init(&calls->refcnt, 1);
3057         calls->instance_ptr = o;
3058
3059         LDKLogger ret = {
3060                 .this_arg = (void*) calls,
3061                 .log = log_LDKLogger_jcall,
3062                 .free = LDKLogger_JCalls_free,
3063         };
3064         return ret;
3065 }
3066 uint64_t  __attribute__((export_name("TS_LDKLogger_new"))) TS_LDKLogger_new(JSValue o) {
3067         LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
3068         *res_ptr = LDKLogger_init(o);
3069         return tag_ptr(res_ptr, true);
3070 }
3071 static inline struct LDKProbabilisticScorer CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
3072         LDKProbabilisticScorer ret = *owner->contents.result;
3073         ret.is_owned = false;
3074         return ret;
3075 }
3076 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok(uint64_t owner) {
3077         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
3078         LDKProbabilisticScorer ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
3079         uint64_t ret_ref = 0;
3080         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3081         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3082         return ret_ref;
3083 }
3084
3085 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
3086 CHECK(!owner->result_ok);
3087         return DecodeError_clone(&*owner->contents.err);
3088 }
3089 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err(uint64_t owner) {
3090         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
3091         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3092         *ret_copy = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
3093         uint64_t ret_ref = tag_ptr(ret_copy, true);
3094         return ret_ref;
3095 }
3096
3097 static inline struct LDKBestBlock CResult_BestBlockDecodeErrorZ_get_ok(LDKCResult_BestBlockDecodeErrorZ *NONNULL_PTR owner){
3098         LDKBestBlock ret = *owner->contents.result;
3099         ret.is_owned = false;
3100         return ret;
3101 }
3102 uint64_t  __attribute__((export_name("TS_CResult_BestBlockDecodeErrorZ_get_ok"))) TS_CResult_BestBlockDecodeErrorZ_get_ok(uint64_t owner) {
3103         LDKCResult_BestBlockDecodeErrorZ* owner_conv = (LDKCResult_BestBlockDecodeErrorZ*)untag_ptr(owner);
3104         LDKBestBlock ret_var = CResult_BestBlockDecodeErrorZ_get_ok(owner_conv);
3105         uint64_t ret_ref = 0;
3106         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3107         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3108         return ret_ref;
3109 }
3110
3111 static inline struct LDKDecodeError CResult_BestBlockDecodeErrorZ_get_err(LDKCResult_BestBlockDecodeErrorZ *NONNULL_PTR owner){
3112 CHECK(!owner->result_ok);
3113         return DecodeError_clone(&*owner->contents.err);
3114 }
3115 uint64_t  __attribute__((export_name("TS_CResult_BestBlockDecodeErrorZ_get_err"))) TS_CResult_BestBlockDecodeErrorZ_get_err(uint64_t owner) {
3116         LDKCResult_BestBlockDecodeErrorZ* owner_conv = (LDKCResult_BestBlockDecodeErrorZ*)untag_ptr(owner);
3117         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3118         *ret_copy = CResult_BestBlockDecodeErrorZ_get_err(owner_conv);
3119         uint64_t ret_ref = tag_ptr(ret_copy, true);
3120         return ret_ref;
3121 }
3122
3123 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
3124         return owner->a;
3125 }
3126 uint32_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_a"))) TS_C2Tuple_usizeTransactionZ_get_a(uint64_t owner) {
3127         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
3128         uint32_t ret_conv = C2Tuple_usizeTransactionZ_get_a(owner_conv);
3129         return ret_conv;
3130 }
3131
3132 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
3133         return owner->b;
3134 }
3135 int8_tArray  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_b"))) TS_C2Tuple_usizeTransactionZ_get_b(uint64_t owner) {
3136         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
3137         LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
3138         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
3139         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
3140         return ret_arr;
3141 }
3142
3143 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
3144         LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
3145         for (size_t i = 0; i < ret.datalen; i++) {
3146                 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
3147         }
3148         return ret;
3149 }
3150 static inline struct LDKThirtyTwoBytes C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_a(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
3151         return ThirtyTwoBytes_clone(&owner->a);
3152 }
3153 int8_tArray  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_a"))) TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_a(uint64_t owner) {
3154         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(owner);
3155         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
3156         memcpy(ret_arr->elems, C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_a(owner_conv).data, 32);
3157         return ret_arr;
3158 }
3159
3160 static inline uint32_t C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_b(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
3161         return owner->b;
3162 }
3163 int32_t  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_b"))) TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_b(uint64_t owner) {
3164         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(owner);
3165         int32_t ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_b(owner_conv);
3166         return ret_conv;
3167 }
3168
3169 static inline struct LDKCOption_ThirtyTwoBytesZ C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_c(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
3170         return COption_ThirtyTwoBytesZ_clone(&owner->c);
3171 }
3172 uint64_t  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_c"))) TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_c(uint64_t owner) {
3173         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(owner);
3174         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
3175         *ret_copy = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_c(owner_conv);
3176         uint64_t ret_ref = tag_ptr(ret_copy, true);
3177         return ret_ref;
3178 }
3179
3180 static inline LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_clone(const LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ *orig) {
3181         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ) * orig->datalen, "LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ clone bytes"), .datalen = orig->datalen };
3182         for (size_t i = 0; i < ret.datalen; i++) {
3183                 ret.data[i] = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(&orig->data[i]);
3184         }
3185         return ret;
3186 }
3187 static inline enum LDKChannelMonitorUpdateStatus CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR owner){
3188 CHECK(owner->result_ok);
3189         return ChannelMonitorUpdateStatus_clone(&*owner->contents.result);
3190 }
3191 uint32_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_get_ok"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(uint64_t owner) {
3192         LDKCResult_ChannelMonitorUpdateStatusNoneZ* owner_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(owner);
3193         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(owner_conv));
3194         return ret_conv;
3195 }
3196
3197 static inline void CResult_ChannelMonitorUpdateStatusNoneZ_get_err(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR owner){
3198 CHECK(!owner->result_ok);
3199         return *owner->contents.err;
3200 }
3201 void  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_get_err"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_get_err(uint64_t owner) {
3202         LDKCResult_ChannelMonitorUpdateStatusNoneZ* owner_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(owner);
3203         CResult_ChannelMonitorUpdateStatusNoneZ_get_err(owner_conv);
3204 }
3205
3206 uint32_t __attribute__((export_name("TS_LDKClosureReason_ty_from_ptr"))) TS_LDKClosureReason_ty_from_ptr(uint64_t ptr) {
3207         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
3208         switch(obj->tag) {
3209                 case LDKClosureReason_CounterpartyForceClosed: return 0;
3210                 case LDKClosureReason_HolderForceClosed: return 1;
3211                 case LDKClosureReason_LegacyCooperativeClosure: return 2;
3212                 case LDKClosureReason_CounterpartyInitiatedCooperativeClosure: return 3;
3213                 case LDKClosureReason_LocallyInitiatedCooperativeClosure: return 4;
3214                 case LDKClosureReason_CommitmentTxConfirmed: return 5;
3215                 case LDKClosureReason_FundingTimedOut: return 6;
3216                 case LDKClosureReason_ProcessingError: return 7;
3217                 case LDKClosureReason_DisconnectedPeer: return 8;
3218                 case LDKClosureReason_OutdatedChannelManager: return 9;
3219                 case LDKClosureReason_CounterpartyCoopClosedUnfundedChannel: return 10;
3220                 case LDKClosureReason_FundingBatchClosure: return 11;
3221                 case LDKClosureReason_HTLCsTimedOut: return 12;
3222                 default: abort();
3223         }
3224 }
3225 uint64_t __attribute__((export_name("TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg"))) TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg(uint64_t ptr) {
3226         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
3227         assert(obj->tag == LDKClosureReason_CounterpartyForceClosed);
3228         LDKUntrustedString peer_msg_var = obj->counterparty_force_closed.peer_msg;
3229                         uint64_t peer_msg_ref = 0;
3230                         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_var);
3231                         peer_msg_ref = tag_ptr(peer_msg_var.inner, false);
3232         return peer_msg_ref;
3233 }
3234 jstring __attribute__((export_name("TS_LDKClosureReason_ProcessingError_get_err"))) TS_LDKClosureReason_ProcessingError_get_err(uint64_t ptr) {
3235         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
3236         assert(obj->tag == LDKClosureReason_ProcessingError);
3237         LDKStr err_str = obj->processing_error.err;
3238                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
3239         return err_conv;
3240 }
3241 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_ty_from_ptr"))) TS_LDKMonitorEvent_ty_from_ptr(uint64_t ptr) {
3242         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3243         switch(obj->tag) {
3244                 case LDKMonitorEvent_HTLCEvent: return 0;
3245                 case LDKMonitorEvent_HolderForceClosedWithInfo: return 1;
3246                 case LDKMonitorEvent_HolderForceClosed: return 2;
3247                 case LDKMonitorEvent_Completed: return 3;
3248                 default: abort();
3249         }
3250 }
3251 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_HTLCEvent_get_htlc_event"))) TS_LDKMonitorEvent_HTLCEvent_get_htlc_event(uint64_t ptr) {
3252         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3253         assert(obj->tag == LDKMonitorEvent_HTLCEvent);
3254         LDKHTLCUpdate htlc_event_var = obj->htlc_event;
3255                         uint64_t htlc_event_ref = 0;
3256                         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
3257                         htlc_event_ref = tag_ptr(htlc_event_var.inner, false);
3258         return htlc_event_ref;
3259 }
3260 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_HolderForceClosedWithInfo_get_reason"))) TS_LDKMonitorEvent_HolderForceClosedWithInfo_get_reason(uint64_t ptr) {
3261         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3262         assert(obj->tag == LDKMonitorEvent_HolderForceClosedWithInfo);
3263         uint64_t reason_ref = tag_ptr(&obj->holder_force_closed_with_info.reason, false);
3264         return reason_ref;
3265 }
3266 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_HolderForceClosedWithInfo_get_outpoint"))) TS_LDKMonitorEvent_HolderForceClosedWithInfo_get_outpoint(uint64_t ptr) {
3267         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3268         assert(obj->tag == LDKMonitorEvent_HolderForceClosedWithInfo);
3269         LDKOutPoint outpoint_var = obj->holder_force_closed_with_info.outpoint;
3270                         uint64_t outpoint_ref = 0;
3271                         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
3272                         outpoint_ref = tag_ptr(outpoint_var.inner, false);
3273         return outpoint_ref;
3274 }
3275 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_HolderForceClosedWithInfo_get_channel_id"))) TS_LDKMonitorEvent_HolderForceClosedWithInfo_get_channel_id(uint64_t ptr) {
3276         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3277         assert(obj->tag == LDKMonitorEvent_HolderForceClosedWithInfo);
3278         LDKChannelId channel_id_var = obj->holder_force_closed_with_info.channel_id;
3279                         uint64_t channel_id_ref = 0;
3280                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
3281                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
3282         return channel_id_ref;
3283 }
3284 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_HolderForceClosed_get_holder_force_closed"))) TS_LDKMonitorEvent_HolderForceClosed_get_holder_force_closed(uint64_t ptr) {
3285         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3286         assert(obj->tag == LDKMonitorEvent_HolderForceClosed);
3287         LDKOutPoint holder_force_closed_var = obj->holder_force_closed;
3288                         uint64_t holder_force_closed_ref = 0;
3289                         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_force_closed_var);
3290                         holder_force_closed_ref = tag_ptr(holder_force_closed_var.inner, false);
3291         return holder_force_closed_ref;
3292 }
3293 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_Completed_get_funding_txo"))) TS_LDKMonitorEvent_Completed_get_funding_txo(uint64_t ptr) {
3294         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3295         assert(obj->tag == LDKMonitorEvent_Completed);
3296         LDKOutPoint funding_txo_var = obj->completed.funding_txo;
3297                         uint64_t funding_txo_ref = 0;
3298                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
3299                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
3300         return funding_txo_ref;
3301 }
3302 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_Completed_get_channel_id"))) TS_LDKMonitorEvent_Completed_get_channel_id(uint64_t ptr) {
3303         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3304         assert(obj->tag == LDKMonitorEvent_Completed);
3305         LDKChannelId channel_id_var = obj->completed.channel_id;
3306                         uint64_t channel_id_ref = 0;
3307                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
3308                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
3309         return channel_id_ref;
3310 }
3311 int64_t __attribute__((export_name("TS_LDKMonitorEvent_Completed_get_monitor_update_id"))) TS_LDKMonitorEvent_Completed_get_monitor_update_id(uint64_t ptr) {
3312         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3313         assert(obj->tag == LDKMonitorEvent_Completed);
3314         int64_t monitor_update_id_conv = obj->completed.monitor_update_id;
3315         return monitor_update_id_conv;
3316 }
3317 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
3318         LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
3319         for (size_t i = 0; i < ret.datalen; i++) {
3320                 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
3321         }
3322         return ret;
3323 }
3324 static inline struct LDKOutPoint C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_a(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
3325         LDKOutPoint ret = owner->a;
3326         ret.is_owned = false;
3327         return ret;
3328 }
3329 uint64_t  __attribute__((export_name("TS_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_a"))) TS_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_a(uint64_t owner) {
3330         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
3331         LDKOutPoint ret_var = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_a(owner_conv);
3332         uint64_t ret_ref = 0;
3333         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3334         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3335         return ret_ref;
3336 }
3337
3338 static inline struct LDKChannelId C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_b(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
3339         LDKChannelId ret = owner->b;
3340         ret.is_owned = false;
3341         return ret;
3342 }
3343 uint64_t  __attribute__((export_name("TS_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_b"))) TS_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_b(uint64_t owner) {
3344         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
3345         LDKChannelId ret_var = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_b(owner_conv);
3346         uint64_t ret_ref = 0;
3347         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3348         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3349         return ret_ref;
3350 }
3351
3352 static inline struct LDKCVec_MonitorEventZ C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_c(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
3353         return CVec_MonitorEventZ_clone(&owner->c);
3354 }
3355 uint64_tArray  __attribute__((export_name("TS_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_c"))) TS_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_c(uint64_t owner) {
3356         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
3357         LDKCVec_MonitorEventZ ret_var = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_c(owner_conv);
3358         uint64_tArray ret_arr = NULL;
3359         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
3360         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
3361         for (size_t o = 0; o < ret_var.datalen; o++) {
3362                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
3363                 *ret_conv_14_copy = ret_var.data[o];
3364                 uint64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
3365                 ret_arr_ptr[o] = ret_conv_14_ref;
3366         }
3367         
3368         FREE(ret_var.data);
3369         return ret_arr;
3370 }
3371
3372 static inline struct LDKPublicKey C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_d(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
3373         return owner->d;
3374 }
3375 int8_tArray  __attribute__((export_name("TS_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_d"))) TS_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_d(uint64_t owner) {
3376         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
3377         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
3378         memcpy(ret_arr->elems, C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_d(owner_conv).compressed_form, 33);
3379         return ret_arr;
3380 }
3381
3382 static inline LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ_clone(const LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ *orig) {
3383         LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ) * orig->datalen, "LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ clone bytes"), .datalen = orig->datalen };
3384         for (size_t i = 0; i < ret.datalen; i++) {
3385                 ret.data[i] = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone(&orig->data[i]);
3386         }
3387         return ret;
3388 }
3389 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3390         LDKInitFeatures ret = *owner->contents.result;
3391         ret.is_owned = false;
3392         return ret;
3393 }
3394 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3395         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
3396         LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
3397         uint64_t ret_ref = 0;
3398         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3399         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3400         return ret_ref;
3401 }
3402
3403 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3404 CHECK(!owner->result_ok);
3405         return DecodeError_clone(&*owner->contents.err);
3406 }
3407 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_err"))) TS_CResult_InitFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3408         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
3409         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3410         *ret_copy = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
3411         uint64_t ret_ref = tag_ptr(ret_copy, true);
3412         return ret_ref;
3413 }
3414
3415 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3416         LDKChannelFeatures ret = *owner->contents.result;
3417         ret.is_owned = false;
3418         return ret;
3419 }
3420 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3421         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
3422         LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
3423         uint64_t ret_ref = 0;
3424         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3425         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3426         return ret_ref;
3427 }
3428
3429 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3430 CHECK(!owner->result_ok);
3431         return DecodeError_clone(&*owner->contents.err);
3432 }
3433 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3434         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
3435         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3436         *ret_copy = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
3437         uint64_t ret_ref = tag_ptr(ret_copy, true);
3438         return ret_ref;
3439 }
3440
3441 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3442         LDKNodeFeatures ret = *owner->contents.result;
3443         ret.is_owned = false;
3444         return ret;
3445 }
3446 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3447         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
3448         LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
3449         uint64_t ret_ref = 0;
3450         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3451         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3452         return ret_ref;
3453 }
3454
3455 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3456 CHECK(!owner->result_ok);
3457         return DecodeError_clone(&*owner->contents.err);
3458 }
3459 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3460         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
3461         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3462         *ret_copy = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
3463         uint64_t ret_ref = tag_ptr(ret_copy, true);
3464         return ret_ref;
3465 }
3466
3467 static inline struct LDKBolt11InvoiceFeatures CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3468         LDKBolt11InvoiceFeatures ret = *owner->contents.result;
3469         ret.is_owned = false;
3470         return ret;
3471 }
3472 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3473         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3474         LDKBolt11InvoiceFeatures ret_var = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
3475         uint64_t ret_ref = 0;
3476         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3477         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3478         return ret_ref;
3479 }
3480
3481 static inline struct LDKDecodeError CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3482 CHECK(!owner->result_ok);
3483         return DecodeError_clone(&*owner->contents.err);
3484 }
3485 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3486         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3487         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3488         *ret_copy = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
3489         uint64_t ret_ref = tag_ptr(ret_copy, true);
3490         return ret_ref;
3491 }
3492
3493 static inline struct LDKBolt12InvoiceFeatures CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3494         LDKBolt12InvoiceFeatures ret = *owner->contents.result;
3495         ret.is_owned = false;
3496         return ret;
3497 }
3498 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3499         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3500         LDKBolt12InvoiceFeatures ret_var = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
3501         uint64_t ret_ref = 0;
3502         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3503         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3504         return ret_ref;
3505 }
3506
3507 static inline struct LDKDecodeError CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3508 CHECK(!owner->result_ok);
3509         return DecodeError_clone(&*owner->contents.err);
3510 }
3511 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3512         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3513         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3514         *ret_copy = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
3515         uint64_t ret_ref = tag_ptr(ret_copy, true);
3516         return ret_ref;
3517 }
3518
3519 static inline struct LDKBlindedHopFeatures CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
3520         LDKBlindedHopFeatures ret = *owner->contents.result;
3521         ret.is_owned = false;
3522         return ret;
3523 }
3524 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_ok"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3525         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
3526         LDKBlindedHopFeatures ret_var = CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(owner_conv);
3527         uint64_t ret_ref = 0;
3528         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3529         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3530         return ret_ref;
3531 }
3532
3533 static inline struct LDKDecodeError CResult_BlindedHopFeaturesDecodeErrorZ_get_err(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
3534 CHECK(!owner->result_ok);
3535         return DecodeError_clone(&*owner->contents.err);
3536 }
3537 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_err"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3538         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
3539         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3540         *ret_copy = CResult_BlindedHopFeaturesDecodeErrorZ_get_err(owner_conv);
3541         uint64_t ret_ref = tag_ptr(ret_copy, true);
3542         return ret_ref;
3543 }
3544
3545 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3546         LDKChannelTypeFeatures ret = *owner->contents.result;
3547         ret.is_owned = false;
3548         return ret;
3549 }
3550 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3551         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
3552         LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
3553         uint64_t ret_ref = 0;
3554         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3555         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3556         return ret_ref;
3557 }
3558
3559 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3560 CHECK(!owner->result_ok);
3561         return DecodeError_clone(&*owner->contents.err);
3562 }
3563 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3564         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
3565         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3566         *ret_copy = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
3567         uint64_t ret_ref = tag_ptr(ret_copy, true);
3568         return ret_ref;
3569 }
3570
3571 static inline struct LDKOfferId CResult_OfferIdDecodeErrorZ_get_ok(LDKCResult_OfferIdDecodeErrorZ *NONNULL_PTR owner){
3572         LDKOfferId ret = *owner->contents.result;
3573         ret.is_owned = false;
3574         return ret;
3575 }
3576 uint64_t  __attribute__((export_name("TS_CResult_OfferIdDecodeErrorZ_get_ok"))) TS_CResult_OfferIdDecodeErrorZ_get_ok(uint64_t owner) {
3577         LDKCResult_OfferIdDecodeErrorZ* owner_conv = (LDKCResult_OfferIdDecodeErrorZ*)untag_ptr(owner);
3578         LDKOfferId ret_var = CResult_OfferIdDecodeErrorZ_get_ok(owner_conv);
3579         uint64_t ret_ref = 0;
3580         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3581         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3582         return ret_ref;
3583 }
3584
3585 static inline struct LDKDecodeError CResult_OfferIdDecodeErrorZ_get_err(LDKCResult_OfferIdDecodeErrorZ *NONNULL_PTR owner){
3586 CHECK(!owner->result_ok);
3587         return DecodeError_clone(&*owner->contents.err);
3588 }
3589 uint64_t  __attribute__((export_name("TS_CResult_OfferIdDecodeErrorZ_get_err"))) TS_CResult_OfferIdDecodeErrorZ_get_err(uint64_t owner) {
3590         LDKCResult_OfferIdDecodeErrorZ* owner_conv = (LDKCResult_OfferIdDecodeErrorZ*)untag_ptr(owner);
3591         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3592         *ret_copy = CResult_OfferIdDecodeErrorZ_get_err(owner_conv);
3593         uint64_t ret_ref = tag_ptr(ret_copy, true);
3594         return ret_ref;
3595 }
3596
3597 static inline void CResult_NoneBolt12SemanticErrorZ_get_ok(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR owner){
3598 CHECK(owner->result_ok);
3599         return *owner->contents.result;
3600 }
3601 void  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_get_ok"))) TS_CResult_NoneBolt12SemanticErrorZ_get_ok(uint64_t owner) {
3602         LDKCResult_NoneBolt12SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(owner);
3603         CResult_NoneBolt12SemanticErrorZ_get_ok(owner_conv);
3604 }
3605
3606 static inline enum LDKBolt12SemanticError CResult_NoneBolt12SemanticErrorZ_get_err(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR owner){
3607 CHECK(!owner->result_ok);
3608         return Bolt12SemanticError_clone(&*owner->contents.err);
3609 }
3610 uint32_t  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_get_err"))) TS_CResult_NoneBolt12SemanticErrorZ_get_err(uint64_t owner) {
3611         LDKCResult_NoneBolt12SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(owner);
3612         uint32_t ret_conv = LDKBolt12SemanticError_to_js(CResult_NoneBolt12SemanticErrorZ_get_err(owner_conv));
3613         return ret_conv;
3614 }
3615
3616 static inline struct LDKOffer CResult_OfferBolt12SemanticErrorZ_get_ok(LDKCResult_OfferBolt12SemanticErrorZ *NONNULL_PTR owner){
3617         LDKOffer ret = *owner->contents.result;
3618         ret.is_owned = false;
3619         return ret;
3620 }
3621 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12SemanticErrorZ_get_ok"))) TS_CResult_OfferBolt12SemanticErrorZ_get_ok(uint64_t owner) {
3622         LDKCResult_OfferBolt12SemanticErrorZ* owner_conv = (LDKCResult_OfferBolt12SemanticErrorZ*)untag_ptr(owner);
3623         LDKOffer ret_var = CResult_OfferBolt12SemanticErrorZ_get_ok(owner_conv);
3624         uint64_t ret_ref = 0;
3625         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3626         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3627         return ret_ref;
3628 }
3629
3630 static inline enum LDKBolt12SemanticError CResult_OfferBolt12SemanticErrorZ_get_err(LDKCResult_OfferBolt12SemanticErrorZ *NONNULL_PTR owner){
3631 CHECK(!owner->result_ok);
3632         return Bolt12SemanticError_clone(&*owner->contents.err);
3633 }
3634 uint32_t  __attribute__((export_name("TS_CResult_OfferBolt12SemanticErrorZ_get_err"))) TS_CResult_OfferBolt12SemanticErrorZ_get_err(uint64_t owner) {
3635         LDKCResult_OfferBolt12SemanticErrorZ* owner_conv = (LDKCResult_OfferBolt12SemanticErrorZ*)untag_ptr(owner);
3636         uint32_t ret_conv = LDKBolt12SemanticError_to_js(CResult_OfferBolt12SemanticErrorZ_get_err(owner_conv));
3637         return ret_conv;
3638 }
3639
3640 static inline struct LDKInvoiceRequestWithDerivedPayerIdBuilder CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_get_ok(LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
3641         LDKInvoiceRequestWithDerivedPayerIdBuilder ret = *owner->contents.result;
3642         ret.is_owned = false;
3643         return ret;
3644 }
3645 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_get_ok"))) TS_CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_get_ok(uint64_t owner) {
3646         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
3647         LDKInvoiceRequestWithDerivedPayerIdBuilder ret_var = CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_get_ok(owner_conv);
3648         uint64_t ret_ref = 0;
3649         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3650         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3651         return ret_ref;
3652 }
3653
3654 static inline enum LDKBolt12SemanticError CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_get_err(LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
3655 CHECK(!owner->result_ok);
3656         return Bolt12SemanticError_clone(&*owner->contents.err);
3657 }
3658 uint32_t  __attribute__((export_name("TS_CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_get_err"))) TS_CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_get_err(uint64_t owner) {
3659         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
3660         uint32_t ret_conv = LDKBolt12SemanticError_to_js(CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_get_err(owner_conv));
3661         return ret_conv;
3662 }
3663
3664 static inline struct LDKInvoiceRequestWithExplicitPayerIdBuilder CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_get_ok(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
3665         LDKInvoiceRequestWithExplicitPayerIdBuilder ret = *owner->contents.result;
3666         ret.is_owned = false;
3667         return ret;
3668 }
3669 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_get_ok"))) TS_CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_get_ok(uint64_t owner) {
3670         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
3671         LDKInvoiceRequestWithExplicitPayerIdBuilder ret_var = CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_get_ok(owner_conv);
3672         uint64_t ret_ref = 0;
3673         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3674         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3675         return ret_ref;
3676 }
3677
3678 static inline enum LDKBolt12SemanticError CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_get_err(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
3679 CHECK(!owner->result_ok);
3680         return Bolt12SemanticError_clone(&*owner->contents.err);
3681 }
3682 uint32_t  __attribute__((export_name("TS_CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_get_err"))) TS_CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_get_err(uint64_t owner) {
3683         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
3684         uint32_t ret_conv = LDKBolt12SemanticError_to_js(CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_get_err(owner_conv));
3685         return ret_conv;
3686 }
3687
3688 static inline struct LDKOffer CResult_OfferBolt12ParseErrorZ_get_ok(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR owner){
3689         LDKOffer ret = *owner->contents.result;
3690         ret.is_owned = false;
3691         return ret;
3692 }
3693 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_get_ok"))) TS_CResult_OfferBolt12ParseErrorZ_get_ok(uint64_t owner) {
3694         LDKCResult_OfferBolt12ParseErrorZ* owner_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(owner);
3695         LDKOffer ret_var = CResult_OfferBolt12ParseErrorZ_get_ok(owner_conv);
3696         uint64_t ret_ref = 0;
3697         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3698         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3699         return ret_ref;
3700 }
3701
3702 static inline struct LDKBolt12ParseError CResult_OfferBolt12ParseErrorZ_get_err(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR owner){
3703         LDKBolt12ParseError ret = *owner->contents.err;
3704         ret.is_owned = false;
3705         return ret;
3706 }
3707 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_get_err"))) TS_CResult_OfferBolt12ParseErrorZ_get_err(uint64_t owner) {
3708         LDKCResult_OfferBolt12ParseErrorZ* owner_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(owner);
3709         LDKBolt12ParseError ret_var = CResult_OfferBolt12ParseErrorZ_get_err(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 struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3717         LDKNodeId ret = *owner->contents.result;
3718         ret.is_owned = false;
3719         return ret;
3720 }
3721 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_ok"))) TS_CResult_NodeIdDecodeErrorZ_get_ok(uint64_t owner) {
3722         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
3723         LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
3724         uint64_t ret_ref = 0;
3725         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3726         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3727         return ret_ref;
3728 }
3729
3730 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3731 CHECK(!owner->result_ok);
3732         return DecodeError_clone(&*owner->contents.err);
3733 }
3734 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_err"))) TS_CResult_NodeIdDecodeErrorZ_get_err(uint64_t owner) {
3735         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
3736         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3737         *ret_copy = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
3738         uint64_t ret_ref = tag_ptr(ret_copy, true);
3739         return ret_ref;
3740 }
3741
3742 static inline struct LDKPublicKey CResult_PublicKeySecp256k1ErrorZ_get_ok(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR owner){
3743 CHECK(owner->result_ok);
3744         return *owner->contents.result;
3745 }
3746 int8_tArray  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_get_ok"))) TS_CResult_PublicKeySecp256k1ErrorZ_get_ok(uint64_t owner) {
3747         LDKCResult_PublicKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(owner);
3748         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
3749         memcpy(ret_arr->elems, CResult_PublicKeySecp256k1ErrorZ_get_ok(owner_conv).compressed_form, 33);
3750         return ret_arr;
3751 }
3752
3753 static inline enum LDKSecp256k1Error CResult_PublicKeySecp256k1ErrorZ_get_err(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR owner){
3754 CHECK(!owner->result_ok);
3755         return *owner->contents.err;
3756 }
3757 uint32_t  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_get_err"))) TS_CResult_PublicKeySecp256k1ErrorZ_get_err(uint64_t owner) {
3758         LDKCResult_PublicKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(owner);
3759         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PublicKeySecp256k1ErrorZ_get_err(owner_conv));
3760         return ret_conv;
3761 }
3762
3763 uint32_t __attribute__((export_name("TS_LDKNetworkUpdate_ty_from_ptr"))) TS_LDKNetworkUpdate_ty_from_ptr(uint64_t ptr) {
3764         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3765         switch(obj->tag) {
3766                 case LDKNetworkUpdate_ChannelUpdateMessage: return 0;
3767                 case LDKNetworkUpdate_ChannelFailure: return 1;
3768                 case LDKNetworkUpdate_NodeFailure: return 2;
3769                 default: abort();
3770         }
3771 }
3772 uint64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg"))) TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg(uint64_t ptr) {
3773         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3774         assert(obj->tag == LDKNetworkUpdate_ChannelUpdateMessage);
3775         LDKChannelUpdate msg_var = obj->channel_update_message.msg;
3776                         uint64_t msg_ref = 0;
3777                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3778                         msg_ref = tag_ptr(msg_var.inner, false);
3779         return msg_ref;
3780 }
3781 int64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id"))) TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id(uint64_t ptr) {
3782         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3783         assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
3784         int64_t short_channel_id_conv = obj->channel_failure.short_channel_id;
3785         return short_channel_id_conv;
3786 }
3787 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent"))) TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent(uint64_t ptr) {
3788         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3789         assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
3790         jboolean is_permanent_conv = obj->channel_failure.is_permanent;
3791         return is_permanent_conv;
3792 }
3793 int8_tArray __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_node_id"))) TS_LDKNetworkUpdate_NodeFailure_get_node_id(uint64_t ptr) {
3794         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3795         assert(obj->tag == LDKNetworkUpdate_NodeFailure);
3796         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3797         memcpy(node_id_arr->elems, obj->node_failure.node_id.compressed_form, 33);
3798         return node_id_arr;
3799 }
3800 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_is_permanent"))) TS_LDKNetworkUpdate_NodeFailure_get_is_permanent(uint64_t ptr) {
3801         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3802         assert(obj->tag == LDKNetworkUpdate_NodeFailure);
3803         jboolean is_permanent_conv = obj->node_failure.is_permanent;
3804         return is_permanent_conv;
3805 }
3806 uint32_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_ty_from_ptr"))) TS_LDKCOption_NetworkUpdateZ_ty_from_ptr(uint64_t ptr) {
3807         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
3808         switch(obj->tag) {
3809                 case LDKCOption_NetworkUpdateZ_Some: return 0;
3810                 case LDKCOption_NetworkUpdateZ_None: return 1;
3811                 default: abort();
3812         }
3813 }
3814 uint64_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_Some_get_some"))) TS_LDKCOption_NetworkUpdateZ_Some_get_some(uint64_t ptr) {
3815         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
3816         assert(obj->tag == LDKCOption_NetworkUpdateZ_Some);
3817         uint64_t some_ref = tag_ptr(&obj->some, false);
3818         return some_ref;
3819 }
3820 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3821 CHECK(owner->result_ok);
3822         return COption_NetworkUpdateZ_clone(&*owner->contents.result);
3823 }
3824 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(uint64_t owner) {
3825         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
3826         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
3827         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
3828         uint64_t ret_ref = tag_ptr(ret_copy, true);
3829         return ret_ref;
3830 }
3831
3832 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3833 CHECK(!owner->result_ok);
3834         return DecodeError_clone(&*owner->contents.err);
3835 }
3836 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(uint64_t owner) {
3837         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
3838         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3839         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
3840         uint64_t ret_ref = tag_ptr(ret_copy, true);
3841         return ret_ref;
3842 }
3843
3844 static inline struct LDKTxOut CResult_TxOutUtxoLookupErrorZ_get_ok(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
3845 CHECK(owner->result_ok);
3846         return TxOut_clone(&*owner->contents.result);
3847 }
3848 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_get_ok"))) TS_CResult_TxOutUtxoLookupErrorZ_get_ok(uint64_t owner) {
3849         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
3850         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
3851         *ret_ref = CResult_TxOutUtxoLookupErrorZ_get_ok(owner_conv);
3852         return tag_ptr(ret_ref, true);
3853 }
3854
3855 static inline enum LDKUtxoLookupError CResult_TxOutUtxoLookupErrorZ_get_err(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
3856 CHECK(!owner->result_ok);
3857         return UtxoLookupError_clone(&*owner->contents.err);
3858 }
3859 uint32_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_get_err"))) TS_CResult_TxOutUtxoLookupErrorZ_get_err(uint64_t owner) {
3860         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
3861         uint32_t ret_conv = LDKUtxoLookupError_to_js(CResult_TxOutUtxoLookupErrorZ_get_err(owner_conv));
3862         return ret_conv;
3863 }
3864
3865 uint32_t __attribute__((export_name("TS_LDKUtxoResult_ty_from_ptr"))) TS_LDKUtxoResult_ty_from_ptr(uint64_t ptr) {
3866         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
3867         switch(obj->tag) {
3868                 case LDKUtxoResult_Sync: return 0;
3869                 case LDKUtxoResult_Async: return 1;
3870                 default: abort();
3871         }
3872 }
3873 uint64_t __attribute__((export_name("TS_LDKUtxoResult_Sync_get_sync"))) TS_LDKUtxoResult_Sync_get_sync(uint64_t ptr) {
3874         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
3875         assert(obj->tag == LDKUtxoResult_Sync);
3876         LDKCResult_TxOutUtxoLookupErrorZ* sync_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
3877         *sync_conv = obj->sync;
3878                         *sync_conv = CResult_TxOutUtxoLookupErrorZ_clone(sync_conv);
3879         return tag_ptr(sync_conv, true);
3880 }
3881 uint64_t __attribute__((export_name("TS_LDKUtxoResult_Async_get_async"))) TS_LDKUtxoResult_Async_get_async(uint64_t ptr) {
3882         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
3883         assert(obj->tag == LDKUtxoResult_Async);
3884         LDKUtxoFuture async_var = obj->async;
3885                         uint64_t async_ref = 0;
3886                         CHECK_INNER_FIELD_ACCESS_OR_NULL(async_var);
3887                         async_ref = tag_ptr(async_var.inner, false);
3888         return async_ref;
3889 }
3890 typedef struct LDKUtxoLookup_JCalls {
3891         atomic_size_t refcnt;
3892         uint32_t instance_ptr;
3893 } LDKUtxoLookup_JCalls;
3894 static void LDKUtxoLookup_JCalls_free(void* this_arg) {
3895         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
3896         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3897                 FREE(j_calls);
3898         }
3899 }
3900 LDKUtxoResult get_utxo_LDKUtxoLookup_jcall(const void* this_arg, const uint8_t (* chain_hash)[32], uint64_t short_channel_id) {
3901         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
3902         int8_tArray chain_hash_arr = init_int8_tArray(32, __LINE__);
3903         memcpy(chain_hash_arr->elems, *chain_hash, 32);
3904         int64_t short_channel_id_conv = short_channel_id;
3905         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);
3906         void* ret_ptr = untag_ptr(ret);
3907         CHECK_ACCESS(ret_ptr);
3908         LDKUtxoResult ret_conv = *(LDKUtxoResult*)(ret_ptr);
3909         FREE(untag_ptr(ret));
3910         return ret_conv;
3911 }
3912 static void LDKUtxoLookup_JCalls_cloned(LDKUtxoLookup* new_obj) {
3913         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) new_obj->this_arg;
3914         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3915 }
3916 static inline LDKUtxoLookup LDKUtxoLookup_init (JSValue o) {
3917         LDKUtxoLookup_JCalls *calls = MALLOC(sizeof(LDKUtxoLookup_JCalls), "LDKUtxoLookup_JCalls");
3918         atomic_init(&calls->refcnt, 1);
3919         calls->instance_ptr = o;
3920
3921         LDKUtxoLookup ret = {
3922                 .this_arg = (void*) calls,
3923                 .get_utxo = get_utxo_LDKUtxoLookup_jcall,
3924                 .free = LDKUtxoLookup_JCalls_free,
3925         };
3926         return ret;
3927 }
3928 uint64_t  __attribute__((export_name("TS_LDKUtxoLookup_new"))) TS_LDKUtxoLookup_new(JSValue o) {
3929         LDKUtxoLookup *res_ptr = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
3930         *res_ptr = LDKUtxoLookup_init(o);
3931         return tag_ptr(res_ptr, true);
3932 }
3933 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) {
3934         void* this_arg_ptr = untag_ptr(this_arg);
3935         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3936         LDKUtxoLookup* this_arg_conv = (LDKUtxoLookup*)this_arg_ptr;
3937         uint8_t chain_hash_arr[32];
3938         CHECK(chain_hash->arr_len == 32);
3939         memcpy(chain_hash_arr, chain_hash->elems, 32); FREE(chain_hash);
3940         uint8_t (*chain_hash_ref)[32] = &chain_hash_arr;
3941         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
3942         *ret_copy = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, chain_hash_ref, short_channel_id);
3943         uint64_t ret_ref = tag_ptr(ret_copy, true);
3944         return ret_ref;
3945 }
3946
3947 uint32_t __attribute__((export_name("TS_LDKCOption_UtxoLookupZ_ty_from_ptr"))) TS_LDKCOption_UtxoLookupZ_ty_from_ptr(uint64_t ptr) {
3948         LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr);
3949         switch(obj->tag) {
3950                 case LDKCOption_UtxoLookupZ_Some: return 0;
3951                 case LDKCOption_UtxoLookupZ_None: return 1;
3952                 default: abort();
3953         }
3954 }
3955 uint64_t __attribute__((export_name("TS_LDKCOption_UtxoLookupZ_Some_get_some"))) TS_LDKCOption_UtxoLookupZ_Some_get_some(uint64_t ptr) {
3956         LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr);
3957         assert(obj->tag == LDKCOption_UtxoLookupZ_Some);
3958         LDKUtxoLookup* some_ret = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
3959         *some_ret = obj->some;
3960                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
3961                         if ((*some_ret).free == LDKUtxoLookup_JCalls_free) {
3962                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
3963                                 LDKUtxoLookup_JCalls_cloned(&(*some_ret));
3964                         }
3965         return tag_ptr(some_ret, true);
3966 }
3967 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3968 CHECK(owner->result_ok);
3969         return *owner->contents.result;
3970 }
3971 void  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_ok"))) TS_CResult_NoneLightningErrorZ_get_ok(uint64_t owner) {
3972         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
3973         CResult_NoneLightningErrorZ_get_ok(owner_conv);
3974 }
3975
3976 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3977         LDKLightningError ret = *owner->contents.err;
3978         ret.is_owned = false;
3979         return ret;
3980 }
3981 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_err"))) TS_CResult_NoneLightningErrorZ_get_err(uint64_t owner) {
3982         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
3983         LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
3984         uint64_t ret_ref = 0;
3985         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3986         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3987         return ret_ref;
3988 }
3989
3990 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3991 CHECK(owner->result_ok);
3992         return *owner->contents.result;
3993 }
3994 jboolean  __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_ok"))) TS_CResult_boolLightningErrorZ_get_ok(uint64_t owner) {
3995         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
3996         jboolean ret_conv = CResult_boolLightningErrorZ_get_ok(owner_conv);
3997         return ret_conv;
3998 }
3999
4000 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
4001         LDKLightningError ret = *owner->contents.err;
4002         ret.is_owned = false;
4003         return ret;
4004 }
4005 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_err"))) TS_CResult_boolLightningErrorZ_get_err(uint64_t owner) {
4006         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
4007         LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
4008         uint64_t ret_ref = 0;
4009         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4010         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4011         return ret_ref;
4012 }
4013
4014 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
4015         LDKChannelAnnouncement ret = owner->a;
4016         ret.is_owned = false;
4017         return ret;
4018 }
4019 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint64_t owner) {
4020         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
4021         LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(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 struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
4029         LDKChannelUpdate ret = owner->b;
4030         ret.is_owned = false;
4031         return ret;
4032 }
4033 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint64_t owner) {
4034         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
4035         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
4036         uint64_t ret_ref = 0;
4037         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4038         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4039         return ret_ref;
4040 }
4041
4042 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
4043         LDKChannelUpdate ret = owner->c;
4044         ret.is_owned = false;
4045         return ret;
4046 }
4047 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint64_t owner) {
4048         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
4049         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
4050         uint64_t ret_ref = 0;
4051         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4052         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4053         return ret_ref;
4054 }
4055
4056 uint32_t __attribute__((export_name("TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_ty_from_ptr"))) TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_ty_from_ptr(uint64_t ptr) {
4057         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
4058         switch(obj->tag) {
4059                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some: return 0;
4060                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None: return 1;
4061                 default: abort();
4062         }
4063 }
4064 uint64_t __attribute__((export_name("TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_get_some"))) TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_get_some(uint64_t ptr) {
4065         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
4066         assert(obj->tag == LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some);
4067         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* some_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
4068         *some_conv = obj->some;
4069                         *some_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(some_conv);
4070         return tag_ptr(some_conv, true);
4071 }
4072 uint32_t __attribute__((export_name("TS_LDKErrorAction_ty_from_ptr"))) TS_LDKErrorAction_ty_from_ptr(uint64_t ptr) {
4073         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4074         switch(obj->tag) {
4075                 case LDKErrorAction_DisconnectPeer: return 0;
4076                 case LDKErrorAction_DisconnectPeerWithWarning: return 1;
4077                 case LDKErrorAction_IgnoreError: return 2;
4078                 case LDKErrorAction_IgnoreAndLog: return 3;
4079                 case LDKErrorAction_IgnoreDuplicateGossip: return 4;
4080                 case LDKErrorAction_SendErrorMessage: return 5;
4081                 case LDKErrorAction_SendWarningMessage: return 6;
4082                 default: abort();
4083         }
4084 }
4085 uint64_t __attribute__((export_name("TS_LDKErrorAction_DisconnectPeer_get_msg"))) TS_LDKErrorAction_DisconnectPeer_get_msg(uint64_t ptr) {
4086         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4087         assert(obj->tag == LDKErrorAction_DisconnectPeer);
4088         LDKErrorMessage msg_var = obj->disconnect_peer.msg;
4089                         uint64_t msg_ref = 0;
4090                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4091                         msg_ref = tag_ptr(msg_var.inner, false);
4092         return msg_ref;
4093 }
4094 uint64_t __attribute__((export_name("TS_LDKErrorAction_DisconnectPeerWithWarning_get_msg"))) TS_LDKErrorAction_DisconnectPeerWithWarning_get_msg(uint64_t ptr) {
4095         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4096         assert(obj->tag == LDKErrorAction_DisconnectPeerWithWarning);
4097         LDKWarningMessage msg_var = obj->disconnect_peer_with_warning.msg;
4098                         uint64_t msg_ref = 0;
4099                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4100                         msg_ref = tag_ptr(msg_var.inner, false);
4101         return msg_ref;
4102 }
4103 uint32_t __attribute__((export_name("TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log"))) TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log(uint64_t ptr) {
4104         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4105         assert(obj->tag == LDKErrorAction_IgnoreAndLog);
4106         uint32_t ignore_and_log_conv = LDKLevel_to_js(obj->ignore_and_log);
4107         return ignore_and_log_conv;
4108 }
4109 uint64_t __attribute__((export_name("TS_LDKErrorAction_SendErrorMessage_get_msg"))) TS_LDKErrorAction_SendErrorMessage_get_msg(uint64_t ptr) {
4110         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4111         assert(obj->tag == LDKErrorAction_SendErrorMessage);
4112         LDKErrorMessage msg_var = obj->send_error_message.msg;
4113                         uint64_t msg_ref = 0;
4114                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4115                         msg_ref = tag_ptr(msg_var.inner, false);
4116         return msg_ref;
4117 }
4118 uint64_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_msg"))) TS_LDKErrorAction_SendWarningMessage_get_msg(uint64_t ptr) {
4119         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4120         assert(obj->tag == LDKErrorAction_SendWarningMessage);
4121         LDKWarningMessage msg_var = obj->send_warning_message.msg;
4122                         uint64_t msg_ref = 0;
4123                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4124                         msg_ref = tag_ptr(msg_var.inner, false);
4125         return msg_ref;
4126 }
4127 uint32_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_log_level"))) TS_LDKErrorAction_SendWarningMessage_get_log_level(uint64_t ptr) {
4128         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4129         assert(obj->tag == LDKErrorAction_SendWarningMessage);
4130         uint32_t log_level_conv = LDKLevel_to_js(obj->send_warning_message.log_level);
4131         return log_level_conv;
4132 }
4133 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_ty_from_ptr"))) TS_LDKMessageSendEvent_ty_from_ptr(uint64_t ptr) {
4134         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4135         switch(obj->tag) {
4136                 case LDKMessageSendEvent_SendAcceptChannel: return 0;
4137                 case LDKMessageSendEvent_SendAcceptChannelV2: return 1;
4138                 case LDKMessageSendEvent_SendOpenChannel: return 2;
4139                 case LDKMessageSendEvent_SendOpenChannelV2: return 3;
4140                 case LDKMessageSendEvent_SendFundingCreated: return 4;
4141                 case LDKMessageSendEvent_SendFundingSigned: return 5;
4142                 case LDKMessageSendEvent_SendStfu: return 6;
4143                 case LDKMessageSendEvent_SendSplice: return 7;
4144                 case LDKMessageSendEvent_SendSpliceAck: return 8;
4145                 case LDKMessageSendEvent_SendSpliceLocked: return 9;
4146                 case LDKMessageSendEvent_SendTxAddInput: return 10;
4147                 case LDKMessageSendEvent_SendTxAddOutput: return 11;
4148                 case LDKMessageSendEvent_SendTxRemoveInput: return 12;
4149                 case LDKMessageSendEvent_SendTxRemoveOutput: return 13;
4150                 case LDKMessageSendEvent_SendTxComplete: return 14;
4151                 case LDKMessageSendEvent_SendTxSignatures: return 15;
4152                 case LDKMessageSendEvent_SendTxInitRbf: return 16;
4153                 case LDKMessageSendEvent_SendTxAckRbf: return 17;
4154                 case LDKMessageSendEvent_SendTxAbort: return 18;
4155                 case LDKMessageSendEvent_SendChannelReady: return 19;
4156                 case LDKMessageSendEvent_SendAnnouncementSignatures: return 20;
4157                 case LDKMessageSendEvent_UpdateHTLCs: return 21;
4158                 case LDKMessageSendEvent_SendRevokeAndACK: return 22;
4159                 case LDKMessageSendEvent_SendClosingSigned: return 23;
4160                 case LDKMessageSendEvent_SendShutdown: return 24;
4161                 case LDKMessageSendEvent_SendChannelReestablish: return 25;
4162                 case LDKMessageSendEvent_SendChannelAnnouncement: return 26;
4163                 case LDKMessageSendEvent_BroadcastChannelAnnouncement: return 27;
4164                 case LDKMessageSendEvent_BroadcastChannelUpdate: return 28;
4165                 case LDKMessageSendEvent_BroadcastNodeAnnouncement: return 29;
4166                 case LDKMessageSendEvent_SendChannelUpdate: return 30;
4167                 case LDKMessageSendEvent_HandleError: return 31;
4168                 case LDKMessageSendEvent_SendChannelRangeQuery: return 32;
4169                 case LDKMessageSendEvent_SendShortIdsQuery: return 33;
4170                 case LDKMessageSendEvent_SendReplyChannelRange: return 34;
4171                 case LDKMessageSendEvent_SendGossipTimestampFilter: return 35;
4172                 default: abort();
4173         }
4174 }
4175 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id(uint64_t ptr) {
4176         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4177         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
4178         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4179         memcpy(node_id_arr->elems, obj->send_accept_channel.node_id.compressed_form, 33);
4180         return node_id_arr;
4181 }
4182 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_msg"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_msg(uint64_t ptr) {
4183         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4184         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
4185         LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
4186                         uint64_t msg_ref = 0;
4187                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4188                         msg_ref = tag_ptr(msg_var.inner, false);
4189         return msg_ref;
4190 }
4191 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannelV2_get_node_id"))) TS_LDKMessageSendEvent_SendAcceptChannelV2_get_node_id(uint64_t ptr) {
4192         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4193         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannelV2);
4194         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4195         memcpy(node_id_arr->elems, obj->send_accept_channel_v2.node_id.compressed_form, 33);
4196         return node_id_arr;
4197 }
4198 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannelV2_get_msg"))) TS_LDKMessageSendEvent_SendAcceptChannelV2_get_msg(uint64_t ptr) {
4199         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4200         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannelV2);
4201         LDKAcceptChannelV2 msg_var = obj->send_accept_channel_v2.msg;
4202                         uint64_t msg_ref = 0;
4203                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4204                         msg_ref = tag_ptr(msg_var.inner, false);
4205         return msg_ref;
4206 }
4207 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_node_id"))) TS_LDKMessageSendEvent_SendOpenChannel_get_node_id(uint64_t ptr) {
4208         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4209         assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
4210         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4211         memcpy(node_id_arr->elems, obj->send_open_channel.node_id.compressed_form, 33);
4212         return node_id_arr;
4213 }
4214 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_msg"))) TS_LDKMessageSendEvent_SendOpenChannel_get_msg(uint64_t ptr) {
4215         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4216         assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
4217         LDKOpenChannel msg_var = obj->send_open_channel.msg;
4218                         uint64_t msg_ref = 0;
4219                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4220                         msg_ref = tag_ptr(msg_var.inner, false);
4221         return msg_ref;
4222 }
4223 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannelV2_get_node_id"))) TS_LDKMessageSendEvent_SendOpenChannelV2_get_node_id(uint64_t ptr) {
4224         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4225         assert(obj->tag == LDKMessageSendEvent_SendOpenChannelV2);
4226         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4227         memcpy(node_id_arr->elems, obj->send_open_channel_v2.node_id.compressed_form, 33);
4228         return node_id_arr;
4229 }
4230 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannelV2_get_msg"))) TS_LDKMessageSendEvent_SendOpenChannelV2_get_msg(uint64_t ptr) {
4231         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4232         assert(obj->tag == LDKMessageSendEvent_SendOpenChannelV2);
4233         LDKOpenChannelV2 msg_var = obj->send_open_channel_v2.msg;
4234                         uint64_t msg_ref = 0;
4235                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4236                         msg_ref = tag_ptr(msg_var.inner, false);
4237         return msg_ref;
4238 }
4239 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_node_id"))) TS_LDKMessageSendEvent_SendFundingCreated_get_node_id(uint64_t ptr) {
4240         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4241         assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
4242         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4243         memcpy(node_id_arr->elems, obj->send_funding_created.node_id.compressed_form, 33);
4244         return node_id_arr;
4245 }
4246 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_msg"))) TS_LDKMessageSendEvent_SendFundingCreated_get_msg(uint64_t ptr) {
4247         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4248         assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
4249         LDKFundingCreated msg_var = obj->send_funding_created.msg;
4250                         uint64_t msg_ref = 0;
4251                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4252                         msg_ref = tag_ptr(msg_var.inner, false);
4253         return msg_ref;
4254 }
4255 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendFundingSigned_get_node_id(uint64_t ptr) {
4256         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4257         assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
4258         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4259         memcpy(node_id_arr->elems, obj->send_funding_signed.node_id.compressed_form, 33);
4260         return node_id_arr;
4261 }
4262 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_msg"))) TS_LDKMessageSendEvent_SendFundingSigned_get_msg(uint64_t ptr) {
4263         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4264         assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
4265         LDKFundingSigned msg_var = obj->send_funding_signed.msg;
4266                         uint64_t msg_ref = 0;
4267                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4268                         msg_ref = tag_ptr(msg_var.inner, false);
4269         return msg_ref;
4270 }
4271 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendStfu_get_node_id"))) TS_LDKMessageSendEvent_SendStfu_get_node_id(uint64_t ptr) {
4272         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4273         assert(obj->tag == LDKMessageSendEvent_SendStfu);
4274         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4275         memcpy(node_id_arr->elems, obj->send_stfu.node_id.compressed_form, 33);
4276         return node_id_arr;
4277 }
4278 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendStfu_get_msg"))) TS_LDKMessageSendEvent_SendStfu_get_msg(uint64_t ptr) {
4279         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4280         assert(obj->tag == LDKMessageSendEvent_SendStfu);
4281         LDKStfu msg_var = obj->send_stfu.msg;
4282                         uint64_t msg_ref = 0;
4283                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4284                         msg_ref = tag_ptr(msg_var.inner, false);
4285         return msg_ref;
4286 }
4287 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendSplice_get_node_id"))) TS_LDKMessageSendEvent_SendSplice_get_node_id(uint64_t ptr) {
4288         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4289         assert(obj->tag == LDKMessageSendEvent_SendSplice);
4290         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4291         memcpy(node_id_arr->elems, obj->send_splice.node_id.compressed_form, 33);
4292         return node_id_arr;
4293 }
4294 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendSplice_get_msg"))) TS_LDKMessageSendEvent_SendSplice_get_msg(uint64_t ptr) {
4295         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4296         assert(obj->tag == LDKMessageSendEvent_SendSplice);
4297         LDKSplice msg_var = obj->send_splice.msg;
4298                         uint64_t msg_ref = 0;
4299                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4300                         msg_ref = tag_ptr(msg_var.inner, false);
4301         return msg_ref;
4302 }
4303 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendSpliceAck_get_node_id"))) TS_LDKMessageSendEvent_SendSpliceAck_get_node_id(uint64_t ptr) {
4304         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4305         assert(obj->tag == LDKMessageSendEvent_SendSpliceAck);
4306         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4307         memcpy(node_id_arr->elems, obj->send_splice_ack.node_id.compressed_form, 33);
4308         return node_id_arr;
4309 }
4310 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendSpliceAck_get_msg"))) TS_LDKMessageSendEvent_SendSpliceAck_get_msg(uint64_t ptr) {
4311         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4312         assert(obj->tag == LDKMessageSendEvent_SendSpliceAck);
4313         LDKSpliceAck msg_var = obj->send_splice_ack.msg;
4314                         uint64_t msg_ref = 0;
4315                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4316                         msg_ref = tag_ptr(msg_var.inner, false);
4317         return msg_ref;
4318 }
4319 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendSpliceLocked_get_node_id"))) TS_LDKMessageSendEvent_SendSpliceLocked_get_node_id(uint64_t ptr) {
4320         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4321         assert(obj->tag == LDKMessageSendEvent_SendSpliceLocked);
4322         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4323         memcpy(node_id_arr->elems, obj->send_splice_locked.node_id.compressed_form, 33);
4324         return node_id_arr;
4325 }
4326 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendSpliceLocked_get_msg"))) TS_LDKMessageSendEvent_SendSpliceLocked_get_msg(uint64_t ptr) {
4327         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4328         assert(obj->tag == LDKMessageSendEvent_SendSpliceLocked);
4329         LDKSpliceLocked msg_var = obj->send_splice_locked.msg;
4330                         uint64_t msg_ref = 0;
4331                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4332                         msg_ref = tag_ptr(msg_var.inner, false);
4333         return msg_ref;
4334 }
4335 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAddInput_get_node_id"))) TS_LDKMessageSendEvent_SendTxAddInput_get_node_id(uint64_t ptr) {
4336         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4337         assert(obj->tag == LDKMessageSendEvent_SendTxAddInput);
4338         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4339         memcpy(node_id_arr->elems, obj->send_tx_add_input.node_id.compressed_form, 33);
4340         return node_id_arr;
4341 }
4342 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAddInput_get_msg"))) TS_LDKMessageSendEvent_SendTxAddInput_get_msg(uint64_t ptr) {
4343         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4344         assert(obj->tag == LDKMessageSendEvent_SendTxAddInput);
4345         LDKTxAddInput msg_var = obj->send_tx_add_input.msg;
4346                         uint64_t msg_ref = 0;
4347                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4348                         msg_ref = tag_ptr(msg_var.inner, false);
4349         return msg_ref;
4350 }
4351 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAddOutput_get_node_id"))) TS_LDKMessageSendEvent_SendTxAddOutput_get_node_id(uint64_t ptr) {
4352         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4353         assert(obj->tag == LDKMessageSendEvent_SendTxAddOutput);
4354         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4355         memcpy(node_id_arr->elems, obj->send_tx_add_output.node_id.compressed_form, 33);
4356         return node_id_arr;
4357 }
4358 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAddOutput_get_msg"))) TS_LDKMessageSendEvent_SendTxAddOutput_get_msg(uint64_t ptr) {
4359         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4360         assert(obj->tag == LDKMessageSendEvent_SendTxAddOutput);
4361         LDKTxAddOutput msg_var = obj->send_tx_add_output.msg;
4362                         uint64_t msg_ref = 0;
4363                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4364                         msg_ref = tag_ptr(msg_var.inner, false);
4365         return msg_ref;
4366 }
4367 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxRemoveInput_get_node_id"))) TS_LDKMessageSendEvent_SendTxRemoveInput_get_node_id(uint64_t ptr) {
4368         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4369         assert(obj->tag == LDKMessageSendEvent_SendTxRemoveInput);
4370         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4371         memcpy(node_id_arr->elems, obj->send_tx_remove_input.node_id.compressed_form, 33);
4372         return node_id_arr;
4373 }
4374 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxRemoveInput_get_msg"))) TS_LDKMessageSendEvent_SendTxRemoveInput_get_msg(uint64_t ptr) {
4375         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4376         assert(obj->tag == LDKMessageSendEvent_SendTxRemoveInput);
4377         LDKTxRemoveInput msg_var = obj->send_tx_remove_input.msg;
4378                         uint64_t msg_ref = 0;
4379                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4380                         msg_ref = tag_ptr(msg_var.inner, false);
4381         return msg_ref;
4382 }
4383 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxRemoveOutput_get_node_id"))) TS_LDKMessageSendEvent_SendTxRemoveOutput_get_node_id(uint64_t ptr) {
4384         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4385         assert(obj->tag == LDKMessageSendEvent_SendTxRemoveOutput);
4386         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4387         memcpy(node_id_arr->elems, obj->send_tx_remove_output.node_id.compressed_form, 33);
4388         return node_id_arr;
4389 }
4390 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxRemoveOutput_get_msg"))) TS_LDKMessageSendEvent_SendTxRemoveOutput_get_msg(uint64_t ptr) {
4391         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4392         assert(obj->tag == LDKMessageSendEvent_SendTxRemoveOutput);
4393         LDKTxRemoveOutput msg_var = obj->send_tx_remove_output.msg;
4394                         uint64_t msg_ref = 0;
4395                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4396                         msg_ref = tag_ptr(msg_var.inner, false);
4397         return msg_ref;
4398 }
4399 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxComplete_get_node_id"))) TS_LDKMessageSendEvent_SendTxComplete_get_node_id(uint64_t ptr) {
4400         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4401         assert(obj->tag == LDKMessageSendEvent_SendTxComplete);
4402         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4403         memcpy(node_id_arr->elems, obj->send_tx_complete.node_id.compressed_form, 33);
4404         return node_id_arr;
4405 }
4406 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxComplete_get_msg"))) TS_LDKMessageSendEvent_SendTxComplete_get_msg(uint64_t ptr) {
4407         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4408         assert(obj->tag == LDKMessageSendEvent_SendTxComplete);
4409         LDKTxComplete msg_var = obj->send_tx_complete.msg;
4410                         uint64_t msg_ref = 0;
4411                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4412                         msg_ref = tag_ptr(msg_var.inner, false);
4413         return msg_ref;
4414 }
4415 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxSignatures_get_node_id"))) TS_LDKMessageSendEvent_SendTxSignatures_get_node_id(uint64_t ptr) {
4416         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4417         assert(obj->tag == LDKMessageSendEvent_SendTxSignatures);
4418         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4419         memcpy(node_id_arr->elems, obj->send_tx_signatures.node_id.compressed_form, 33);
4420         return node_id_arr;
4421 }
4422 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxSignatures_get_msg"))) TS_LDKMessageSendEvent_SendTxSignatures_get_msg(uint64_t ptr) {
4423         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4424         assert(obj->tag == LDKMessageSendEvent_SendTxSignatures);
4425         LDKTxSignatures msg_var = obj->send_tx_signatures.msg;
4426                         uint64_t msg_ref = 0;
4427                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4428                         msg_ref = tag_ptr(msg_var.inner, false);
4429         return msg_ref;
4430 }
4431 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxInitRbf_get_node_id"))) TS_LDKMessageSendEvent_SendTxInitRbf_get_node_id(uint64_t ptr) {
4432         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4433         assert(obj->tag == LDKMessageSendEvent_SendTxInitRbf);
4434         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4435         memcpy(node_id_arr->elems, obj->send_tx_init_rbf.node_id.compressed_form, 33);
4436         return node_id_arr;
4437 }
4438 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxInitRbf_get_msg"))) TS_LDKMessageSendEvent_SendTxInitRbf_get_msg(uint64_t ptr) {
4439         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4440         assert(obj->tag == LDKMessageSendEvent_SendTxInitRbf);
4441         LDKTxInitRbf msg_var = obj->send_tx_init_rbf.msg;
4442                         uint64_t msg_ref = 0;
4443                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4444                         msg_ref = tag_ptr(msg_var.inner, false);
4445         return msg_ref;
4446 }
4447 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAckRbf_get_node_id"))) TS_LDKMessageSendEvent_SendTxAckRbf_get_node_id(uint64_t ptr) {
4448         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4449         assert(obj->tag == LDKMessageSendEvent_SendTxAckRbf);
4450         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4451         memcpy(node_id_arr->elems, obj->send_tx_ack_rbf.node_id.compressed_form, 33);
4452         return node_id_arr;
4453 }
4454 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAckRbf_get_msg"))) TS_LDKMessageSendEvent_SendTxAckRbf_get_msg(uint64_t ptr) {
4455         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4456         assert(obj->tag == LDKMessageSendEvent_SendTxAckRbf);
4457         LDKTxAckRbf msg_var = obj->send_tx_ack_rbf.msg;
4458                         uint64_t msg_ref = 0;
4459                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4460                         msg_ref = tag_ptr(msg_var.inner, false);
4461         return msg_ref;
4462 }
4463 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAbort_get_node_id"))) TS_LDKMessageSendEvent_SendTxAbort_get_node_id(uint64_t ptr) {
4464         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4465         assert(obj->tag == LDKMessageSendEvent_SendTxAbort);
4466         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4467         memcpy(node_id_arr->elems, obj->send_tx_abort.node_id.compressed_form, 33);
4468         return node_id_arr;
4469 }
4470 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAbort_get_msg"))) TS_LDKMessageSendEvent_SendTxAbort_get_msg(uint64_t ptr) {
4471         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4472         assert(obj->tag == LDKMessageSendEvent_SendTxAbort);
4473         LDKTxAbort msg_var = obj->send_tx_abort.msg;
4474                         uint64_t msg_ref = 0;
4475                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4476                         msg_ref = tag_ptr(msg_var.inner, false);
4477         return msg_ref;
4478 }
4479 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReady_get_node_id(uint64_t ptr) {
4480         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4481         assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
4482         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4483         memcpy(node_id_arr->elems, obj->send_channel_ready.node_id.compressed_form, 33);
4484         return node_id_arr;
4485 }
4486 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_msg"))) TS_LDKMessageSendEvent_SendChannelReady_get_msg(uint64_t ptr) {
4487         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4488         assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
4489         LDKChannelReady msg_var = obj->send_channel_ready.msg;
4490                         uint64_t msg_ref = 0;
4491                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4492                         msg_ref = tag_ptr(msg_var.inner, false);
4493         return msg_ref;
4494 }
4495 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id(uint64_t ptr) {
4496         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4497         assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
4498         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4499         memcpy(node_id_arr->elems, obj->send_announcement_signatures.node_id.compressed_form, 33);
4500         return node_id_arr;
4501 }
4502 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg(uint64_t ptr) {
4503         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4504         assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
4505         LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
4506                         uint64_t msg_ref = 0;
4507                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4508                         msg_ref = tag_ptr(msg_var.inner, false);
4509         return msg_ref;
4510 }
4511 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id(uint64_t ptr) {
4512         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4513         assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
4514         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4515         memcpy(node_id_arr->elems, obj->update_htl_cs.node_id.compressed_form, 33);
4516         return node_id_arr;
4517 }
4518 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_updates"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_updates(uint64_t ptr) {
4519         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4520         assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
4521         LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
4522                         uint64_t updates_ref = 0;
4523                         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
4524                         updates_ref = tag_ptr(updates_var.inner, false);
4525         return updates_ref;
4526 }
4527 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id(uint64_t ptr) {
4528         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4529         assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
4530         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4531         memcpy(node_id_arr->elems, obj->send_revoke_and_ack.node_id.compressed_form, 33);
4532         return node_id_arr;
4533 }
4534 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg(uint64_t ptr) {
4535         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4536         assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
4537         LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
4538                         uint64_t msg_ref = 0;
4539                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4540                         msg_ref = tag_ptr(msg_var.inner, false);
4541         return msg_ref;
4542 }
4543 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendClosingSigned_get_node_id(uint64_t ptr) {
4544         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4545         assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
4546         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4547         memcpy(node_id_arr->elems, obj->send_closing_signed.node_id.compressed_form, 33);
4548         return node_id_arr;
4549 }
4550 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_msg"))) TS_LDKMessageSendEvent_SendClosingSigned_get_msg(uint64_t ptr) {
4551         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4552         assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
4553         LDKClosingSigned msg_var = obj->send_closing_signed.msg;
4554                         uint64_t msg_ref = 0;
4555                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4556                         msg_ref = tag_ptr(msg_var.inner, false);
4557         return msg_ref;
4558 }
4559 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_node_id"))) TS_LDKMessageSendEvent_SendShutdown_get_node_id(uint64_t ptr) {
4560         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4561         assert(obj->tag == LDKMessageSendEvent_SendShutdown);
4562         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4563         memcpy(node_id_arr->elems, obj->send_shutdown.node_id.compressed_form, 33);
4564         return node_id_arr;
4565 }
4566 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_msg"))) TS_LDKMessageSendEvent_SendShutdown_get_msg(uint64_t ptr) {
4567         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4568         assert(obj->tag == LDKMessageSendEvent_SendShutdown);
4569         LDKShutdown msg_var = obj->send_shutdown.msg;
4570                         uint64_t msg_ref = 0;
4571                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4572                         msg_ref = tag_ptr(msg_var.inner, false);
4573         return msg_ref;
4574 }
4575 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id(uint64_t ptr) {
4576         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4577         assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
4578         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4579         memcpy(node_id_arr->elems, obj->send_channel_reestablish.node_id.compressed_form, 33);
4580         return node_id_arr;
4581 }
4582 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_msg"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_msg(uint64_t ptr) {
4583         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4584         assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
4585         LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
4586                         uint64_t msg_ref = 0;
4587                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4588                         msg_ref = tag_ptr(msg_var.inner, false);
4589         return msg_ref;
4590 }
4591 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_node_id"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_node_id(uint64_t ptr) {
4592         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4593         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
4594         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4595         memcpy(node_id_arr->elems, obj->send_channel_announcement.node_id.compressed_form, 33);
4596         return node_id_arr;
4597 }
4598 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_msg"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_msg(uint64_t ptr) {
4599         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4600         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
4601         LDKChannelAnnouncement msg_var = obj->send_channel_announcement.msg;
4602                         uint64_t msg_ref = 0;
4603                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4604                         msg_ref = tag_ptr(msg_var.inner, false);
4605         return msg_ref;
4606 }
4607 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_update_msg"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_update_msg(uint64_t ptr) {
4608         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4609         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
4610         LDKChannelUpdate update_msg_var = obj->send_channel_announcement.update_msg;
4611                         uint64_t update_msg_ref = 0;
4612                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
4613                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
4614         return update_msg_ref;
4615 }
4616 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg(uint64_t ptr) {
4617         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4618         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
4619         LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
4620                         uint64_t msg_ref = 0;
4621                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4622                         msg_ref = tag_ptr(msg_var.inner, false);
4623         return msg_ref;
4624 }
4625 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg(uint64_t ptr) {
4626         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4627         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
4628         LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
4629                         uint64_t update_msg_ref = 0;
4630                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
4631                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
4632         return update_msg_ref;
4633 }
4634 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg(uint64_t ptr) {
4635         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4636         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelUpdate);
4637         LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
4638                         uint64_t msg_ref = 0;
4639                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4640                         msg_ref = tag_ptr(msg_var.inner, false);
4641         return msg_ref;
4642 }
4643 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg(uint64_t ptr) {
4644         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4645         assert(obj->tag == LDKMessageSendEvent_BroadcastNodeAnnouncement);
4646         LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
4647                         uint64_t msg_ref = 0;
4648                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4649                         msg_ref = tag_ptr(msg_var.inner, false);
4650         return msg_ref;
4651 }
4652 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id(uint64_t ptr) {
4653         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4654         assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
4655         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4656         memcpy(node_id_arr->elems, obj->send_channel_update.node_id.compressed_form, 33);
4657         return node_id_arr;
4658 }
4659 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_msg(uint64_t ptr) {
4660         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4661         assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
4662         LDKChannelUpdate msg_var = obj->send_channel_update.msg;
4663                         uint64_t msg_ref = 0;
4664                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4665                         msg_ref = tag_ptr(msg_var.inner, false);
4666         return msg_ref;
4667 }
4668 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_node_id"))) TS_LDKMessageSendEvent_HandleError_get_node_id(uint64_t ptr) {
4669         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4670         assert(obj->tag == LDKMessageSendEvent_HandleError);
4671         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4672         memcpy(node_id_arr->elems, obj->handle_error.node_id.compressed_form, 33);
4673         return node_id_arr;
4674 }
4675 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_action"))) TS_LDKMessageSendEvent_HandleError_get_action(uint64_t ptr) {
4676         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4677         assert(obj->tag == LDKMessageSendEvent_HandleError);
4678         uint64_t action_ref = tag_ptr(&obj->handle_error.action, false);
4679         return action_ref;
4680 }
4681 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id(uint64_t ptr) {
4682         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4683         assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
4684         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4685         memcpy(node_id_arr->elems, obj->send_channel_range_query.node_id.compressed_form, 33);
4686         return node_id_arr;
4687 }
4688 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg(uint64_t ptr) {
4689         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4690         assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
4691         LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
4692                         uint64_t msg_ref = 0;
4693                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4694                         msg_ref = tag_ptr(msg_var.inner, false);
4695         return msg_ref;
4696 }
4697 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id(uint64_t ptr) {
4698         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4699         assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
4700         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4701         memcpy(node_id_arr->elems, obj->send_short_ids_query.node_id.compressed_form, 33);
4702         return node_id_arr;
4703 }
4704 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg(uint64_t ptr) {
4705         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4706         assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
4707         LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
4708                         uint64_t msg_ref = 0;
4709                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4710                         msg_ref = tag_ptr(msg_var.inner, false);
4711         return msg_ref;
4712 }
4713 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id(uint64_t ptr) {
4714         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4715         assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
4716         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4717         memcpy(node_id_arr->elems, obj->send_reply_channel_range.node_id.compressed_form, 33);
4718         return node_id_arr;
4719 }
4720 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg(uint64_t ptr) {
4721         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4722         assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
4723         LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
4724                         uint64_t msg_ref = 0;
4725                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4726                         msg_ref = tag_ptr(msg_var.inner, false);
4727         return msg_ref;
4728 }
4729 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id(uint64_t ptr) {
4730         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4731         assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
4732         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4733         memcpy(node_id_arr->elems, obj->send_gossip_timestamp_filter.node_id.compressed_form, 33);
4734         return node_id_arr;
4735 }
4736 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg(uint64_t ptr) {
4737         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4738         assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
4739         LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg;
4740                         uint64_t msg_ref = 0;
4741                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4742                         msg_ref = tag_ptr(msg_var.inner, false);
4743         return msg_ref;
4744 }
4745 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
4746         LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
4747         for (size_t i = 0; i < ret.datalen; i++) {
4748                 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
4749         }
4750         return ret;
4751 }
4752 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
4753         LDKChannelUpdateInfo ret = *owner->contents.result;
4754         ret.is_owned = false;
4755         return ret;
4756 }
4757 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(uint64_t owner) {
4758         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
4759         LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
4760         uint64_t ret_ref = 0;
4761         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4762         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4763         return ret_ref;
4764 }
4765
4766 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
4767 CHECK(!owner->result_ok);
4768         return DecodeError_clone(&*owner->contents.err);
4769 }
4770 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err(uint64_t owner) {
4771         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
4772         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4773         *ret_copy = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
4774         uint64_t ret_ref = tag_ptr(ret_copy, true);
4775         return ret_ref;
4776 }
4777
4778 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
4779         LDKChannelInfo ret = *owner->contents.result;
4780         ret.is_owned = false;
4781         return ret;
4782 }
4783 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_get_ok(uint64_t owner) {
4784         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
4785         LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
4786         uint64_t ret_ref = 0;
4787         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4788         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4789         return ret_ref;
4790 }
4791
4792 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
4793 CHECK(!owner->result_ok);
4794         return DecodeError_clone(&*owner->contents.err);
4795 }
4796 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelInfoDecodeErrorZ_get_err(uint64_t owner) {
4797         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
4798         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4799         *ret_copy = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
4800         uint64_t ret_ref = tag_ptr(ret_copy, true);
4801         return ret_ref;
4802 }
4803
4804 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
4805         LDKRoutingFees ret = *owner->contents.result;
4806         ret.is_owned = false;
4807         return ret;
4808 }
4809 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_get_ok(uint64_t owner) {
4810         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
4811         LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
4812         uint64_t ret_ref = 0;
4813         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4814         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4815         return ret_ref;
4816 }
4817
4818 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
4819 CHECK(!owner->result_ok);
4820         return DecodeError_clone(&*owner->contents.err);
4821 }
4822 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_err"))) TS_CResult_RoutingFeesDecodeErrorZ_get_err(uint64_t owner) {
4823         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
4824         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4825         *ret_copy = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
4826         uint64_t ret_ref = tag_ptr(ret_copy, true);
4827         return ret_ref;
4828 }
4829
4830 uint32_t __attribute__((export_name("TS_LDKSocketAddress_ty_from_ptr"))) TS_LDKSocketAddress_ty_from_ptr(uint64_t ptr) {
4831         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4832         switch(obj->tag) {
4833                 case LDKSocketAddress_TcpIpV4: return 0;
4834                 case LDKSocketAddress_TcpIpV6: return 1;
4835                 case LDKSocketAddress_OnionV2: return 2;
4836                 case LDKSocketAddress_OnionV3: return 3;
4837                 case LDKSocketAddress_Hostname: return 4;
4838                 default: abort();
4839         }
4840 }
4841 int8_tArray __attribute__((export_name("TS_LDKSocketAddress_TcpIpV4_get_addr"))) TS_LDKSocketAddress_TcpIpV4_get_addr(uint64_t ptr) {
4842         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4843         assert(obj->tag == LDKSocketAddress_TcpIpV4);
4844         int8_tArray addr_arr = init_int8_tArray(4, __LINE__);
4845         memcpy(addr_arr->elems, obj->tcp_ip_v4.addr.data, 4);
4846         return addr_arr;
4847 }
4848 int16_t __attribute__((export_name("TS_LDKSocketAddress_TcpIpV4_get_port"))) TS_LDKSocketAddress_TcpIpV4_get_port(uint64_t ptr) {
4849         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4850         assert(obj->tag == LDKSocketAddress_TcpIpV4);
4851         int16_t port_conv = obj->tcp_ip_v4.port;
4852         return port_conv;
4853 }
4854 int8_tArray __attribute__((export_name("TS_LDKSocketAddress_TcpIpV6_get_addr"))) TS_LDKSocketAddress_TcpIpV6_get_addr(uint64_t ptr) {
4855         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4856         assert(obj->tag == LDKSocketAddress_TcpIpV6);
4857         int8_tArray addr_arr = init_int8_tArray(16, __LINE__);
4858         memcpy(addr_arr->elems, obj->tcp_ip_v6.addr.data, 16);
4859         return addr_arr;
4860 }
4861 int16_t __attribute__((export_name("TS_LDKSocketAddress_TcpIpV6_get_port"))) TS_LDKSocketAddress_TcpIpV6_get_port(uint64_t ptr) {
4862         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4863         assert(obj->tag == LDKSocketAddress_TcpIpV6);
4864         int16_t port_conv = obj->tcp_ip_v6.port;
4865         return port_conv;
4866 }
4867 int8_tArray __attribute__((export_name("TS_LDKSocketAddress_OnionV2_get_onion_v2"))) TS_LDKSocketAddress_OnionV2_get_onion_v2(uint64_t ptr) {
4868         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4869         assert(obj->tag == LDKSocketAddress_OnionV2);
4870         int8_tArray onion_v2_arr = init_int8_tArray(12, __LINE__);
4871         memcpy(onion_v2_arr->elems, obj->onion_v2.data, 12);
4872         return onion_v2_arr;
4873 }
4874 int8_tArray __attribute__((export_name("TS_LDKSocketAddress_OnionV3_get_ed25519_pubkey"))) TS_LDKSocketAddress_OnionV3_get_ed25519_pubkey(uint64_t ptr) {
4875         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4876         assert(obj->tag == LDKSocketAddress_OnionV3);
4877         int8_tArray ed25519_pubkey_arr = init_int8_tArray(32, __LINE__);
4878         memcpy(ed25519_pubkey_arr->elems, obj->onion_v3.ed25519_pubkey.data, 32);
4879         return ed25519_pubkey_arr;
4880 }
4881 int16_t __attribute__((export_name("TS_LDKSocketAddress_OnionV3_get_checksum"))) TS_LDKSocketAddress_OnionV3_get_checksum(uint64_t ptr) {
4882         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4883         assert(obj->tag == LDKSocketAddress_OnionV3);
4884         int16_t checksum_conv = obj->onion_v3.checksum;
4885         return checksum_conv;
4886 }
4887 int8_t __attribute__((export_name("TS_LDKSocketAddress_OnionV3_get_version"))) TS_LDKSocketAddress_OnionV3_get_version(uint64_t ptr) {
4888         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4889         assert(obj->tag == LDKSocketAddress_OnionV3);
4890         int8_t version_conv = obj->onion_v3.version;
4891         return version_conv;
4892 }
4893 int16_t __attribute__((export_name("TS_LDKSocketAddress_OnionV3_get_port"))) TS_LDKSocketAddress_OnionV3_get_port(uint64_t ptr) {
4894         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4895         assert(obj->tag == LDKSocketAddress_OnionV3);
4896         int16_t port_conv = obj->onion_v3.port;
4897         return port_conv;
4898 }
4899 uint64_t __attribute__((export_name("TS_LDKSocketAddress_Hostname_get_hostname"))) TS_LDKSocketAddress_Hostname_get_hostname(uint64_t ptr) {
4900         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4901         assert(obj->tag == LDKSocketAddress_Hostname);
4902         LDKHostname hostname_var = obj->hostname.hostname;
4903                         uint64_t hostname_ref = 0;
4904                         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_var);
4905                         hostname_ref = tag_ptr(hostname_var.inner, false);
4906         return hostname_ref;
4907 }
4908 int16_t __attribute__((export_name("TS_LDKSocketAddress_Hostname_get_port"))) TS_LDKSocketAddress_Hostname_get_port(uint64_t ptr) {
4909         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4910         assert(obj->tag == LDKSocketAddress_Hostname);
4911         int16_t port_conv = obj->hostname.port;
4912         return port_conv;
4913 }
4914 static inline LDKCVec_SocketAddressZ CVec_SocketAddressZ_clone(const LDKCVec_SocketAddressZ *orig) {
4915         LDKCVec_SocketAddressZ ret = { .data = MALLOC(sizeof(LDKSocketAddress) * orig->datalen, "LDKCVec_SocketAddressZ clone bytes"), .datalen = orig->datalen };
4916         for (size_t i = 0; i < ret.datalen; i++) {
4917                 ret.data[i] = SocketAddress_clone(&orig->data[i]);
4918         }
4919         return ret;
4920 }
4921 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
4922         LDKNodeAnnouncementInfo ret = *owner->contents.result;
4923         ret.is_owned = false;
4924         return ret;
4925 }
4926 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint64_t owner) {
4927         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
4928         LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
4929         uint64_t ret_ref = 0;
4930         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4931         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4932         return ret_ref;
4933 }
4934
4935 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
4936 CHECK(!owner->result_ok);
4937         return DecodeError_clone(&*owner->contents.err);
4938 }
4939 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint64_t owner) {
4940         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
4941         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4942         *ret_copy = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
4943         uint64_t ret_ref = tag_ptr(ret_copy, true);
4944         return ret_ref;
4945 }
4946
4947 static inline struct LDKNodeAlias CResult_NodeAliasDecodeErrorZ_get_ok(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
4948         LDKNodeAlias ret = *owner->contents.result;
4949         ret.is_owned = false;
4950         return ret;
4951 }
4952 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_get_ok"))) TS_CResult_NodeAliasDecodeErrorZ_get_ok(uint64_t owner) {
4953         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
4954         LDKNodeAlias ret_var = CResult_NodeAliasDecodeErrorZ_get_ok(owner_conv);
4955         uint64_t ret_ref = 0;
4956         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4957         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4958         return ret_ref;
4959 }
4960
4961 static inline struct LDKDecodeError CResult_NodeAliasDecodeErrorZ_get_err(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
4962 CHECK(!owner->result_ok);
4963         return DecodeError_clone(&*owner->contents.err);
4964 }
4965 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_get_err"))) TS_CResult_NodeAliasDecodeErrorZ_get_err(uint64_t owner) {
4966         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
4967         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4968         *ret_copy = CResult_NodeAliasDecodeErrorZ_get_err(owner_conv);
4969         uint64_t ret_ref = tag_ptr(ret_copy, true);
4970         return ret_ref;
4971 }
4972
4973 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
4974         LDKNodeInfo ret = *owner->contents.result;
4975         ret.is_owned = false;
4976         return ret;
4977 }
4978 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeInfoDecodeErrorZ_get_ok(uint64_t owner) {
4979         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
4980         LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
4981         uint64_t ret_ref = 0;
4982         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4983         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4984         return ret_ref;
4985 }
4986
4987 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
4988 CHECK(!owner->result_ok);
4989         return DecodeError_clone(&*owner->contents.err);
4990 }
4991 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_err"))) TS_CResult_NodeInfoDecodeErrorZ_get_err(uint64_t owner) {
4992         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
4993         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4994         *ret_copy = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
4995         uint64_t ret_ref = tag_ptr(ret_copy, true);
4996         return ret_ref;
4997 }
4998
4999 static inline struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
5000         LDKNetworkGraph ret = *owner->contents.result;
5001         ret.is_owned = false;
5002         return ret;
5003 }
5004 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_get_ok(uint64_t owner) {
5005         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
5006         LDKNetworkGraph ret_var = CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
5007         uint64_t ret_ref = 0;
5008         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5009         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5010         return ret_ref;
5011 }
5012
5013 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
5014 CHECK(!owner->result_ok);
5015         return DecodeError_clone(&*owner->contents.err);
5016 }
5017 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_err"))) TS_CResult_NetworkGraphDecodeErrorZ_get_err(uint64_t owner) {
5018         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
5019         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5020         *ret_copy = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
5021         uint64_t ret_ref = tag_ptr(ret_copy, true);
5022         return ret_ref;
5023 }
5024
5025 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_SocketAddressZZ_ty_from_ptr"))) TS_LDKCOption_CVec_SocketAddressZZ_ty_from_ptr(uint64_t ptr) {
5026         LDKCOption_CVec_SocketAddressZZ *obj = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(ptr);
5027         switch(obj->tag) {
5028                 case LDKCOption_CVec_SocketAddressZZ_Some: return 0;
5029                 case LDKCOption_CVec_SocketAddressZZ_None: return 1;
5030                 default: abort();
5031         }
5032 }
5033 uint64_tArray __attribute__((export_name("TS_LDKCOption_CVec_SocketAddressZZ_Some_get_some"))) TS_LDKCOption_CVec_SocketAddressZZ_Some_get_some(uint64_t ptr) {
5034         LDKCOption_CVec_SocketAddressZZ *obj = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(ptr);
5035         assert(obj->tag == LDKCOption_CVec_SocketAddressZZ_Some);
5036         LDKCVec_SocketAddressZ some_var = obj->some;
5037                         uint64_tArray some_arr = NULL;
5038                         some_arr = init_uint64_tArray(some_var.datalen, __LINE__);
5039                         uint64_t *some_arr_ptr = (uint64_t*)(((uint8_t*)some_arr) + 8);
5040                         for (size_t p = 0; p < some_var.datalen; p++) {
5041                                 uint64_t some_conv_15_ref = tag_ptr(&some_var.data[p], false);
5042                                 some_arr_ptr[p] = some_conv_15_ref;
5043                         }
5044                         
5045         return some_arr;
5046 }
5047 static inline uint64_t CResult_u64ShortChannelIdErrorZ_get_ok(LDKCResult_u64ShortChannelIdErrorZ *NONNULL_PTR owner){
5048 CHECK(owner->result_ok);
5049         return *owner->contents.result;
5050 }
5051 int64_t  __attribute__((export_name("TS_CResult_u64ShortChannelIdErrorZ_get_ok"))) TS_CResult_u64ShortChannelIdErrorZ_get_ok(uint64_t owner) {
5052         LDKCResult_u64ShortChannelIdErrorZ* owner_conv = (LDKCResult_u64ShortChannelIdErrorZ*)untag_ptr(owner);
5053         int64_t ret_conv = CResult_u64ShortChannelIdErrorZ_get_ok(owner_conv);
5054         return ret_conv;
5055 }
5056
5057 static inline enum LDKShortChannelIdError CResult_u64ShortChannelIdErrorZ_get_err(LDKCResult_u64ShortChannelIdErrorZ *NONNULL_PTR owner){
5058 CHECK(!owner->result_ok);
5059         return ShortChannelIdError_clone(&*owner->contents.err);
5060 }
5061 uint32_t  __attribute__((export_name("TS_CResult_u64ShortChannelIdErrorZ_get_err"))) TS_CResult_u64ShortChannelIdErrorZ_get_err(uint64_t owner) {
5062         LDKCResult_u64ShortChannelIdErrorZ* owner_conv = (LDKCResult_u64ShortChannelIdErrorZ*)untag_ptr(owner);
5063         uint32_t ret_conv = LDKShortChannelIdError_to_js(CResult_u64ShortChannelIdErrorZ_get_err(owner_conv));
5064         return ret_conv;
5065 }
5066
5067 static inline struct LDKPendingHTLCInfo CResult_PendingHTLCInfoInboundHTLCErrZ_get_ok(LDKCResult_PendingHTLCInfoInboundHTLCErrZ *NONNULL_PTR owner){
5068         LDKPendingHTLCInfo ret = *owner->contents.result;
5069         ret.is_owned = false;
5070         return ret;
5071 }
5072 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoInboundHTLCErrZ_get_ok"))) TS_CResult_PendingHTLCInfoInboundHTLCErrZ_get_ok(uint64_t owner) {
5073         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* owner_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(owner);
5074         LDKPendingHTLCInfo ret_var = CResult_PendingHTLCInfoInboundHTLCErrZ_get_ok(owner_conv);
5075         uint64_t ret_ref = 0;
5076         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5077         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5078         return ret_ref;
5079 }
5080
5081 static inline struct LDKInboundHTLCErr CResult_PendingHTLCInfoInboundHTLCErrZ_get_err(LDKCResult_PendingHTLCInfoInboundHTLCErrZ *NONNULL_PTR owner){
5082         LDKInboundHTLCErr ret = *owner->contents.err;
5083         ret.is_owned = false;
5084         return ret;
5085 }
5086 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoInboundHTLCErrZ_get_err"))) TS_CResult_PendingHTLCInfoInboundHTLCErrZ_get_err(uint64_t owner) {
5087         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* owner_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(owner);
5088         LDKInboundHTLCErr ret_var = CResult_PendingHTLCInfoInboundHTLCErrZ_get_err(owner_conv);
5089         uint64_t ret_ref = 0;
5090         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5091         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5092         return ret_ref;
5093 }
5094
5095 static inline LDKCVec_HTLCOutputInCommitmentZ CVec_HTLCOutputInCommitmentZ_clone(const LDKCVec_HTLCOutputInCommitmentZ *orig) {
5096         LDKCVec_HTLCOutputInCommitmentZ ret = { .data = MALLOC(sizeof(LDKHTLCOutputInCommitment) * orig->datalen, "LDKCVec_HTLCOutputInCommitmentZ clone bytes"), .datalen = orig->datalen };
5097         for (size_t i = 0; i < ret.datalen; i++) {
5098                 ret.data[i] = HTLCOutputInCommitment_clone(&orig->data[i]);
5099         }
5100         return ret;
5101 }
5102 static inline LDKCVec_HTLCDescriptorZ CVec_HTLCDescriptorZ_clone(const LDKCVec_HTLCDescriptorZ *orig) {
5103         LDKCVec_HTLCDescriptorZ ret = { .data = MALLOC(sizeof(LDKHTLCDescriptor) * orig->datalen, "LDKCVec_HTLCDescriptorZ clone bytes"), .datalen = orig->datalen };
5104         for (size_t i = 0; i < ret.datalen; i++) {
5105                 ret.data[i] = HTLCDescriptor_clone(&orig->data[i]);
5106         }
5107         return ret;
5108 }
5109 static inline LDKCVec_UtxoZ CVec_UtxoZ_clone(const LDKCVec_UtxoZ *orig) {
5110         LDKCVec_UtxoZ ret = { .data = MALLOC(sizeof(LDKUtxo) * orig->datalen, "LDKCVec_UtxoZ clone bytes"), .datalen = orig->datalen };
5111         for (size_t i = 0; i < ret.datalen; i++) {
5112                 ret.data[i] = Utxo_clone(&orig->data[i]);
5113         }
5114         return ret;
5115 }
5116 uint32_t __attribute__((export_name("TS_LDKCOption_TxOutZ_ty_from_ptr"))) TS_LDKCOption_TxOutZ_ty_from_ptr(uint64_t ptr) {
5117         LDKCOption_TxOutZ *obj = (LDKCOption_TxOutZ*)untag_ptr(ptr);
5118         switch(obj->tag) {
5119                 case LDKCOption_TxOutZ_Some: return 0;
5120                 case LDKCOption_TxOutZ_None: return 1;
5121                 default: abort();
5122         }
5123 }
5124 uint64_t __attribute__((export_name("TS_LDKCOption_TxOutZ_Some_get_some"))) TS_LDKCOption_TxOutZ_Some_get_some(uint64_t ptr) {
5125         LDKCOption_TxOutZ *obj = (LDKCOption_TxOutZ*)untag_ptr(ptr);
5126         assert(obj->tag == LDKCOption_TxOutZ_Some);
5127         LDKTxOut* some_ref = &obj->some;
5128         return tag_ptr(some_ref, false);
5129 }
5130 static inline LDKCVec_InputZ CVec_InputZ_clone(const LDKCVec_InputZ *orig) {
5131         LDKCVec_InputZ ret = { .data = MALLOC(sizeof(LDKInput) * orig->datalen, "LDKCVec_InputZ clone bytes"), .datalen = orig->datalen };
5132         for (size_t i = 0; i < ret.datalen; i++) {
5133                 ret.data[i] = Input_clone(&orig->data[i]);
5134         }
5135         return ret;
5136 }
5137 static inline struct LDKCoinSelection CResult_CoinSelectionNoneZ_get_ok(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR owner){
5138         LDKCoinSelection ret = *owner->contents.result;
5139         ret.is_owned = false;
5140         return ret;
5141 }
5142 uint64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_get_ok"))) TS_CResult_CoinSelectionNoneZ_get_ok(uint64_t owner) {
5143         LDKCResult_CoinSelectionNoneZ* owner_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(owner);
5144         LDKCoinSelection ret_var = CResult_CoinSelectionNoneZ_get_ok(owner_conv);
5145         uint64_t ret_ref = 0;
5146         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5147         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5148         return ret_ref;
5149 }
5150
5151 static inline void CResult_CoinSelectionNoneZ_get_err(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR owner){
5152 CHECK(!owner->result_ok);
5153         return *owner->contents.err;
5154 }
5155 void  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_get_err"))) TS_CResult_CoinSelectionNoneZ_get_err(uint64_t owner) {
5156         LDKCResult_CoinSelectionNoneZ* owner_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(owner);
5157         CResult_CoinSelectionNoneZ_get_err(owner_conv);
5158 }
5159
5160 static inline struct LDKCVec_UtxoZ CResult_CVec_UtxoZNoneZ_get_ok(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR owner){
5161 CHECK(owner->result_ok);
5162         return CVec_UtxoZ_clone(&*owner->contents.result);
5163 }
5164 uint64_tArray  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_get_ok"))) TS_CResult_CVec_UtxoZNoneZ_get_ok(uint64_t owner) {
5165         LDKCResult_CVec_UtxoZNoneZ* owner_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(owner);
5166         LDKCVec_UtxoZ ret_var = CResult_CVec_UtxoZNoneZ_get_ok(owner_conv);
5167         uint64_tArray ret_arr = NULL;
5168         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
5169         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
5170         for (size_t g = 0; g < ret_var.datalen; g++) {
5171                 LDKUtxo ret_conv_6_var = ret_var.data[g];
5172                 uint64_t ret_conv_6_ref = 0;
5173                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
5174                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
5175                 ret_arr_ptr[g] = ret_conv_6_ref;
5176         }
5177         
5178         FREE(ret_var.data);
5179         return ret_arr;
5180 }
5181
5182 static inline void CResult_CVec_UtxoZNoneZ_get_err(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR owner){
5183 CHECK(!owner->result_ok);
5184         return *owner->contents.err;
5185 }
5186 void  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_get_err"))) TS_CResult_CVec_UtxoZNoneZ_get_err(uint64_t owner) {
5187         LDKCResult_CVec_UtxoZNoneZ* owner_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(owner);
5188         CResult_CVec_UtxoZNoneZ_get_err(owner_conv);
5189 }
5190
5191 uint32_t __attribute__((export_name("TS_LDKPaymentContext_ty_from_ptr"))) TS_LDKPaymentContext_ty_from_ptr(uint64_t ptr) {
5192         LDKPaymentContext *obj = (LDKPaymentContext*)untag_ptr(ptr);
5193         switch(obj->tag) {
5194                 case LDKPaymentContext_Unknown: return 0;
5195                 case LDKPaymentContext_Bolt12Offer: return 1;
5196                 case LDKPaymentContext_Bolt12Refund: return 2;
5197                 default: abort();
5198         }
5199 }
5200 uint64_t __attribute__((export_name("TS_LDKPaymentContext_Unknown_get_unknown"))) TS_LDKPaymentContext_Unknown_get_unknown(uint64_t ptr) {
5201         LDKPaymentContext *obj = (LDKPaymentContext*)untag_ptr(ptr);
5202         assert(obj->tag == LDKPaymentContext_Unknown);
5203         LDKUnknownPaymentContext unknown_var = obj->unknown;
5204                         uint64_t unknown_ref = 0;
5205                         CHECK_INNER_FIELD_ACCESS_OR_NULL(unknown_var);
5206                         unknown_ref = tag_ptr(unknown_var.inner, false);
5207         return unknown_ref;
5208 }
5209 uint64_t __attribute__((export_name("TS_LDKPaymentContext_Bolt12Offer_get_bolt12_offer"))) TS_LDKPaymentContext_Bolt12Offer_get_bolt12_offer(uint64_t ptr) {
5210         LDKPaymentContext *obj = (LDKPaymentContext*)untag_ptr(ptr);
5211         assert(obj->tag == LDKPaymentContext_Bolt12Offer);
5212         LDKBolt12OfferContext bolt12_offer_var = obj->bolt12_offer;
5213                         uint64_t bolt12_offer_ref = 0;
5214                         CHECK_INNER_FIELD_ACCESS_OR_NULL(bolt12_offer_var);
5215                         bolt12_offer_ref = tag_ptr(bolt12_offer_var.inner, false);
5216         return bolt12_offer_ref;
5217 }
5218 uint64_t __attribute__((export_name("TS_LDKPaymentContext_Bolt12Refund_get_bolt12_refund"))) TS_LDKPaymentContext_Bolt12Refund_get_bolt12_refund(uint64_t ptr) {
5219         LDKPaymentContext *obj = (LDKPaymentContext*)untag_ptr(ptr);
5220         assert(obj->tag == LDKPaymentContext_Bolt12Refund);
5221         LDKBolt12RefundContext bolt12_refund_var = obj->bolt12_refund;
5222                         uint64_t bolt12_refund_ref = 0;
5223                         CHECK_INNER_FIELD_ACCESS_OR_NULL(bolt12_refund_var);
5224                         bolt12_refund_ref = tag_ptr(bolt12_refund_var.inner, false);
5225         return bolt12_refund_ref;
5226 }
5227 uint32_t __attribute__((export_name("TS_LDKCOption_PaymentContextZ_ty_from_ptr"))) TS_LDKCOption_PaymentContextZ_ty_from_ptr(uint64_t ptr) {
5228         LDKCOption_PaymentContextZ *obj = (LDKCOption_PaymentContextZ*)untag_ptr(ptr);
5229         switch(obj->tag) {
5230                 case LDKCOption_PaymentContextZ_Some: return 0;
5231                 case LDKCOption_PaymentContextZ_None: return 1;
5232                 default: abort();
5233         }
5234 }
5235 uint64_t __attribute__((export_name("TS_LDKCOption_PaymentContextZ_Some_get_some"))) TS_LDKCOption_PaymentContextZ_Some_get_some(uint64_t ptr) {
5236         LDKCOption_PaymentContextZ *obj = (LDKCOption_PaymentContextZ*)untag_ptr(ptr);
5237         assert(obj->tag == LDKCOption_PaymentContextZ_Some);
5238         uint64_t some_ref = tag_ptr(&obj->some, false);
5239         return some_ref;
5240 }
5241 static inline uint64_t C2Tuple_u64u16Z_get_a(LDKC2Tuple_u64u16Z *NONNULL_PTR owner){
5242         return owner->a;
5243 }
5244 int64_t  __attribute__((export_name("TS_C2Tuple_u64u16Z_get_a"))) TS_C2Tuple_u64u16Z_get_a(uint64_t owner) {
5245         LDKC2Tuple_u64u16Z* owner_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(owner);
5246         int64_t ret_conv = C2Tuple_u64u16Z_get_a(owner_conv);
5247         return ret_conv;
5248 }
5249
5250 static inline uint16_t C2Tuple_u64u16Z_get_b(LDKC2Tuple_u64u16Z *NONNULL_PTR owner){
5251         return owner->b;
5252 }
5253 int16_t  __attribute__((export_name("TS_C2Tuple_u64u16Z_get_b"))) TS_C2Tuple_u64u16Z_get_b(uint64_t owner) {
5254         LDKC2Tuple_u64u16Z* owner_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(owner);
5255         int16_t ret_conv = C2Tuple_u64u16Z_get_b(owner_conv);
5256         return ret_conv;
5257 }
5258
5259 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u16ZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_u64u16ZZ_ty_from_ptr(uint64_t ptr) {
5260         LDKCOption_C2Tuple_u64u16ZZ *obj = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(ptr);
5261         switch(obj->tag) {
5262                 case LDKCOption_C2Tuple_u64u16ZZ_Some: return 0;
5263                 case LDKCOption_C2Tuple_u64u16ZZ_None: return 1;
5264                 default: abort();
5265         }
5266 }
5267 uint64_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u16ZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_u64u16ZZ_Some_get_some(uint64_t ptr) {
5268         LDKCOption_C2Tuple_u64u16ZZ *obj = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(ptr);
5269         assert(obj->tag == LDKCOption_C2Tuple_u64u16ZZ_Some);
5270         LDKC2Tuple_u64u16Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
5271         *some_conv = obj->some;
5272                         *some_conv = C2Tuple_u64u16Z_clone(some_conv);
5273         return tag_ptr(some_conv, true);
5274 }
5275 uint32_t __attribute__((export_name("TS_LDKCOption_ChannelShutdownStateZ_ty_from_ptr"))) TS_LDKCOption_ChannelShutdownStateZ_ty_from_ptr(uint64_t ptr) {
5276         LDKCOption_ChannelShutdownStateZ *obj = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(ptr);
5277         switch(obj->tag) {
5278                 case LDKCOption_ChannelShutdownStateZ_Some: return 0;
5279                 case LDKCOption_ChannelShutdownStateZ_None: return 1;
5280                 default: abort();
5281         }
5282 }
5283 uint32_t __attribute__((export_name("TS_LDKCOption_ChannelShutdownStateZ_Some_get_some"))) TS_LDKCOption_ChannelShutdownStateZ_Some_get_some(uint64_t ptr) {
5284         LDKCOption_ChannelShutdownStateZ *obj = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(ptr);
5285         assert(obj->tag == LDKCOption_ChannelShutdownStateZ_Some);
5286         uint32_t some_conv = LDKChannelShutdownState_to_js(obj->some);
5287         return some_conv;
5288 }
5289 static inline struct LDKChannelId CResult_ChannelIdAPIErrorZ_get_ok(LDKCResult_ChannelIdAPIErrorZ *NONNULL_PTR owner){
5290         LDKChannelId ret = *owner->contents.result;
5291         ret.is_owned = false;
5292         return ret;
5293 }
5294 uint64_t  __attribute__((export_name("TS_CResult_ChannelIdAPIErrorZ_get_ok"))) TS_CResult_ChannelIdAPIErrorZ_get_ok(uint64_t owner) {
5295         LDKCResult_ChannelIdAPIErrorZ* owner_conv = (LDKCResult_ChannelIdAPIErrorZ*)untag_ptr(owner);
5296         LDKChannelId ret_var = CResult_ChannelIdAPIErrorZ_get_ok(owner_conv);
5297         uint64_t ret_ref = 0;
5298         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5299         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5300         return ret_ref;
5301 }
5302
5303 static inline struct LDKAPIError CResult_ChannelIdAPIErrorZ_get_err(LDKCResult_ChannelIdAPIErrorZ *NONNULL_PTR owner){
5304 CHECK(!owner->result_ok);
5305         return APIError_clone(&*owner->contents.err);
5306 }
5307 uint64_t  __attribute__((export_name("TS_CResult_ChannelIdAPIErrorZ_get_err"))) TS_CResult_ChannelIdAPIErrorZ_get_err(uint64_t owner) {
5308         LDKCResult_ChannelIdAPIErrorZ* owner_conv = (LDKCResult_ChannelIdAPIErrorZ*)untag_ptr(owner);
5309         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5310         *ret_copy = CResult_ChannelIdAPIErrorZ_get_err(owner_conv);
5311         uint64_t ret_ref = tag_ptr(ret_copy, true);
5312         return ret_ref;
5313 }
5314
5315 uint32_t __attribute__((export_name("TS_LDKRecentPaymentDetails_ty_from_ptr"))) TS_LDKRecentPaymentDetails_ty_from_ptr(uint64_t ptr) {
5316         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5317         switch(obj->tag) {
5318                 case LDKRecentPaymentDetails_AwaitingInvoice: return 0;
5319                 case LDKRecentPaymentDetails_Pending: return 1;
5320                 case LDKRecentPaymentDetails_Fulfilled: return 2;
5321                 case LDKRecentPaymentDetails_Abandoned: return 3;
5322                 default: abort();
5323         }
5324 }
5325 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_AwaitingInvoice_get_payment_id"))) TS_LDKRecentPaymentDetails_AwaitingInvoice_get_payment_id(uint64_t ptr) {
5326         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5327         assert(obj->tag == LDKRecentPaymentDetails_AwaitingInvoice);
5328         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
5329         memcpy(payment_id_arr->elems, obj->awaiting_invoice.payment_id.data, 32);
5330         return payment_id_arr;
5331 }
5332 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Pending_get_payment_id"))) TS_LDKRecentPaymentDetails_Pending_get_payment_id(uint64_t ptr) {
5333         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5334         assert(obj->tag == LDKRecentPaymentDetails_Pending);
5335         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
5336         memcpy(payment_id_arr->elems, obj->pending.payment_id.data, 32);
5337         return payment_id_arr;
5338 }
5339 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Pending_get_payment_hash"))) TS_LDKRecentPaymentDetails_Pending_get_payment_hash(uint64_t ptr) {
5340         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5341         assert(obj->tag == LDKRecentPaymentDetails_Pending);
5342         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
5343         memcpy(payment_hash_arr->elems, obj->pending.payment_hash.data, 32);
5344         return payment_hash_arr;
5345 }
5346 int64_t __attribute__((export_name("TS_LDKRecentPaymentDetails_Pending_get_total_msat"))) TS_LDKRecentPaymentDetails_Pending_get_total_msat(uint64_t ptr) {
5347         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5348         assert(obj->tag == LDKRecentPaymentDetails_Pending);
5349         int64_t total_msat_conv = obj->pending.total_msat;
5350         return total_msat_conv;
5351 }
5352 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Fulfilled_get_payment_id"))) TS_LDKRecentPaymentDetails_Fulfilled_get_payment_id(uint64_t ptr) {
5353         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5354         assert(obj->tag == LDKRecentPaymentDetails_Fulfilled);
5355         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
5356         memcpy(payment_id_arr->elems, obj->fulfilled.payment_id.data, 32);
5357         return payment_id_arr;
5358 }
5359 uint64_t __attribute__((export_name("TS_LDKRecentPaymentDetails_Fulfilled_get_payment_hash"))) TS_LDKRecentPaymentDetails_Fulfilled_get_payment_hash(uint64_t ptr) {
5360         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5361         assert(obj->tag == LDKRecentPaymentDetails_Fulfilled);
5362         uint64_t payment_hash_ref = tag_ptr(&obj->fulfilled.payment_hash, false);
5363         return payment_hash_ref;
5364 }
5365 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Abandoned_get_payment_id"))) TS_LDKRecentPaymentDetails_Abandoned_get_payment_id(uint64_t ptr) {
5366         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5367         assert(obj->tag == LDKRecentPaymentDetails_Abandoned);
5368         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
5369         memcpy(payment_id_arr->elems, obj->abandoned.payment_id.data, 32);
5370         return payment_id_arr;
5371 }
5372 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Abandoned_get_payment_hash"))) TS_LDKRecentPaymentDetails_Abandoned_get_payment_hash(uint64_t ptr) {
5373         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5374         assert(obj->tag == LDKRecentPaymentDetails_Abandoned);
5375         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
5376         memcpy(payment_hash_arr->elems, obj->abandoned.payment_hash.data, 32);
5377         return payment_hash_arr;
5378 }
5379 static inline LDKCVec_RecentPaymentDetailsZ CVec_RecentPaymentDetailsZ_clone(const LDKCVec_RecentPaymentDetailsZ *orig) {
5380         LDKCVec_RecentPaymentDetailsZ ret = { .data = MALLOC(sizeof(LDKRecentPaymentDetails) * orig->datalen, "LDKCVec_RecentPaymentDetailsZ clone bytes"), .datalen = orig->datalen };
5381         for (size_t i = 0; i < ret.datalen; i++) {
5382                 ret.data[i] = RecentPaymentDetails_clone(&orig->data[i]);
5383         }
5384         return ret;
5385 }
5386 uint32_t __attribute__((export_name("TS_LDKPaymentSendFailure_ty_from_ptr"))) TS_LDKPaymentSendFailure_ty_from_ptr(uint64_t ptr) {
5387         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5388         switch(obj->tag) {
5389                 case LDKPaymentSendFailure_ParameterError: return 0;
5390                 case LDKPaymentSendFailure_PathParameterError: return 1;
5391                 case LDKPaymentSendFailure_AllFailedResendSafe: return 2;
5392                 case LDKPaymentSendFailure_DuplicatePayment: return 3;
5393                 case LDKPaymentSendFailure_PartialFailure: return 4;
5394                 default: abort();
5395         }
5396 }
5397 uint64_t __attribute__((export_name("TS_LDKPaymentSendFailure_ParameterError_get_parameter_error"))) TS_LDKPaymentSendFailure_ParameterError_get_parameter_error(uint64_t ptr) {
5398         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5399         assert(obj->tag == LDKPaymentSendFailure_ParameterError);
5400         uint64_t parameter_error_ref = tag_ptr(&obj->parameter_error, false);
5401         return parameter_error_ref;
5402 }
5403 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error"))) TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error(uint64_t ptr) {
5404         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5405         assert(obj->tag == LDKPaymentSendFailure_PathParameterError);
5406         LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
5407                         uint64_tArray path_parameter_error_arr = NULL;
5408                         path_parameter_error_arr = init_uint64_tArray(path_parameter_error_var.datalen, __LINE__);
5409                         uint64_t *path_parameter_error_arr_ptr = (uint64_t*)(((uint8_t*)path_parameter_error_arr) + 8);
5410                         for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
5411                                 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5412                                 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
5413                                 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
5414                                 path_parameter_error_arr_ptr[w] = tag_ptr(path_parameter_error_conv_22_conv, true);
5415                         }
5416                         
5417         return path_parameter_error_arr;
5418 }
5419 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_AllFailedResendSafe_get_all_failed_resend_safe"))) TS_LDKPaymentSendFailure_AllFailedResendSafe_get_all_failed_resend_safe(uint64_t ptr) {
5420         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5421         assert(obj->tag == LDKPaymentSendFailure_AllFailedResendSafe);
5422         LDKCVec_APIErrorZ all_failed_resend_safe_var = obj->all_failed_resend_safe;
5423                         uint64_tArray all_failed_resend_safe_arr = NULL;
5424                         all_failed_resend_safe_arr = init_uint64_tArray(all_failed_resend_safe_var.datalen, __LINE__);
5425                         uint64_t *all_failed_resend_safe_arr_ptr = (uint64_t*)(((uint8_t*)all_failed_resend_safe_arr) + 8);
5426                         for (size_t k = 0; k < all_failed_resend_safe_var.datalen; k++) {
5427                                 uint64_t all_failed_resend_safe_conv_10_ref = tag_ptr(&all_failed_resend_safe_var.data[k], false);
5428                                 all_failed_resend_safe_arr_ptr[k] = all_failed_resend_safe_conv_10_ref;
5429                         }
5430                         
5431         return all_failed_resend_safe_arr;
5432 }
5433 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_results"))) TS_LDKPaymentSendFailure_PartialFailure_get_results(uint64_t ptr) {
5434         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5435         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
5436         LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
5437                         uint64_tArray results_arr = NULL;
5438                         results_arr = init_uint64_tArray(results_var.datalen, __LINE__);
5439                         uint64_t *results_arr_ptr = (uint64_t*)(((uint8_t*)results_arr) + 8);
5440                         for (size_t w = 0; w < results_var.datalen; w++) {
5441                                 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5442                                 *results_conv_22_conv = results_var.data[w];
5443                                 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
5444                                 results_arr_ptr[w] = tag_ptr(results_conv_22_conv, true);
5445                         }
5446                         
5447         return results_arr;
5448 }
5449 uint64_t __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry"))) TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry(uint64_t ptr) {
5450         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5451         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
5452         LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
5453                         uint64_t failed_paths_retry_ref = 0;
5454                         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
5455                         failed_paths_retry_ref = tag_ptr(failed_paths_retry_var.inner, false);
5456         return failed_paths_retry_ref;
5457 }
5458 int8_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_payment_id"))) TS_LDKPaymentSendFailure_PartialFailure_get_payment_id(uint64_t ptr) {
5459         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5460         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
5461         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
5462         memcpy(payment_id_arr->elems, obj->partial_failure.payment_id.data, 32);
5463         return payment_id_arr;
5464 }
5465 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
5466 CHECK(owner->result_ok);
5467         return *owner->contents.result;
5468 }
5469 void  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_ok"))) TS_CResult_NonePaymentSendFailureZ_get_ok(uint64_t owner) {
5470         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
5471         CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
5472 }
5473
5474 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
5475 CHECK(!owner->result_ok);
5476         return PaymentSendFailure_clone(&*owner->contents.err);
5477 }
5478 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_err"))) TS_CResult_NonePaymentSendFailureZ_get_err(uint64_t owner) {
5479         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
5480         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5481         *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
5482         uint64_t ret_ref = tag_ptr(ret_copy, true);
5483         return ret_ref;
5484 }
5485
5486 static inline void CResult_NoneRetryableSendFailureZ_get_ok(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
5487 CHECK(owner->result_ok);
5488         return *owner->contents.result;
5489 }
5490 void  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_get_ok"))) TS_CResult_NoneRetryableSendFailureZ_get_ok(uint64_t owner) {
5491         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
5492         CResult_NoneRetryableSendFailureZ_get_ok(owner_conv);
5493 }
5494
5495 static inline enum LDKRetryableSendFailure CResult_NoneRetryableSendFailureZ_get_err(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
5496 CHECK(!owner->result_ok);
5497         return RetryableSendFailure_clone(&*owner->contents.err);
5498 }
5499 uint32_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_get_err"))) TS_CResult_NoneRetryableSendFailureZ_get_err(uint64_t owner) {
5500         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
5501         uint32_t ret_conv = LDKRetryableSendFailure_to_js(CResult_NoneRetryableSendFailureZ_get_err(owner_conv));
5502         return ret_conv;
5503 }
5504
5505 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR owner){
5506 CHECK(owner->result_ok);
5507         return ThirtyTwoBytes_clone(&*owner->contents.result);
5508 }
5509 int8_tArray  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(uint64_t owner) {
5510         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(owner);
5511         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5512         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(owner_conv).data, 32);
5513         return ret_arr;
5514 }
5515
5516 static inline struct LDKPaymentSendFailure CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR owner){
5517 CHECK(!owner->result_ok);
5518         return PaymentSendFailure_clone(&*owner->contents.err);
5519 }
5520 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(uint64_t owner) {
5521         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(owner);
5522         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5523         *ret_copy = CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(owner_conv);
5524         uint64_t ret_ref = tag_ptr(ret_copy, true);
5525         return ret_ref;
5526 }
5527
5528 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR owner){
5529 CHECK(owner->result_ok);
5530         return ThirtyTwoBytes_clone(&*owner->contents.result);
5531 }
5532 int8_tArray  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(uint64_t owner) {
5533         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(owner);
5534         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5535         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(owner_conv).data, 32);
5536         return ret_arr;
5537 }
5538
5539 static inline enum LDKRetryableSendFailure CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR owner){
5540 CHECK(!owner->result_ok);
5541         return RetryableSendFailure_clone(&*owner->contents.err);
5542 }
5543 uint32_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(uint64_t owner) {
5544         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(owner);
5545         uint32_t ret_conv = LDKRetryableSendFailure_to_js(CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(owner_conv));
5546         return ret_conv;
5547 }
5548
5549 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR owner){
5550         return ThirtyTwoBytes_clone(&owner->a);
5551 }
5552 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(uint64_t owner) {
5553         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(owner);
5554         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5555         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(owner_conv).data, 32);
5556         return ret_arr;
5557 }
5558
5559 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR owner){
5560         return ThirtyTwoBytes_clone(&owner->b);
5561 }
5562 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(uint64_t owner) {
5563         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(owner);
5564         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5565         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(owner_conv).data, 32);
5566         return ret_arr;
5567 }
5568
5569 static inline struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR owner){
5570 CHECK(owner->result_ok);
5571         return C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&*owner->contents.result);
5572 }
5573 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(uint64_t owner) {
5574         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(owner);
5575         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
5576         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(owner_conv);
5577         return tag_ptr(ret_conv, true);
5578 }
5579
5580 static inline struct LDKPaymentSendFailure CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR owner){
5581 CHECK(!owner->result_ok);
5582         return PaymentSendFailure_clone(&*owner->contents.err);
5583 }
5584 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(uint64_t owner) {
5585         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(owner);
5586         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5587         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(owner_conv);
5588         uint64_t ret_ref = tag_ptr(ret_copy, true);
5589         return ret_ref;
5590 }
5591
5592 static inline LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ *orig) {
5593         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ clone bytes"), .datalen = orig->datalen };
5594         for (size_t i = 0; i < ret.datalen; i++) {
5595                 ret.data[i] = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&orig->data[i]);
5596         }
5597         return ret;
5598 }
5599 uint32_t __attribute__((export_name("TS_LDKProbeSendFailure_ty_from_ptr"))) TS_LDKProbeSendFailure_ty_from_ptr(uint64_t ptr) {
5600         LDKProbeSendFailure *obj = (LDKProbeSendFailure*)untag_ptr(ptr);
5601         switch(obj->tag) {
5602                 case LDKProbeSendFailure_RouteNotFound: return 0;
5603                 case LDKProbeSendFailure_SendingFailed: return 1;
5604                 default: abort();
5605         }
5606 }
5607 uint64_t __attribute__((export_name("TS_LDKProbeSendFailure_SendingFailed_get_sending_failed"))) TS_LDKProbeSendFailure_SendingFailed_get_sending_failed(uint64_t ptr) {
5608         LDKProbeSendFailure *obj = (LDKProbeSendFailure*)untag_ptr(ptr);
5609         assert(obj->tag == LDKProbeSendFailure_SendingFailed);
5610         uint64_t sending_failed_ref = tag_ptr(&obj->sending_failed, false);
5611         return sending_failed_ref;
5612 }
5613 static inline struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR owner){
5614 CHECK(owner->result_ok);
5615         return CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_clone(&*owner->contents.result);
5616 }
5617 uint64_tArray  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(uint64_t owner) {
5618         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(owner);
5619         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ ret_var = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(owner_conv);
5620         uint64_tArray ret_arr = NULL;
5621         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
5622         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
5623         for (size_t o = 0; o < ret_var.datalen; o++) {
5624                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
5625                 *ret_conv_40_conv = ret_var.data[o];
5626                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
5627         }
5628         
5629         FREE(ret_var.data);
5630         return ret_arr;
5631 }
5632
5633 static inline struct LDKProbeSendFailure CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR owner){
5634 CHECK(!owner->result_ok);
5635         return ProbeSendFailure_clone(&*owner->contents.err);
5636 }
5637 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(uint64_t owner) {
5638         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(owner);
5639         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
5640         *ret_copy = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(owner_conv);
5641         uint64_t ret_ref = tag_ptr(ret_copy, true);
5642         return ret_ref;
5643 }
5644
5645 static inline struct LDKChannelId C2Tuple_ChannelIdPublicKeyZ_get_a(LDKC2Tuple_ChannelIdPublicKeyZ *NONNULL_PTR owner){
5646         LDKChannelId ret = owner->a;
5647         ret.is_owned = false;
5648         return ret;
5649 }
5650 uint64_t  __attribute__((export_name("TS_C2Tuple_ChannelIdPublicKeyZ_get_a"))) TS_C2Tuple_ChannelIdPublicKeyZ_get_a(uint64_t owner) {
5651         LDKC2Tuple_ChannelIdPublicKeyZ* owner_conv = (LDKC2Tuple_ChannelIdPublicKeyZ*)untag_ptr(owner);
5652         LDKChannelId ret_var = C2Tuple_ChannelIdPublicKeyZ_get_a(owner_conv);
5653         uint64_t ret_ref = 0;
5654         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5655         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5656         return ret_ref;
5657 }
5658
5659 static inline struct LDKPublicKey C2Tuple_ChannelIdPublicKeyZ_get_b(LDKC2Tuple_ChannelIdPublicKeyZ *NONNULL_PTR owner){
5660         return owner->b;
5661 }
5662 int8_tArray  __attribute__((export_name("TS_C2Tuple_ChannelIdPublicKeyZ_get_b"))) TS_C2Tuple_ChannelIdPublicKeyZ_get_b(uint64_t owner) {
5663         LDKC2Tuple_ChannelIdPublicKeyZ* owner_conv = (LDKC2Tuple_ChannelIdPublicKeyZ*)untag_ptr(owner);
5664         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
5665         memcpy(ret_arr->elems, C2Tuple_ChannelIdPublicKeyZ_get_b(owner_conv).compressed_form, 33);
5666         return ret_arr;
5667 }
5668
5669 static inline LDKCVec_C2Tuple_ChannelIdPublicKeyZZ CVec_C2Tuple_ChannelIdPublicKeyZZ_clone(const LDKCVec_C2Tuple_ChannelIdPublicKeyZZ *orig) {
5670         LDKCVec_C2Tuple_ChannelIdPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ChannelIdPublicKeyZ) * orig->datalen, "LDKCVec_C2Tuple_ChannelIdPublicKeyZZ clone bytes"), .datalen = orig->datalen };
5671         for (size_t i = 0; i < ret.datalen; i++) {
5672                 ret.data[i] = C2Tuple_ChannelIdPublicKeyZ_clone(&orig->data[i]);
5673         }
5674         return ret;
5675 }
5676 static inline LDKCVec_ChannelIdZ CVec_ChannelIdZ_clone(const LDKCVec_ChannelIdZ *orig) {
5677         LDKCVec_ChannelIdZ ret = { .data = MALLOC(sizeof(LDKChannelId) * orig->datalen, "LDKCVec_ChannelIdZ clone bytes"), .datalen = orig->datalen };
5678         for (size_t i = 0; i < ret.datalen; i++) {
5679                 ret.data[i] = ChannelId_clone(&orig->data[i]);
5680         }
5681         return ret;
5682 }
5683 static inline struct LDKOfferWithDerivedMetadataBuilder CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_ok(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
5684         LDKOfferWithDerivedMetadataBuilder ret = *owner->contents.result;
5685         ret.is_owned = false;
5686         return ret;
5687 }
5688 uint64_t  __attribute__((export_name("TS_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_ok"))) TS_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_ok(uint64_t owner) {
5689         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
5690         LDKOfferWithDerivedMetadataBuilder ret_var = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_ok(owner_conv);
5691         uint64_t ret_ref = 0;
5692         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5693         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5694         return ret_ref;
5695 }
5696
5697 static inline enum LDKBolt12SemanticError CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_err(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
5698 CHECK(!owner->result_ok);
5699         return Bolt12SemanticError_clone(&*owner->contents.err);
5700 }
5701 uint32_t  __attribute__((export_name("TS_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_err"))) TS_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_err(uint64_t owner) {
5702         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
5703         uint32_t ret_conv = LDKBolt12SemanticError_to_js(CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_err(owner_conv));
5704         return ret_conv;
5705 }
5706
5707 uint32_t __attribute__((export_name("TS_LDKCOption_StrZ_ty_from_ptr"))) TS_LDKCOption_StrZ_ty_from_ptr(uint64_t ptr) {
5708         LDKCOption_StrZ *obj = (LDKCOption_StrZ*)untag_ptr(ptr);
5709         switch(obj->tag) {
5710                 case LDKCOption_StrZ_Some: return 0;
5711                 case LDKCOption_StrZ_None: return 1;
5712                 default: abort();
5713         }
5714 }
5715 jstring __attribute__((export_name("TS_LDKCOption_StrZ_Some_get_some"))) TS_LDKCOption_StrZ_Some_get_some(uint64_t ptr) {
5716         LDKCOption_StrZ *obj = (LDKCOption_StrZ*)untag_ptr(ptr);
5717         assert(obj->tag == LDKCOption_StrZ_Some);
5718         LDKStr some_str = obj->some;
5719                         jstring some_conv = str_ref_to_ts(some_str.chars, some_str.len);
5720         return some_conv;
5721 }
5722 static inline struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR owner){
5723 CHECK(owner->result_ok);
5724         return C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&*owner->contents.result);
5725 }
5726 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(uint64_t owner) {
5727         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(owner);
5728         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
5729         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(owner_conv);
5730         return tag_ptr(ret_conv, true);
5731 }
5732
5733 static inline void CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR owner){
5734 CHECK(!owner->result_ok);
5735         return *owner->contents.err;
5736 }
5737 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(uint64_t owner) {
5738         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(owner);
5739         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(owner_conv);
5740 }
5741
5742 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesAPIErrorZ_get_ok(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR owner){
5743 CHECK(owner->result_ok);
5744         return ThirtyTwoBytes_clone(&*owner->contents.result);
5745 }
5746 int8_tArray  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_get_ok"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_get_ok(uint64_t owner) {
5747         LDKCResult_ThirtyTwoBytesAPIErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(owner);
5748         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5749         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesAPIErrorZ_get_ok(owner_conv).data, 32);
5750         return ret_arr;
5751 }
5752
5753 static inline struct LDKAPIError CResult_ThirtyTwoBytesAPIErrorZ_get_err(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR owner){
5754 CHECK(!owner->result_ok);
5755         return APIError_clone(&*owner->contents.err);
5756 }
5757 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_get_err"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_get_err(uint64_t owner) {
5758         LDKCResult_ThirtyTwoBytesAPIErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(owner);
5759         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5760         *ret_copy = CResult_ThirtyTwoBytesAPIErrorZ_get_err(owner_conv);
5761         uint64_t ret_ref = tag_ptr(ret_copy, true);
5762         return ret_ref;
5763 }
5764
5765 uint32_t __attribute__((export_name("TS_LDKOffersMessage_ty_from_ptr"))) TS_LDKOffersMessage_ty_from_ptr(uint64_t ptr) {
5766         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
5767         switch(obj->tag) {
5768                 case LDKOffersMessage_InvoiceRequest: return 0;
5769                 case LDKOffersMessage_Invoice: return 1;
5770                 case LDKOffersMessage_InvoiceError: return 2;
5771                 default: abort();
5772         }
5773 }
5774 uint64_t __attribute__((export_name("TS_LDKOffersMessage_InvoiceRequest_get_invoice_request"))) TS_LDKOffersMessage_InvoiceRequest_get_invoice_request(uint64_t ptr) {
5775         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
5776         assert(obj->tag == LDKOffersMessage_InvoiceRequest);
5777         LDKInvoiceRequest invoice_request_var = obj->invoice_request;
5778                         uint64_t invoice_request_ref = 0;
5779                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_var);
5780                         invoice_request_ref = tag_ptr(invoice_request_var.inner, false);
5781         return invoice_request_ref;
5782 }
5783 uint64_t __attribute__((export_name("TS_LDKOffersMessage_Invoice_get_invoice"))) TS_LDKOffersMessage_Invoice_get_invoice(uint64_t ptr) {
5784         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
5785         assert(obj->tag == LDKOffersMessage_Invoice);
5786         LDKBolt12Invoice invoice_var = obj->invoice;
5787                         uint64_t invoice_ref = 0;
5788                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_var);
5789                         invoice_ref = tag_ptr(invoice_var.inner, false);
5790         return invoice_ref;
5791 }
5792 uint64_t __attribute__((export_name("TS_LDKOffersMessage_InvoiceError_get_invoice_error"))) TS_LDKOffersMessage_InvoiceError_get_invoice_error(uint64_t ptr) {
5793         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
5794         assert(obj->tag == LDKOffersMessage_InvoiceError);
5795         LDKInvoiceError invoice_error_var = obj->invoice_error;
5796                         uint64_t invoice_error_ref = 0;
5797                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_error_var);
5798                         invoice_error_ref = tag_ptr(invoice_error_var.inner, false);
5799         return invoice_error_ref;
5800 }
5801 uint32_t __attribute__((export_name("TS_LDKCOption_OffersMessageZ_ty_from_ptr"))) TS_LDKCOption_OffersMessageZ_ty_from_ptr(uint64_t ptr) {
5802         LDKCOption_OffersMessageZ *obj = (LDKCOption_OffersMessageZ*)untag_ptr(ptr);
5803         switch(obj->tag) {
5804                 case LDKCOption_OffersMessageZ_Some: return 0;
5805                 case LDKCOption_OffersMessageZ_None: return 1;
5806                 default: abort();
5807         }
5808 }
5809 uint64_t __attribute__((export_name("TS_LDKCOption_OffersMessageZ_Some_get_some"))) TS_LDKCOption_OffersMessageZ_Some_get_some(uint64_t ptr) {
5810         LDKCOption_OffersMessageZ *obj = (LDKCOption_OffersMessageZ*)untag_ptr(ptr);
5811         assert(obj->tag == LDKCOption_OffersMessageZ_Some);
5812         uint64_t some_ref = tag_ptr(&obj->some, false);
5813         return some_ref;
5814 }
5815 uint32_t __attribute__((export_name("TS_LDKDestination_ty_from_ptr"))) TS_LDKDestination_ty_from_ptr(uint64_t ptr) {
5816         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
5817         switch(obj->tag) {
5818                 case LDKDestination_Node: return 0;
5819                 case LDKDestination_BlindedPath: return 1;
5820                 default: abort();
5821         }
5822 }
5823 int8_tArray __attribute__((export_name("TS_LDKDestination_Node_get_node"))) TS_LDKDestination_Node_get_node(uint64_t ptr) {
5824         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
5825         assert(obj->tag == LDKDestination_Node);
5826         int8_tArray node_arr = init_int8_tArray(33, __LINE__);
5827         memcpy(node_arr->elems, obj->node.compressed_form, 33);
5828         return node_arr;
5829 }
5830 uint64_t __attribute__((export_name("TS_LDKDestination_BlindedPath_get_blinded_path"))) TS_LDKDestination_BlindedPath_get_blinded_path(uint64_t ptr) {
5831         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
5832         assert(obj->tag == LDKDestination_BlindedPath);
5833         LDKBlindedPath blinded_path_var = obj->blinded_path;
5834                         uint64_t blinded_path_ref = 0;
5835                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_path_var);
5836                         blinded_path_ref = tag_ptr(blinded_path_var.inner, false);
5837         return blinded_path_ref;
5838 }
5839 static inline struct LDKOffersMessage C3Tuple_OffersMessageDestinationBlindedPathZ_get_a(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
5840         return OffersMessage_clone(&owner->a);
5841 }
5842 uint64_t  __attribute__((export_name("TS_C3Tuple_OffersMessageDestinationBlindedPathZ_get_a"))) TS_C3Tuple_OffersMessageDestinationBlindedPathZ_get_a(uint64_t owner) {
5843         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
5844         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
5845         *ret_copy = C3Tuple_OffersMessageDestinationBlindedPathZ_get_a(owner_conv);
5846         uint64_t ret_ref = tag_ptr(ret_copy, true);
5847         return ret_ref;
5848 }
5849
5850 static inline struct LDKDestination C3Tuple_OffersMessageDestinationBlindedPathZ_get_b(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
5851         return Destination_clone(&owner->b);
5852 }
5853 uint64_t  __attribute__((export_name("TS_C3Tuple_OffersMessageDestinationBlindedPathZ_get_b"))) TS_C3Tuple_OffersMessageDestinationBlindedPathZ_get_b(uint64_t owner) {
5854         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
5855         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
5856         *ret_copy = C3Tuple_OffersMessageDestinationBlindedPathZ_get_b(owner_conv);
5857         uint64_t ret_ref = tag_ptr(ret_copy, true);
5858         return ret_ref;
5859 }
5860
5861 static inline struct LDKBlindedPath C3Tuple_OffersMessageDestinationBlindedPathZ_get_c(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
5862         LDKBlindedPath ret = owner->c;
5863         ret.is_owned = false;
5864         return ret;
5865 }
5866 uint64_t  __attribute__((export_name("TS_C3Tuple_OffersMessageDestinationBlindedPathZ_get_c"))) TS_C3Tuple_OffersMessageDestinationBlindedPathZ_get_c(uint64_t owner) {
5867         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
5868         LDKBlindedPath ret_var = C3Tuple_OffersMessageDestinationBlindedPathZ_get_c(owner_conv);
5869         uint64_t ret_ref = 0;
5870         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5871         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5872         return ret_ref;
5873 }
5874
5875 static inline LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_clone(const LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ *orig) {
5876         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ) * orig->datalen, "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ clone bytes"), .datalen = orig->datalen };
5877         for (size_t i = 0; i < ret.datalen; i++) {
5878                 ret.data[i] = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(&orig->data[i]);
5879         }
5880         return ret;
5881 }
5882 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
5883         LDKCounterpartyForwardingInfo ret = *owner->contents.result;
5884         ret.is_owned = false;
5885         return ret;
5886 }
5887 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(uint64_t owner) {
5888         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
5889         LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
5890         uint64_t ret_ref = 0;
5891         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5892         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5893         return ret_ref;
5894 }
5895
5896 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
5897 CHECK(!owner->result_ok);
5898         return DecodeError_clone(&*owner->contents.err);
5899 }
5900 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(uint64_t owner) {
5901         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
5902         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5903         *ret_copy = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
5904         uint64_t ret_ref = tag_ptr(ret_copy, true);
5905         return ret_ref;
5906 }
5907
5908 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
5909         LDKChannelCounterparty ret = *owner->contents.result;
5910         ret.is_owned = false;
5911         return ret;
5912 }
5913 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok(uint64_t owner) {
5914         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
5915         LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
5916         uint64_t ret_ref = 0;
5917         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5918         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5919         return ret_ref;
5920 }
5921
5922 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
5923 CHECK(!owner->result_ok);
5924         return DecodeError_clone(&*owner->contents.err);
5925 }
5926 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err(uint64_t owner) {
5927         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
5928         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5929         *ret_copy = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
5930         uint64_t ret_ref = tag_ptr(ret_copy, true);
5931         return ret_ref;
5932 }
5933
5934 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
5935         LDKChannelDetails ret = *owner->contents.result;
5936         ret.is_owned = false;
5937         return ret;
5938 }
5939 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_ok(uint64_t owner) {
5940         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
5941         LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
5942         uint64_t ret_ref = 0;
5943         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5944         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5945         return ret_ref;
5946 }
5947
5948 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
5949 CHECK(!owner->result_ok);
5950         return DecodeError_clone(&*owner->contents.err);
5951 }
5952 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_err(uint64_t owner) {
5953         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
5954         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5955         *ret_copy = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
5956         uint64_t ret_ref = tag_ptr(ret_copy, true);
5957         return ret_ref;
5958 }
5959
5960 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
5961         LDKPhantomRouteHints ret = *owner->contents.result;
5962         ret.is_owned = false;
5963         return ret;
5964 }
5965 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok(uint64_t owner) {
5966         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
5967         LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
5968         uint64_t ret_ref = 0;
5969         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5970         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5971         return ret_ref;
5972 }
5973
5974 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
5975 CHECK(!owner->result_ok);
5976         return DecodeError_clone(&*owner->contents.err);
5977 }
5978 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err(uint64_t owner) {
5979         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
5980         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5981         *ret_copy = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
5982         uint64_t ret_ref = tag_ptr(ret_copy, true);
5983         return ret_ref;
5984 }
5985
5986 static inline struct LDKBlindedForward CResult_BlindedForwardDecodeErrorZ_get_ok(LDKCResult_BlindedForwardDecodeErrorZ *NONNULL_PTR owner){
5987         LDKBlindedForward ret = *owner->contents.result;
5988         ret.is_owned = false;
5989         return ret;
5990 }
5991 uint64_t  __attribute__((export_name("TS_CResult_BlindedForwardDecodeErrorZ_get_ok"))) TS_CResult_BlindedForwardDecodeErrorZ_get_ok(uint64_t owner) {
5992         LDKCResult_BlindedForwardDecodeErrorZ* owner_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(owner);
5993         LDKBlindedForward ret_var = CResult_BlindedForwardDecodeErrorZ_get_ok(owner_conv);
5994         uint64_t ret_ref = 0;
5995         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5996         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5997         return ret_ref;
5998 }
5999
6000 static inline struct LDKDecodeError CResult_BlindedForwardDecodeErrorZ_get_err(LDKCResult_BlindedForwardDecodeErrorZ *NONNULL_PTR owner){
6001 CHECK(!owner->result_ok);
6002         return DecodeError_clone(&*owner->contents.err);
6003 }
6004 uint64_t  __attribute__((export_name("TS_CResult_BlindedForwardDecodeErrorZ_get_err"))) TS_CResult_BlindedForwardDecodeErrorZ_get_err(uint64_t owner) {
6005         LDKCResult_BlindedForwardDecodeErrorZ* owner_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(owner);
6006         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6007         *ret_copy = CResult_BlindedForwardDecodeErrorZ_get_err(owner_conv);
6008         uint64_t ret_ref = tag_ptr(ret_copy, true);
6009         return ret_ref;
6010 }
6011
6012 uint32_t __attribute__((export_name("TS_LDKPendingHTLCRouting_ty_from_ptr"))) TS_LDKPendingHTLCRouting_ty_from_ptr(uint64_t ptr) {
6013         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6014         switch(obj->tag) {
6015                 case LDKPendingHTLCRouting_Forward: return 0;
6016                 case LDKPendingHTLCRouting_Receive: return 1;
6017                 case LDKPendingHTLCRouting_ReceiveKeysend: return 2;
6018                 default: abort();
6019         }
6020 }
6021 uint64_t __attribute__((export_name("TS_LDKPendingHTLCRouting_Forward_get_onion_packet"))) TS_LDKPendingHTLCRouting_Forward_get_onion_packet(uint64_t ptr) {
6022         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6023         assert(obj->tag == LDKPendingHTLCRouting_Forward);
6024         LDKOnionPacket onion_packet_var = obj->forward.onion_packet;
6025                         uint64_t onion_packet_ref = 0;
6026                         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_packet_var);
6027                         onion_packet_ref = tag_ptr(onion_packet_var.inner, false);
6028         return onion_packet_ref;
6029 }
6030 int64_t __attribute__((export_name("TS_LDKPendingHTLCRouting_Forward_get_short_channel_id"))) TS_LDKPendingHTLCRouting_Forward_get_short_channel_id(uint64_t ptr) {
6031         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6032         assert(obj->tag == LDKPendingHTLCRouting_Forward);
6033         int64_t short_channel_id_conv = obj->forward.short_channel_id;
6034         return short_channel_id_conv;
6035 }
6036 uint64_t __attribute__((export_name("TS_LDKPendingHTLCRouting_Forward_get_blinded"))) TS_LDKPendingHTLCRouting_Forward_get_blinded(uint64_t ptr) {
6037         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6038         assert(obj->tag == LDKPendingHTLCRouting_Forward);
6039         LDKBlindedForward blinded_var = obj->forward.blinded;
6040                         uint64_t blinded_ref = 0;
6041                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_var);
6042                         blinded_ref = tag_ptr(blinded_var.inner, false);
6043         return blinded_ref;
6044 }
6045 uint64_t __attribute__((export_name("TS_LDKPendingHTLCRouting_Receive_get_payment_data"))) TS_LDKPendingHTLCRouting_Receive_get_payment_data(uint64_t ptr) {
6046         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6047         assert(obj->tag == LDKPendingHTLCRouting_Receive);
6048         LDKFinalOnionHopData payment_data_var = obj->receive.payment_data;
6049                         uint64_t payment_data_ref = 0;
6050                         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_var);
6051                         payment_data_ref = tag_ptr(payment_data_var.inner, false);
6052         return payment_data_ref;
6053 }
6054 uint64_t __attribute__((export_name("TS_LDKPendingHTLCRouting_Receive_get_payment_metadata"))) TS_LDKPendingHTLCRouting_Receive_get_payment_metadata(uint64_t ptr) {
6055         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6056         assert(obj->tag == LDKPendingHTLCRouting_Receive);
6057         uint64_t payment_metadata_ref = tag_ptr(&obj->receive.payment_metadata, false);
6058         return payment_metadata_ref;
6059 }
6060 uint64_t __attribute__((export_name("TS_LDKPendingHTLCRouting_Receive_get_payment_context"))) TS_LDKPendingHTLCRouting_Receive_get_payment_context(uint64_t ptr) {
6061         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6062         assert(obj->tag == LDKPendingHTLCRouting_Receive);
6063         uint64_t payment_context_ref = tag_ptr(&obj->receive.payment_context, false);
6064         return payment_context_ref;
6065 }
6066 int32_t __attribute__((export_name("TS_LDKPendingHTLCRouting_Receive_get_incoming_cltv_expiry"))) TS_LDKPendingHTLCRouting_Receive_get_incoming_cltv_expiry(uint64_t ptr) {
6067         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6068         assert(obj->tag == LDKPendingHTLCRouting_Receive);
6069         int32_t incoming_cltv_expiry_conv = obj->receive.incoming_cltv_expiry;
6070         return incoming_cltv_expiry_conv;
6071 }
6072 int8_tArray __attribute__((export_name("TS_LDKPendingHTLCRouting_Receive_get_phantom_shared_secret"))) TS_LDKPendingHTLCRouting_Receive_get_phantom_shared_secret(uint64_t ptr) {
6073         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6074         assert(obj->tag == LDKPendingHTLCRouting_Receive);
6075         int8_tArray phantom_shared_secret_arr = init_int8_tArray(32, __LINE__);
6076         memcpy(phantom_shared_secret_arr->elems, obj->receive.phantom_shared_secret.data, 32);
6077         return phantom_shared_secret_arr;
6078 }
6079 uint64_tArray __attribute__((export_name("TS_LDKPendingHTLCRouting_Receive_get_custom_tlvs"))) TS_LDKPendingHTLCRouting_Receive_get_custom_tlvs(uint64_t ptr) {
6080         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6081         assert(obj->tag == LDKPendingHTLCRouting_Receive);
6082         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_var = obj->receive.custom_tlvs;
6083                         uint64_tArray custom_tlvs_arr = NULL;
6084                         custom_tlvs_arr = init_uint64_tArray(custom_tlvs_var.datalen, __LINE__);
6085                         uint64_t *custom_tlvs_arr_ptr = (uint64_t*)(((uint8_t*)custom_tlvs_arr) + 8);
6086                         for (size_t x = 0; x < custom_tlvs_var.datalen; x++) {
6087                                 LDKC2Tuple_u64CVec_u8ZZ* custom_tlvs_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
6088                                 *custom_tlvs_conv_23_conv = custom_tlvs_var.data[x];
6089                                 *custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone(custom_tlvs_conv_23_conv);
6090                                 custom_tlvs_arr_ptr[x] = tag_ptr(custom_tlvs_conv_23_conv, true);
6091                         }
6092                         
6093         return custom_tlvs_arr;
6094 }
6095 jboolean __attribute__((export_name("TS_LDKPendingHTLCRouting_Receive_get_requires_blinded_error"))) TS_LDKPendingHTLCRouting_Receive_get_requires_blinded_error(uint64_t ptr) {
6096         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6097         assert(obj->tag == LDKPendingHTLCRouting_Receive);
6098         jboolean requires_blinded_error_conv = obj->receive.requires_blinded_error;
6099         return requires_blinded_error_conv;
6100 }
6101 uint64_t __attribute__((export_name("TS_LDKPendingHTLCRouting_ReceiveKeysend_get_payment_data"))) TS_LDKPendingHTLCRouting_ReceiveKeysend_get_payment_data(uint64_t ptr) {
6102         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6103         assert(obj->tag == LDKPendingHTLCRouting_ReceiveKeysend);
6104         LDKFinalOnionHopData payment_data_var = obj->receive_keysend.payment_data;
6105                         uint64_t payment_data_ref = 0;
6106                         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_var);
6107                         payment_data_ref = tag_ptr(payment_data_var.inner, false);
6108         return payment_data_ref;
6109 }
6110 int8_tArray __attribute__((export_name("TS_LDKPendingHTLCRouting_ReceiveKeysend_get_payment_preimage"))) TS_LDKPendingHTLCRouting_ReceiveKeysend_get_payment_preimage(uint64_t ptr) {
6111         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6112         assert(obj->tag == LDKPendingHTLCRouting_ReceiveKeysend);
6113         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
6114         memcpy(payment_preimage_arr->elems, obj->receive_keysend.payment_preimage.data, 32);
6115         return payment_preimage_arr;
6116 }
6117 uint64_t __attribute__((export_name("TS_LDKPendingHTLCRouting_ReceiveKeysend_get_payment_metadata"))) TS_LDKPendingHTLCRouting_ReceiveKeysend_get_payment_metadata(uint64_t ptr) {
6118         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6119         assert(obj->tag == LDKPendingHTLCRouting_ReceiveKeysend);
6120         uint64_t payment_metadata_ref = tag_ptr(&obj->receive_keysend.payment_metadata, false);
6121         return payment_metadata_ref;
6122 }
6123 int32_t __attribute__((export_name("TS_LDKPendingHTLCRouting_ReceiveKeysend_get_incoming_cltv_expiry"))) TS_LDKPendingHTLCRouting_ReceiveKeysend_get_incoming_cltv_expiry(uint64_t ptr) {
6124         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6125         assert(obj->tag == LDKPendingHTLCRouting_ReceiveKeysend);
6126         int32_t incoming_cltv_expiry_conv = obj->receive_keysend.incoming_cltv_expiry;
6127         return incoming_cltv_expiry_conv;
6128 }
6129 uint64_tArray __attribute__((export_name("TS_LDKPendingHTLCRouting_ReceiveKeysend_get_custom_tlvs"))) TS_LDKPendingHTLCRouting_ReceiveKeysend_get_custom_tlvs(uint64_t ptr) {
6130         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6131         assert(obj->tag == LDKPendingHTLCRouting_ReceiveKeysend);
6132         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_var = obj->receive_keysend.custom_tlvs;
6133                         uint64_tArray custom_tlvs_arr = NULL;
6134                         custom_tlvs_arr = init_uint64_tArray(custom_tlvs_var.datalen, __LINE__);
6135                         uint64_t *custom_tlvs_arr_ptr = (uint64_t*)(((uint8_t*)custom_tlvs_arr) + 8);
6136                         for (size_t x = 0; x < custom_tlvs_var.datalen; x++) {
6137                                 LDKC2Tuple_u64CVec_u8ZZ* custom_tlvs_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
6138                                 *custom_tlvs_conv_23_conv = custom_tlvs_var.data[x];
6139                                 *custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone(custom_tlvs_conv_23_conv);
6140                                 custom_tlvs_arr_ptr[x] = tag_ptr(custom_tlvs_conv_23_conv, true);
6141                         }
6142                         
6143         return custom_tlvs_arr;
6144 }
6145 jboolean __attribute__((export_name("TS_LDKPendingHTLCRouting_ReceiveKeysend_get_requires_blinded_error"))) TS_LDKPendingHTLCRouting_ReceiveKeysend_get_requires_blinded_error(uint64_t ptr) {
6146         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6147         assert(obj->tag == LDKPendingHTLCRouting_ReceiveKeysend);
6148         jboolean requires_blinded_error_conv = obj->receive_keysend.requires_blinded_error;
6149         return requires_blinded_error_conv;
6150 }
6151 static inline struct LDKPendingHTLCRouting CResult_PendingHTLCRoutingDecodeErrorZ_get_ok(LDKCResult_PendingHTLCRoutingDecodeErrorZ *NONNULL_PTR owner){
6152 CHECK(owner->result_ok);
6153         return PendingHTLCRouting_clone(&*owner->contents.result);
6154 }
6155 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCRoutingDecodeErrorZ_get_ok"))) TS_CResult_PendingHTLCRoutingDecodeErrorZ_get_ok(uint64_t owner) {
6156         LDKCResult_PendingHTLCRoutingDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(owner);
6157         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
6158         *ret_copy = CResult_PendingHTLCRoutingDecodeErrorZ_get_ok(owner_conv);
6159         uint64_t ret_ref = tag_ptr(ret_copy, true);
6160         return ret_ref;
6161 }
6162
6163 static inline struct LDKDecodeError CResult_PendingHTLCRoutingDecodeErrorZ_get_err(LDKCResult_PendingHTLCRoutingDecodeErrorZ *NONNULL_PTR owner){
6164 CHECK(!owner->result_ok);
6165         return DecodeError_clone(&*owner->contents.err);
6166 }
6167 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCRoutingDecodeErrorZ_get_err"))) TS_CResult_PendingHTLCRoutingDecodeErrorZ_get_err(uint64_t owner) {
6168         LDKCResult_PendingHTLCRoutingDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(owner);
6169         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6170         *ret_copy = CResult_PendingHTLCRoutingDecodeErrorZ_get_err(owner_conv);
6171         uint64_t ret_ref = tag_ptr(ret_copy, true);
6172         return ret_ref;
6173 }
6174
6175 static inline struct LDKPendingHTLCInfo CResult_PendingHTLCInfoDecodeErrorZ_get_ok(LDKCResult_PendingHTLCInfoDecodeErrorZ *NONNULL_PTR owner){
6176         LDKPendingHTLCInfo ret = *owner->contents.result;
6177         ret.is_owned = false;
6178         return ret;
6179 }
6180 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoDecodeErrorZ_get_ok"))) TS_CResult_PendingHTLCInfoDecodeErrorZ_get_ok(uint64_t owner) {
6181         LDKCResult_PendingHTLCInfoDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(owner);
6182         LDKPendingHTLCInfo ret_var = CResult_PendingHTLCInfoDecodeErrorZ_get_ok(owner_conv);
6183         uint64_t ret_ref = 0;
6184         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6185         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6186         return ret_ref;
6187 }
6188
6189 static inline struct LDKDecodeError CResult_PendingHTLCInfoDecodeErrorZ_get_err(LDKCResult_PendingHTLCInfoDecodeErrorZ *NONNULL_PTR owner){
6190 CHECK(!owner->result_ok);
6191         return DecodeError_clone(&*owner->contents.err);
6192 }
6193 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoDecodeErrorZ_get_err"))) TS_CResult_PendingHTLCInfoDecodeErrorZ_get_err(uint64_t owner) {
6194         LDKCResult_PendingHTLCInfoDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(owner);
6195         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6196         *ret_copy = CResult_PendingHTLCInfoDecodeErrorZ_get_err(owner_conv);
6197         uint64_t ret_ref = tag_ptr(ret_copy, true);
6198         return ret_ref;
6199 }
6200
6201 static inline enum LDKBlindedFailure CResult_BlindedFailureDecodeErrorZ_get_ok(LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR owner){
6202 CHECK(owner->result_ok);
6203         return BlindedFailure_clone(&*owner->contents.result);
6204 }
6205 uint32_t  __attribute__((export_name("TS_CResult_BlindedFailureDecodeErrorZ_get_ok"))) TS_CResult_BlindedFailureDecodeErrorZ_get_ok(uint64_t owner) {
6206         LDKCResult_BlindedFailureDecodeErrorZ* owner_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(owner);
6207         uint32_t ret_conv = LDKBlindedFailure_to_js(CResult_BlindedFailureDecodeErrorZ_get_ok(owner_conv));
6208         return ret_conv;
6209 }
6210
6211 static inline struct LDKDecodeError CResult_BlindedFailureDecodeErrorZ_get_err(LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR owner){
6212 CHECK(!owner->result_ok);
6213         return DecodeError_clone(&*owner->contents.err);
6214 }
6215 uint64_t  __attribute__((export_name("TS_CResult_BlindedFailureDecodeErrorZ_get_err"))) TS_CResult_BlindedFailureDecodeErrorZ_get_err(uint64_t owner) {
6216         LDKCResult_BlindedFailureDecodeErrorZ* owner_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(owner);
6217         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6218         *ret_copy = CResult_BlindedFailureDecodeErrorZ_get_err(owner_conv);
6219         uint64_t ret_ref = tag_ptr(ret_copy, true);
6220         return ret_ref;
6221 }
6222
6223 static inline enum LDKChannelShutdownState CResult_ChannelShutdownStateDecodeErrorZ_get_ok(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR owner){
6224 CHECK(owner->result_ok);
6225         return ChannelShutdownState_clone(&*owner->contents.result);
6226 }
6227 uint32_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_get_ok"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_get_ok(uint64_t owner) {
6228         LDKCResult_ChannelShutdownStateDecodeErrorZ* owner_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(owner);
6229         uint32_t ret_conv = LDKChannelShutdownState_to_js(CResult_ChannelShutdownStateDecodeErrorZ_get_ok(owner_conv));
6230         return ret_conv;
6231 }
6232
6233 static inline struct LDKDecodeError CResult_ChannelShutdownStateDecodeErrorZ_get_err(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR owner){
6234 CHECK(!owner->result_ok);
6235         return DecodeError_clone(&*owner->contents.err);
6236 }
6237 uint64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_get_err"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_get_err(uint64_t owner) {
6238         LDKCResult_ChannelShutdownStateDecodeErrorZ* owner_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(owner);
6239         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6240         *ret_copy = CResult_ChannelShutdownStateDecodeErrorZ_get_err(owner_conv);
6241         uint64_t ret_ref = tag_ptr(ret_copy, true);
6242         return ret_ref;
6243 }
6244
6245 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
6246         LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
6247         for (size_t i = 0; i < ret.datalen; i++) {
6248                 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
6249         }
6250         return ret;
6251 }
6252 typedef struct LDKWatch_JCalls {
6253         atomic_size_t refcnt;
6254         uint32_t instance_ptr;
6255 } LDKWatch_JCalls;
6256 static void LDKWatch_JCalls_free(void* this_arg) {
6257         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6258         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6259                 FREE(j_calls);
6260         }
6261 }
6262 LDKCResult_ChannelMonitorUpdateStatusNoneZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
6263         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6264         LDKOutPoint funding_txo_var = funding_txo;
6265         uint64_t funding_txo_ref = 0;
6266         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
6267         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
6268         LDKChannelMonitor monitor_var = monitor;
6269         uint64_t monitor_ref = 0;
6270         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
6271         monitor_ref = tag_ptr(monitor_var.inner, monitor_var.is_owned);
6272         uint64_t ret = js_invoke_function_bbuuuu(j_calls->instance_ptr, 18, funding_txo_ref, monitor_ref, 0, 0, 0, 0);
6273         void* ret_ptr = untag_ptr(ret);
6274         CHECK_ACCESS(ret_ptr);
6275         LDKCResult_ChannelMonitorUpdateStatusNoneZ ret_conv = *(LDKCResult_ChannelMonitorUpdateStatusNoneZ*)(ret_ptr);
6276         FREE(untag_ptr(ret));
6277         return ret_conv;
6278 }
6279 LDKChannelMonitorUpdateStatus update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, const LDKChannelMonitorUpdate * update) {
6280         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6281         LDKOutPoint funding_txo_var = funding_txo;
6282         uint64_t funding_txo_ref = 0;
6283         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
6284         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
6285         LDKChannelMonitorUpdate update_var = *update;
6286         uint64_t update_ref = 0;
6287         update_var = ChannelMonitorUpdate_clone(&update_var);
6288         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
6289         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
6290         uint64_t ret = js_invoke_function_bbuuuu(j_calls->instance_ptr, 19, funding_txo_ref, update_ref, 0, 0, 0, 0);
6291         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
6292         return ret_conv;
6293 }
6294 LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
6295         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6296         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 20, 0, 0, 0, 0, 0, 0);
6297         LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ ret_constr;
6298         ret_constr.datalen = ret->arr_len;
6299         if (ret_constr.datalen > 0)
6300                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ), "LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ Elements");
6301         else
6302                 ret_constr.data = NULL;
6303         uint64_t* ret_vals = ret->elems;
6304         for (size_t f = 0; f < ret_constr.datalen; f++) {
6305                 uint64_t ret_conv_57 = ret_vals[f];
6306                 void* ret_conv_57_ptr = untag_ptr(ret_conv_57);
6307                 CHECK_ACCESS(ret_conv_57_ptr);
6308                 LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ ret_conv_57_conv = *(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)(ret_conv_57_ptr);
6309                 FREE(untag_ptr(ret_conv_57));
6310                 ret_constr.data[f] = ret_conv_57_conv;
6311         }
6312         FREE(ret);
6313         return ret_constr;
6314 }
6315 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
6316         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
6317         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6318 }
6319 static inline LDKWatch LDKWatch_init (JSValue o) {
6320         LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
6321         atomic_init(&calls->refcnt, 1);
6322         calls->instance_ptr = o;
6323
6324         LDKWatch ret = {
6325                 .this_arg = (void*) calls,
6326                 .watch_channel = watch_channel_LDKWatch_jcall,
6327                 .update_channel = update_channel_LDKWatch_jcall,
6328                 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
6329                 .free = LDKWatch_JCalls_free,
6330         };
6331         return ret;
6332 }
6333 uint64_t  __attribute__((export_name("TS_LDKWatch_new"))) TS_LDKWatch_new(JSValue o) {
6334         LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
6335         *res_ptr = LDKWatch_init(o);
6336         return tag_ptr(res_ptr, true);
6337 }
6338 uint64_t  __attribute__((export_name("TS_Watch_watch_channel"))) TS_Watch_watch_channel(uint64_t this_arg, uint64_t funding_txo, uint64_t monitor) {
6339         void* this_arg_ptr = untag_ptr(this_arg);
6340         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6341         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6342         LDKOutPoint funding_txo_conv;
6343         funding_txo_conv.inner = untag_ptr(funding_txo);
6344         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
6345         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
6346         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
6347         LDKChannelMonitor monitor_conv;
6348         monitor_conv.inner = untag_ptr(monitor);
6349         monitor_conv.is_owned = ptr_is_owned(monitor);
6350         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
6351         monitor_conv = ChannelMonitor_clone(&monitor_conv);
6352         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
6353         *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
6354         return tag_ptr(ret_conv, true);
6355 }
6356
6357 uint32_t  __attribute__((export_name("TS_Watch_update_channel"))) TS_Watch_update_channel(uint64_t this_arg, uint64_t funding_txo, uint64_t update) {
6358         void* this_arg_ptr = untag_ptr(this_arg);
6359         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6360         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6361         LDKOutPoint funding_txo_conv;
6362         funding_txo_conv.inner = untag_ptr(funding_txo);
6363         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
6364         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
6365         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
6366         LDKChannelMonitorUpdate update_conv;
6367         update_conv.inner = untag_ptr(update);
6368         update_conv.is_owned = ptr_is_owned(update);
6369         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
6370         update_conv.is_owned = false;
6371         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js((this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, &update_conv));
6372         return ret_conv;
6373 }
6374
6375 uint64_tArray  __attribute__((export_name("TS_Watch_release_pending_monitor_events"))) TS_Watch_release_pending_monitor_events(uint64_t this_arg) {
6376         void* this_arg_ptr = untag_ptr(this_arg);
6377         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6378         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6379         LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
6380         uint64_tArray ret_arr = NULL;
6381         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
6382         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
6383         for (size_t f = 0; f < ret_var.datalen; f++) {
6384                 LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* ret_conv_57_conv = MALLOC(sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ), "LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ");
6385                 *ret_conv_57_conv = ret_var.data[f];
6386                 ret_arr_ptr[f] = tag_ptr(ret_conv_57_conv, true);
6387         }
6388         
6389         FREE(ret_var.data);
6390         return ret_arr;
6391 }
6392
6393 typedef struct LDKBroadcasterInterface_JCalls {
6394         atomic_size_t refcnt;
6395         uint32_t instance_ptr;
6396 } LDKBroadcasterInterface_JCalls;
6397 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
6398         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
6399         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6400                 FREE(j_calls);
6401         }
6402 }
6403 void broadcast_transactions_LDKBroadcasterInterface_jcall(const void* this_arg, LDKCVec_TransactionZ txs) {
6404         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
6405         LDKCVec_TransactionZ txs_var = txs;
6406         ptrArray txs_arr = NULL;
6407         txs_arr = init_ptrArray(txs_var.datalen, __LINE__);
6408         int8_tArray *txs_arr_ptr = (int8_tArray*)(((uint8_t*)txs_arr) + 8);
6409         for (size_t m = 0; m < txs_var.datalen; m++) {
6410                 LDKTransaction txs_conv_12_var = txs_var.data[m];
6411                 int8_tArray txs_conv_12_arr = init_int8_tArray(txs_conv_12_var.datalen, __LINE__);
6412                 memcpy(txs_conv_12_arr->elems, txs_conv_12_var.data, txs_conv_12_var.datalen);
6413                 Transaction_free(txs_conv_12_var);
6414                 txs_arr_ptr[m] = txs_conv_12_arr;
6415         }
6416         
6417         FREE(txs_var.data);
6418         js_invoke_function_uuuuuu(j_calls->instance_ptr, 21, (uint32_t)txs_arr, 0, 0, 0, 0, 0);
6419 }
6420 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
6421         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
6422         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6423 }
6424 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JSValue o) {
6425         LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
6426         atomic_init(&calls->refcnt, 1);
6427         calls->instance_ptr = o;
6428
6429         LDKBroadcasterInterface ret = {
6430                 .this_arg = (void*) calls,
6431                 .broadcast_transactions = broadcast_transactions_LDKBroadcasterInterface_jcall,
6432                 .free = LDKBroadcasterInterface_JCalls_free,
6433         };
6434         return ret;
6435 }
6436 uint64_t  __attribute__((export_name("TS_LDKBroadcasterInterface_new"))) TS_LDKBroadcasterInterface_new(JSValue o) {
6437         LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
6438         *res_ptr = LDKBroadcasterInterface_init(o);
6439         return tag_ptr(res_ptr, true);
6440 }
6441 void  __attribute__((export_name("TS_BroadcasterInterface_broadcast_transactions"))) TS_BroadcasterInterface_broadcast_transactions(uint64_t this_arg, ptrArray txs) {
6442         void* this_arg_ptr = untag_ptr(this_arg);
6443         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6444         LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
6445         LDKCVec_TransactionZ txs_constr;
6446         txs_constr.datalen = txs->arr_len;
6447         if (txs_constr.datalen > 0)
6448                 txs_constr.data = MALLOC(txs_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
6449         else
6450                 txs_constr.data = NULL;
6451         int8_tArray* txs_vals = (void*) txs->elems;
6452         for (size_t m = 0; m < txs_constr.datalen; m++) {
6453                 int8_tArray txs_conv_12 = txs_vals[m];
6454                 LDKTransaction txs_conv_12_ref;
6455                 txs_conv_12_ref.datalen = txs_conv_12->arr_len;
6456                 txs_conv_12_ref.data = MALLOC(txs_conv_12_ref.datalen, "LDKTransaction Bytes");
6457                 memcpy(txs_conv_12_ref.data, txs_conv_12->elems, txs_conv_12_ref.datalen); FREE(txs_conv_12);
6458                 txs_conv_12_ref.data_is_owned = true;
6459                 txs_constr.data[m] = txs_conv_12_ref;
6460         }
6461         FREE(txs);
6462         (this_arg_conv->broadcast_transactions)(this_arg_conv->this_arg, txs_constr);
6463 }
6464
6465 typedef struct LDKEntropySource_JCalls {
6466         atomic_size_t refcnt;
6467         uint32_t instance_ptr;
6468 } LDKEntropySource_JCalls;
6469 static void LDKEntropySource_JCalls_free(void* this_arg) {
6470         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
6471         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6472                 FREE(j_calls);
6473         }
6474 }
6475 LDKThirtyTwoBytes get_secure_random_bytes_LDKEntropySource_jcall(const void* this_arg) {
6476         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
6477         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 22, 0, 0, 0, 0, 0, 0);
6478         LDKThirtyTwoBytes ret_ref;
6479         CHECK(ret->arr_len == 32);
6480         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
6481         return ret_ref;
6482 }
6483 static void LDKEntropySource_JCalls_cloned(LDKEntropySource* new_obj) {
6484         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) new_obj->this_arg;
6485         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6486 }
6487 static inline LDKEntropySource LDKEntropySource_init (JSValue o) {
6488         LDKEntropySource_JCalls *calls = MALLOC(sizeof(LDKEntropySource_JCalls), "LDKEntropySource_JCalls");
6489         atomic_init(&calls->refcnt, 1);
6490         calls->instance_ptr = o;
6491
6492         LDKEntropySource ret = {
6493                 .this_arg = (void*) calls,
6494                 .get_secure_random_bytes = get_secure_random_bytes_LDKEntropySource_jcall,
6495                 .free = LDKEntropySource_JCalls_free,
6496         };
6497         return ret;
6498 }
6499 uint64_t  __attribute__((export_name("TS_LDKEntropySource_new"))) TS_LDKEntropySource_new(JSValue o) {
6500         LDKEntropySource *res_ptr = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
6501         *res_ptr = LDKEntropySource_init(o);
6502         return tag_ptr(res_ptr, true);
6503 }
6504 int8_tArray  __attribute__((export_name("TS_EntropySource_get_secure_random_bytes"))) TS_EntropySource_get_secure_random_bytes(uint64_t this_arg) {
6505         void* this_arg_ptr = untag_ptr(this_arg);
6506         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6507         LDKEntropySource* this_arg_conv = (LDKEntropySource*)this_arg_ptr;
6508         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6509         memcpy(ret_arr->elems, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
6510         return ret_arr;
6511 }
6512
6513 uint32_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_ty_from_ptr"))) TS_LDKUnsignedGossipMessage_ty_from_ptr(uint64_t ptr) {
6514         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
6515         switch(obj->tag) {
6516                 case LDKUnsignedGossipMessage_ChannelAnnouncement: return 0;
6517                 case LDKUnsignedGossipMessage_ChannelUpdate: return 1;
6518                 case LDKUnsignedGossipMessage_NodeAnnouncement: return 2;
6519                 default: abort();
6520         }
6521 }
6522 uint64_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_ChannelAnnouncement_get_channel_announcement"))) TS_LDKUnsignedGossipMessage_ChannelAnnouncement_get_channel_announcement(uint64_t ptr) {
6523         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
6524         assert(obj->tag == LDKUnsignedGossipMessage_ChannelAnnouncement);
6525         LDKUnsignedChannelAnnouncement channel_announcement_var = obj->channel_announcement;
6526                         uint64_t channel_announcement_ref = 0;
6527                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_announcement_var);
6528                         channel_announcement_ref = tag_ptr(channel_announcement_var.inner, false);
6529         return channel_announcement_ref;
6530 }
6531 uint64_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_ChannelUpdate_get_channel_update"))) TS_LDKUnsignedGossipMessage_ChannelUpdate_get_channel_update(uint64_t ptr) {
6532         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
6533         assert(obj->tag == LDKUnsignedGossipMessage_ChannelUpdate);
6534         LDKUnsignedChannelUpdate channel_update_var = obj->channel_update;
6535                         uint64_t channel_update_ref = 0;
6536                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_update_var);
6537                         channel_update_ref = tag_ptr(channel_update_var.inner, false);
6538         return channel_update_ref;
6539 }
6540 uint64_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_NodeAnnouncement_get_node_announcement"))) TS_LDKUnsignedGossipMessage_NodeAnnouncement_get_node_announcement(uint64_t ptr) {
6541         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
6542         assert(obj->tag == LDKUnsignedGossipMessage_NodeAnnouncement);
6543         LDKUnsignedNodeAnnouncement node_announcement_var = obj->node_announcement;
6544                         uint64_t node_announcement_ref = 0;
6545                         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_announcement_var);
6546                         node_announcement_ref = tag_ptr(node_announcement_var.inner, false);
6547         return node_announcement_ref;
6548 }
6549 typedef struct LDKNodeSigner_JCalls {
6550         atomic_size_t refcnt;
6551         uint32_t instance_ptr;
6552 } LDKNodeSigner_JCalls;
6553 static void LDKNodeSigner_JCalls_free(void* this_arg) {
6554         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6555         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6556                 FREE(j_calls);
6557         }
6558 }
6559 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKNodeSigner_jcall(const void* this_arg) {
6560         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6561         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 23, 0, 0, 0, 0, 0, 0);
6562         LDKThirtyTwoBytes ret_ref;
6563         CHECK(ret->arr_len == 32);
6564         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
6565         return ret_ref;
6566 }
6567 LDKCResult_PublicKeyNoneZ get_node_id_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient) {
6568         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6569         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
6570         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 24, recipient_conv, 0, 0, 0, 0, 0);
6571         void* ret_ptr = untag_ptr(ret);
6572         CHECK_ACCESS(ret_ptr);
6573         LDKCResult_PublicKeyNoneZ ret_conv = *(LDKCResult_PublicKeyNoneZ*)(ret_ptr);
6574         FREE(untag_ptr(ret));
6575         return ret_conv;
6576 }
6577 LDKCResult_ThirtyTwoBytesNoneZ ecdh_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient, LDKPublicKey other_key, LDKCOption_BigEndianScalarZ tweak) {
6578         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6579         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
6580         int8_tArray other_key_arr = init_int8_tArray(33, __LINE__);
6581         memcpy(other_key_arr->elems, other_key.compressed_form, 33);
6582         LDKCOption_BigEndianScalarZ *tweak_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
6583         *tweak_copy = tweak;
6584         uint64_t tweak_ref = tag_ptr(tweak_copy, true);
6585         uint64_t ret = js_invoke_function_uubuuu(j_calls->instance_ptr, 25, recipient_conv, (uint32_t)other_key_arr, tweak_ref, 0, 0, 0);
6586         void* ret_ptr = untag_ptr(ret);
6587         CHECK_ACCESS(ret_ptr);
6588         LDKCResult_ThirtyTwoBytesNoneZ ret_conv = *(LDKCResult_ThirtyTwoBytesNoneZ*)(ret_ptr);
6589         FREE(untag_ptr(ret));
6590         return ret_conv;
6591 }
6592 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKNodeSigner_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_U5Z invoice_data, LDKRecipient recipient) {
6593         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6594         LDKu8slice hrp_bytes_var = hrp_bytes;
6595         int8_tArray hrp_bytes_arr = init_int8_tArray(hrp_bytes_var.datalen, __LINE__);
6596         memcpy(hrp_bytes_arr->elems, hrp_bytes_var.data, hrp_bytes_var.datalen);
6597         LDKCVec_U5Z invoice_data_var = invoice_data;
6598         ptrArray invoice_data_arr = NULL;
6599         invoice_data_arr = init_ptrArray(invoice_data_var.datalen, __LINE__);
6600         int8_t *invoice_data_arr_ptr = (int8_t*)(((uint8_t*)invoice_data_arr) + 8);
6601         for (size_t h = 0; h < invoice_data_var.datalen; h++) {
6602                 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
6603                 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
6604         }
6605         
6606         FREE(invoice_data_var.data);
6607         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
6608         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);
6609         void* ret_ptr = untag_ptr(ret);
6610         CHECK_ACCESS(ret_ptr);
6611         LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
6612         FREE(untag_ptr(ret));
6613         return ret_conv;
6614 }
6615 LDKCResult_SchnorrSignatureNoneZ sign_bolt12_invoice_request_LDKNodeSigner_jcall(const void* this_arg, const LDKUnsignedInvoiceRequest * invoice_request) {
6616         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6617         LDKUnsignedInvoiceRequest invoice_request_var = *invoice_request;
6618         uint64_t invoice_request_ref = 0;
6619         invoice_request_var = UnsignedInvoiceRequest_clone(&invoice_request_var);
6620         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_var);
6621         invoice_request_ref = tag_ptr(invoice_request_var.inner, invoice_request_var.is_owned);
6622         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 27, invoice_request_ref, 0, 0, 0, 0, 0);
6623         void* ret_ptr = untag_ptr(ret);
6624         CHECK_ACCESS(ret_ptr);
6625         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
6626         FREE(untag_ptr(ret));
6627         return ret_conv;
6628 }
6629 LDKCResult_SchnorrSignatureNoneZ sign_bolt12_invoice_LDKNodeSigner_jcall(const void* this_arg, const LDKUnsignedBolt12Invoice * invoice) {
6630         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6631         LDKUnsignedBolt12Invoice invoice_var = *invoice;
6632         uint64_t invoice_ref = 0;
6633         invoice_var = UnsignedBolt12Invoice_clone(&invoice_var);
6634         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_var);
6635         invoice_ref = tag_ptr(invoice_var.inner, invoice_var.is_owned);
6636         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 28, invoice_ref, 0, 0, 0, 0, 0);
6637         void* ret_ptr = untag_ptr(ret);
6638         CHECK_ACCESS(ret_ptr);
6639         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
6640         FREE(untag_ptr(ret));
6641         return ret_conv;
6642 }
6643 LDKCResult_ECDSASignatureNoneZ sign_gossip_message_LDKNodeSigner_jcall(const void* this_arg, LDKUnsignedGossipMessage msg) {
6644         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6645         LDKUnsignedGossipMessage *msg_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
6646         *msg_copy = msg;
6647         uint64_t msg_ref = tag_ptr(msg_copy, true);
6648         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 29, msg_ref, 0, 0, 0, 0, 0);
6649         void* ret_ptr = untag_ptr(ret);
6650         CHECK_ACCESS(ret_ptr);
6651         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
6652         FREE(untag_ptr(ret));
6653         return ret_conv;
6654 }
6655 static void LDKNodeSigner_JCalls_cloned(LDKNodeSigner* new_obj) {
6656         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) new_obj->this_arg;
6657         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6658 }
6659 static inline LDKNodeSigner LDKNodeSigner_init (JSValue o) {
6660         LDKNodeSigner_JCalls *calls = MALLOC(sizeof(LDKNodeSigner_JCalls), "LDKNodeSigner_JCalls");
6661         atomic_init(&calls->refcnt, 1);
6662         calls->instance_ptr = o;
6663
6664         LDKNodeSigner ret = {
6665                 .this_arg = (void*) calls,
6666                 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKNodeSigner_jcall,
6667                 .get_node_id = get_node_id_LDKNodeSigner_jcall,
6668                 .ecdh = ecdh_LDKNodeSigner_jcall,
6669                 .sign_invoice = sign_invoice_LDKNodeSigner_jcall,
6670                 .sign_bolt12_invoice_request = sign_bolt12_invoice_request_LDKNodeSigner_jcall,
6671                 .sign_bolt12_invoice = sign_bolt12_invoice_LDKNodeSigner_jcall,
6672                 .sign_gossip_message = sign_gossip_message_LDKNodeSigner_jcall,
6673                 .free = LDKNodeSigner_JCalls_free,
6674         };
6675         return ret;
6676 }
6677 uint64_t  __attribute__((export_name("TS_LDKNodeSigner_new"))) TS_LDKNodeSigner_new(JSValue o) {
6678         LDKNodeSigner *res_ptr = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
6679         *res_ptr = LDKNodeSigner_init(o);
6680         return tag_ptr(res_ptr, true);
6681 }
6682 int8_tArray  __attribute__((export_name("TS_NodeSigner_get_inbound_payment_key_material"))) TS_NodeSigner_get_inbound_payment_key_material(uint64_t this_arg) {
6683         void* this_arg_ptr = untag_ptr(this_arg);
6684         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6685         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6686         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6687         memcpy(ret_arr->elems, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data, 32);
6688         return ret_arr;
6689 }
6690
6691 uint64_t  __attribute__((export_name("TS_NodeSigner_get_node_id"))) TS_NodeSigner_get_node_id(uint64_t this_arg, uint32_t recipient) {
6692         void* this_arg_ptr = untag_ptr(this_arg);
6693         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6694         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6695         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
6696         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
6697         *ret_conv = (this_arg_conv->get_node_id)(this_arg_conv->this_arg, recipient_conv);
6698         return tag_ptr(ret_conv, true);
6699 }
6700
6701 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) {
6702         void* this_arg_ptr = untag_ptr(this_arg);
6703         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6704         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6705         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
6706         LDKPublicKey other_key_ref;
6707         CHECK(other_key->arr_len == 33);
6708         memcpy(other_key_ref.compressed_form, other_key->elems, 33); FREE(other_key);
6709         void* tweak_ptr = untag_ptr(tweak);
6710         CHECK_ACCESS(tweak_ptr);
6711         LDKCOption_BigEndianScalarZ tweak_conv = *(LDKCOption_BigEndianScalarZ*)(tweak_ptr);
6712         tweak_conv = COption_BigEndianScalarZ_clone((LDKCOption_BigEndianScalarZ*)untag_ptr(tweak));
6713         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
6714         *ret_conv = (this_arg_conv->ecdh)(this_arg_conv->this_arg, recipient_conv, other_key_ref, tweak_conv);
6715         return tag_ptr(ret_conv, true);
6716 }
6717
6718 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) {
6719         void* this_arg_ptr = untag_ptr(this_arg);
6720         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6721         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6722         LDKu8slice hrp_bytes_ref;
6723         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
6724         hrp_bytes_ref.data = hrp_bytes->elems;
6725         LDKCVec_U5Z invoice_data_constr;
6726         invoice_data_constr.datalen = invoice_data->arr_len;
6727         if (invoice_data_constr.datalen > 0)
6728                 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
6729         else
6730                 invoice_data_constr.data = NULL;
6731         int8_t* invoice_data_vals = (void*) invoice_data->elems;
6732         for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
6733                 int8_t invoice_data_conv_7 = invoice_data_vals[h];
6734                 
6735                 invoice_data_constr.data[h] = (LDKU5){ ._0 = invoice_data_conv_7 };
6736         }
6737         FREE(invoice_data);
6738         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
6739         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
6740         *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, recipient_conv);
6741         FREE(hrp_bytes);
6742         return tag_ptr(ret_conv, true);
6743 }
6744
6745 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) {
6746         void* this_arg_ptr = untag_ptr(this_arg);
6747         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6748         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6749         LDKUnsignedInvoiceRequest invoice_request_conv;
6750         invoice_request_conv.inner = untag_ptr(invoice_request);
6751         invoice_request_conv.is_owned = ptr_is_owned(invoice_request);
6752         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_conv);
6753         invoice_request_conv.is_owned = false;
6754         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
6755         *ret_conv = (this_arg_conv->sign_bolt12_invoice_request)(this_arg_conv->this_arg, &invoice_request_conv);
6756         return tag_ptr(ret_conv, true);
6757 }
6758
6759 uint64_t  __attribute__((export_name("TS_NodeSigner_sign_bolt12_invoice"))) TS_NodeSigner_sign_bolt12_invoice(uint64_t this_arg, uint64_t invoice) {
6760         void* this_arg_ptr = untag_ptr(this_arg);
6761         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6762         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6763         LDKUnsignedBolt12Invoice invoice_conv;
6764         invoice_conv.inner = untag_ptr(invoice);
6765         invoice_conv.is_owned = ptr_is_owned(invoice);
6766         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
6767         invoice_conv.is_owned = false;
6768         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
6769         *ret_conv = (this_arg_conv->sign_bolt12_invoice)(this_arg_conv->this_arg, &invoice_conv);
6770         return tag_ptr(ret_conv, true);
6771 }
6772
6773 uint64_t  __attribute__((export_name("TS_NodeSigner_sign_gossip_message"))) TS_NodeSigner_sign_gossip_message(uint64_t this_arg, uint64_t msg) {
6774         void* this_arg_ptr = untag_ptr(this_arg);
6775         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6776         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6777         void* msg_ptr = untag_ptr(msg);
6778         CHECK_ACCESS(msg_ptr);
6779         LDKUnsignedGossipMessage msg_conv = *(LDKUnsignedGossipMessage*)(msg_ptr);
6780         msg_conv = UnsignedGossipMessage_clone((LDKUnsignedGossipMessage*)untag_ptr(msg));
6781         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
6782         *ret_conv = (this_arg_conv->sign_gossip_message)(this_arg_conv->this_arg, msg_conv);
6783         return tag_ptr(ret_conv, true);
6784 }
6785
6786 typedef struct LDKSignerProvider_JCalls {
6787         atomic_size_t refcnt;
6788         uint32_t instance_ptr;
6789 } LDKSignerProvider_JCalls;
6790 static void LDKSignerProvider_JCalls_free(void* this_arg) {
6791         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6792         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6793                 FREE(j_calls);
6794         }
6795 }
6796 LDKThirtyTwoBytes generate_channel_keys_id_LDKSignerProvider_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis, LDKU128 user_channel_id) {
6797         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6798         jboolean inbound_conv = inbound;
6799         int64_t channel_value_satoshis_conv = channel_value_satoshis;
6800         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
6801         memcpy(user_channel_id_arr->elems, user_channel_id.le_bytes, 16);
6802         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);
6803         LDKThirtyTwoBytes ret_ref;
6804         CHECK(ret->arr_len == 32);
6805         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
6806         return ret_ref;
6807 }
6808 LDKWriteableEcdsaChannelSigner derive_channel_signer_LDKSignerProvider_jcall(const void* this_arg, uint64_t channel_value_satoshis, LDKThirtyTwoBytes channel_keys_id) {
6809         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6810         int64_t channel_value_satoshis_conv = channel_value_satoshis;
6811         int8_tArray channel_keys_id_arr = init_int8_tArray(32, __LINE__);
6812         memcpy(channel_keys_id_arr->elems, channel_keys_id.data, 32);
6813         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);
6814         void* ret_ptr = untag_ptr(ret);
6815         CHECK_ACCESS(ret_ptr);
6816         LDKWriteableEcdsaChannelSigner ret_conv = *(LDKWriteableEcdsaChannelSigner*)(ret_ptr);
6817         FREE(untag_ptr(ret));
6818         return ret_conv;
6819 }
6820 LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ read_chan_signer_LDKSignerProvider_jcall(const void* this_arg, LDKu8slice reader) {
6821         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6822         LDKu8slice reader_var = reader;
6823         int8_tArray reader_arr = init_int8_tArray(reader_var.datalen, __LINE__);
6824         memcpy(reader_arr->elems, reader_var.data, reader_var.datalen);
6825         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 32, (uint32_t)reader_arr, 0, 0, 0, 0, 0);
6826         void* ret_ptr = untag_ptr(ret);
6827         CHECK_ACCESS(ret_ptr);
6828         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ ret_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(ret_ptr);
6829         FREE(untag_ptr(ret));
6830         return ret_conv;
6831 }
6832 LDKCResult_CVec_u8ZNoneZ get_destination_script_LDKSignerProvider_jcall(const void* this_arg, LDKThirtyTwoBytes channel_keys_id) {
6833         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6834         int8_tArray channel_keys_id_arr = init_int8_tArray(32, __LINE__);
6835         memcpy(channel_keys_id_arr->elems, channel_keys_id.data, 32);
6836         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 33, (uint32_t)channel_keys_id_arr, 0, 0, 0, 0, 0);
6837         void* ret_ptr = untag_ptr(ret);
6838         CHECK_ACCESS(ret_ptr);
6839         LDKCResult_CVec_u8ZNoneZ ret_conv = *(LDKCResult_CVec_u8ZNoneZ*)(ret_ptr);
6840         FREE(untag_ptr(ret));
6841         return ret_conv;
6842 }
6843 LDKCResult_ShutdownScriptNoneZ get_shutdown_scriptpubkey_LDKSignerProvider_jcall(const void* this_arg) {
6844         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6845         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 34, 0, 0, 0, 0, 0, 0);
6846         void* ret_ptr = untag_ptr(ret);
6847         CHECK_ACCESS(ret_ptr);
6848         LDKCResult_ShutdownScriptNoneZ ret_conv = *(LDKCResult_ShutdownScriptNoneZ*)(ret_ptr);
6849         FREE(untag_ptr(ret));
6850         return ret_conv;
6851 }
6852 static void LDKSignerProvider_JCalls_cloned(LDKSignerProvider* new_obj) {
6853         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) new_obj->this_arg;
6854         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6855 }
6856 static inline LDKSignerProvider LDKSignerProvider_init (JSValue o) {
6857         LDKSignerProvider_JCalls *calls = MALLOC(sizeof(LDKSignerProvider_JCalls), "LDKSignerProvider_JCalls");
6858         atomic_init(&calls->refcnt, 1);
6859         calls->instance_ptr = o;
6860
6861         LDKSignerProvider ret = {
6862                 .this_arg = (void*) calls,
6863                 .generate_channel_keys_id = generate_channel_keys_id_LDKSignerProvider_jcall,
6864                 .derive_channel_signer = derive_channel_signer_LDKSignerProvider_jcall,
6865                 .read_chan_signer = read_chan_signer_LDKSignerProvider_jcall,
6866                 .get_destination_script = get_destination_script_LDKSignerProvider_jcall,
6867                 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKSignerProvider_jcall,
6868                 .free = LDKSignerProvider_JCalls_free,
6869         };
6870         return ret;
6871 }
6872 uint64_t  __attribute__((export_name("TS_LDKSignerProvider_new"))) TS_LDKSignerProvider_new(JSValue o) {
6873         LDKSignerProvider *res_ptr = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
6874         *res_ptr = LDKSignerProvider_init(o);
6875         return tag_ptr(res_ptr, true);
6876 }
6877 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) {
6878         void* this_arg_ptr = untag_ptr(this_arg);
6879         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6880         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
6881         LDKU128 user_channel_id_ref;
6882         CHECK(user_channel_id->arr_len == 16);
6883         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
6884         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6885         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);
6886         return ret_arr;
6887 }
6888
6889 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) {
6890         void* this_arg_ptr = untag_ptr(this_arg);
6891         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6892         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
6893         LDKThirtyTwoBytes channel_keys_id_ref;
6894         CHECK(channel_keys_id->arr_len == 32);
6895         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
6896         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
6897         *ret_ret = (this_arg_conv->derive_channel_signer)(this_arg_conv->this_arg, channel_value_satoshis, channel_keys_id_ref);
6898         return tag_ptr(ret_ret, true);
6899 }
6900
6901 uint64_t  __attribute__((export_name("TS_SignerProvider_read_chan_signer"))) TS_SignerProvider_read_chan_signer(uint64_t this_arg, int8_tArray reader) {
6902         void* this_arg_ptr = untag_ptr(this_arg);
6903         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6904         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
6905         LDKu8slice reader_ref;
6906         reader_ref.datalen = reader->arr_len;
6907         reader_ref.data = reader->elems;
6908         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
6909         *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
6910         FREE(reader);
6911         return tag_ptr(ret_conv, true);
6912 }
6913
6914 uint64_t  __attribute__((export_name("TS_SignerProvider_get_destination_script"))) TS_SignerProvider_get_destination_script(uint64_t this_arg, int8_tArray channel_keys_id) {
6915         void* this_arg_ptr = untag_ptr(this_arg);
6916         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6917         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
6918         LDKThirtyTwoBytes channel_keys_id_ref;
6919         CHECK(channel_keys_id->arr_len == 32);
6920         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
6921         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
6922         *ret_conv = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg, channel_keys_id_ref);
6923         return tag_ptr(ret_conv, true);
6924 }
6925
6926 uint64_t  __attribute__((export_name("TS_SignerProvider_get_shutdown_scriptpubkey"))) TS_SignerProvider_get_shutdown_scriptpubkey(uint64_t this_arg) {
6927         void* this_arg_ptr = untag_ptr(this_arg);
6928         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6929         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
6930         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
6931         *ret_conv = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
6932         return tag_ptr(ret_conv, true);
6933 }
6934
6935 typedef struct LDKFeeEstimator_JCalls {
6936         atomic_size_t refcnt;
6937         uint32_t instance_ptr;
6938 } LDKFeeEstimator_JCalls;
6939 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
6940         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
6941         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6942                 FREE(j_calls);
6943         }
6944 }
6945 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
6946         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
6947         uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
6948         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 35, confirmation_target_conv, 0, 0, 0, 0, 0);
6949 }
6950 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
6951         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
6952         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6953 }
6954 static inline LDKFeeEstimator LDKFeeEstimator_init (JSValue o) {
6955         LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
6956         atomic_init(&calls->refcnt, 1);
6957         calls->instance_ptr = o;
6958
6959         LDKFeeEstimator ret = {
6960                 .this_arg = (void*) calls,
6961                 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
6962                 .free = LDKFeeEstimator_JCalls_free,
6963         };
6964         return ret;
6965 }
6966 uint64_t  __attribute__((export_name("TS_LDKFeeEstimator_new"))) TS_LDKFeeEstimator_new(JSValue o) {
6967         LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
6968         *res_ptr = LDKFeeEstimator_init(o);
6969         return tag_ptr(res_ptr, true);
6970 }
6971 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) {
6972         void* this_arg_ptr = untag_ptr(this_arg);
6973         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6974         LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
6975         LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
6976         int32_t ret_conv = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
6977         return ret_conv;
6978 }
6979
6980 typedef struct LDKMessageRouter_JCalls {
6981         atomic_size_t refcnt;
6982         uint32_t instance_ptr;
6983 } LDKMessageRouter_JCalls;
6984 static void LDKMessageRouter_JCalls_free(void* this_arg) {
6985         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
6986         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6987                 FREE(j_calls);
6988         }
6989 }
6990 LDKCResult_OnionMessagePathNoneZ find_path_LDKMessageRouter_jcall(const void* this_arg, LDKPublicKey sender, LDKCVec_PublicKeyZ peers, LDKDestination destination) {
6991         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
6992         int8_tArray sender_arr = init_int8_tArray(33, __LINE__);
6993         memcpy(sender_arr->elems, sender.compressed_form, 33);
6994         LDKCVec_PublicKeyZ peers_var = peers;
6995         ptrArray peers_arr = NULL;
6996         peers_arr = init_ptrArray(peers_var.datalen, __LINE__);
6997         int8_tArray *peers_arr_ptr = (int8_tArray*)(((uint8_t*)peers_arr) + 8);
6998         for (size_t m = 0; m < peers_var.datalen; m++) {
6999                 int8_tArray peers_conv_12_arr = init_int8_tArray(33, __LINE__);
7000                 memcpy(peers_conv_12_arr->elems, peers_var.data[m].compressed_form, 33);
7001                 peers_arr_ptr[m] = peers_conv_12_arr;
7002         }
7003         
7004         FREE(peers_var.data);
7005         LDKDestination *destination_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
7006         *destination_copy = destination;
7007         uint64_t destination_ref = tag_ptr(destination_copy, true);
7008         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);
7009         void* ret_ptr = untag_ptr(ret);
7010         CHECK_ACCESS(ret_ptr);
7011         LDKCResult_OnionMessagePathNoneZ ret_conv = *(LDKCResult_OnionMessagePathNoneZ*)(ret_ptr);
7012         FREE(untag_ptr(ret));
7013         return ret_conv;
7014 }
7015 LDKCResult_CVec_BlindedPathZNoneZ create_blinded_paths_LDKMessageRouter_jcall(const void* this_arg, LDKPublicKey recipient, LDKCVec_PublicKeyZ peers) {
7016         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
7017         int8_tArray recipient_arr = init_int8_tArray(33, __LINE__);
7018         memcpy(recipient_arr->elems, recipient.compressed_form, 33);
7019         LDKCVec_PublicKeyZ peers_var = peers;
7020         ptrArray peers_arr = NULL;
7021         peers_arr = init_ptrArray(peers_var.datalen, __LINE__);
7022         int8_tArray *peers_arr_ptr = (int8_tArray*)(((uint8_t*)peers_arr) + 8);
7023         for (size_t m = 0; m < peers_var.datalen; m++) {
7024                 int8_tArray peers_conv_12_arr = init_int8_tArray(33, __LINE__);
7025                 memcpy(peers_conv_12_arr->elems, peers_var.data[m].compressed_form, 33);
7026                 peers_arr_ptr[m] = peers_conv_12_arr;
7027         }
7028         
7029         FREE(peers_var.data);
7030         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 37, (uint32_t)recipient_arr, (uint32_t)peers_arr, 0, 0, 0, 0);
7031         void* ret_ptr = untag_ptr(ret);
7032         CHECK_ACCESS(ret_ptr);
7033         LDKCResult_CVec_BlindedPathZNoneZ ret_conv = *(LDKCResult_CVec_BlindedPathZNoneZ*)(ret_ptr);
7034         FREE(untag_ptr(ret));
7035         return ret_conv;
7036 }
7037 static void LDKMessageRouter_JCalls_cloned(LDKMessageRouter* new_obj) {
7038         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) new_obj->this_arg;
7039         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7040 }
7041 static inline LDKMessageRouter LDKMessageRouter_init (JSValue o) {
7042         LDKMessageRouter_JCalls *calls = MALLOC(sizeof(LDKMessageRouter_JCalls), "LDKMessageRouter_JCalls");
7043         atomic_init(&calls->refcnt, 1);
7044         calls->instance_ptr = o;
7045
7046         LDKMessageRouter ret = {
7047                 .this_arg = (void*) calls,
7048                 .find_path = find_path_LDKMessageRouter_jcall,
7049                 .create_blinded_paths = create_blinded_paths_LDKMessageRouter_jcall,
7050                 .free = LDKMessageRouter_JCalls_free,
7051         };
7052         return ret;
7053 }
7054 uint64_t  __attribute__((export_name("TS_LDKMessageRouter_new"))) TS_LDKMessageRouter_new(JSValue o) {
7055         LDKMessageRouter *res_ptr = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
7056         *res_ptr = LDKMessageRouter_init(o);
7057         return tag_ptr(res_ptr, true);
7058 }
7059 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) {
7060         void* this_arg_ptr = untag_ptr(this_arg);
7061         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7062         LDKMessageRouter* this_arg_conv = (LDKMessageRouter*)this_arg_ptr;
7063         LDKPublicKey sender_ref;
7064         CHECK(sender->arr_len == 33);
7065         memcpy(sender_ref.compressed_form, sender->elems, 33); FREE(sender);
7066         LDKCVec_PublicKeyZ peers_constr;
7067         peers_constr.datalen = peers->arr_len;
7068         if (peers_constr.datalen > 0)
7069                 peers_constr.data = MALLOC(peers_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
7070         else
7071                 peers_constr.data = NULL;
7072         int8_tArray* peers_vals = (void*) peers->elems;
7073         for (size_t m = 0; m < peers_constr.datalen; m++) {
7074                 int8_tArray peers_conv_12 = peers_vals[m];
7075                 LDKPublicKey peers_conv_12_ref;
7076                 CHECK(peers_conv_12->arr_len == 33);
7077                 memcpy(peers_conv_12_ref.compressed_form, peers_conv_12->elems, 33); FREE(peers_conv_12);
7078                 peers_constr.data[m] = peers_conv_12_ref;
7079         }
7080         FREE(peers);
7081         void* destination_ptr = untag_ptr(destination);
7082         CHECK_ACCESS(destination_ptr);
7083         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
7084         destination_conv = Destination_clone((LDKDestination*)untag_ptr(destination));
7085         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
7086         *ret_conv = (this_arg_conv->find_path)(this_arg_conv->this_arg, sender_ref, peers_constr, destination_conv);
7087         return tag_ptr(ret_conv, true);
7088 }
7089
7090 uint64_t  __attribute__((export_name("TS_MessageRouter_create_blinded_paths"))) TS_MessageRouter_create_blinded_paths(uint64_t this_arg, int8_tArray recipient, ptrArray peers) {
7091         void* this_arg_ptr = untag_ptr(this_arg);
7092         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7093         LDKMessageRouter* this_arg_conv = (LDKMessageRouter*)this_arg_ptr;
7094         LDKPublicKey recipient_ref;
7095         CHECK(recipient->arr_len == 33);
7096         memcpy(recipient_ref.compressed_form, recipient->elems, 33); FREE(recipient);
7097         LDKCVec_PublicKeyZ peers_constr;
7098         peers_constr.datalen = peers->arr_len;
7099         if (peers_constr.datalen > 0)
7100                 peers_constr.data = MALLOC(peers_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
7101         else
7102                 peers_constr.data = NULL;
7103         int8_tArray* peers_vals = (void*) peers->elems;
7104         for (size_t m = 0; m < peers_constr.datalen; m++) {
7105                 int8_tArray peers_conv_12 = peers_vals[m];
7106                 LDKPublicKey peers_conv_12_ref;
7107                 CHECK(peers_conv_12->arr_len == 33);
7108                 memcpy(peers_conv_12_ref.compressed_form, peers_conv_12->elems, 33); FREE(peers_conv_12);
7109                 peers_constr.data[m] = peers_conv_12_ref;
7110         }
7111         FREE(peers);
7112         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
7113         *ret_conv = (this_arg_conv->create_blinded_paths)(this_arg_conv->this_arg, recipient_ref, peers_constr);
7114         return tag_ptr(ret_conv, true);
7115 }
7116
7117 typedef struct LDKRouter_JCalls {
7118         atomic_size_t refcnt;
7119         uint32_t instance_ptr;
7120         LDKMessageRouter_JCalls* MessageRouter;
7121 } LDKRouter_JCalls;
7122 static void LDKRouter_JCalls_free(void* this_arg) {
7123         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
7124         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7125                 FREE(j_calls);
7126         }
7127 }
7128 LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, LDKCVec_ChannelDetailsZ * first_hops, LDKInFlightHtlcs inflight_htlcs) {
7129         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
7130         int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
7131         memcpy(payer_arr->elems, payer.compressed_form, 33);
7132         LDKRouteParameters route_params_var = *route_params;
7133         uint64_t route_params_ref = 0;
7134         route_params_var = RouteParameters_clone(&route_params_var);
7135         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
7136         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
7137         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
7138         uint64_tArray first_hops_arr = NULL;
7139         if (first_hops != NULL) {
7140                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
7141                 first_hops_arr = init_uint64_tArray(first_hops_var.datalen, __LINE__);
7142                 uint64_t *first_hops_arr_ptr = (uint64_t*)(((uint8_t*)first_hops_arr) + 8);
7143                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
7144                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
7145                         uint64_t first_hops_conv_16_ref = 0;
7146                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
7147                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
7148                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
7149                 }
7150         
7151         }
7152         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
7153         uint64_t inflight_htlcs_ref = 0;
7154         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
7155         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
7156         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);
7157         void* ret_ptr = untag_ptr(ret);
7158         CHECK_ACCESS(ret_ptr);
7159         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
7160         FREE(untag_ptr(ret));
7161         return ret_conv;
7162 }
7163 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) {
7164         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
7165         int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
7166         memcpy(payer_arr->elems, payer.compressed_form, 33);
7167         LDKRouteParameters route_params_var = *route_params;
7168         uint64_t route_params_ref = 0;
7169         route_params_var = RouteParameters_clone(&route_params_var);
7170         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
7171         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
7172         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
7173         uint64_tArray first_hops_arr = NULL;
7174         if (first_hops != NULL) {
7175                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
7176                 first_hops_arr = init_uint64_tArray(first_hops_var.datalen, __LINE__);
7177                 uint64_t *first_hops_arr_ptr = (uint64_t*)(((uint8_t*)first_hops_arr) + 8);
7178                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
7179                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
7180                         uint64_t first_hops_conv_16_ref = 0;
7181                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
7182                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
7183                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
7184                 }
7185         
7186         }
7187         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
7188         uint64_t inflight_htlcs_ref = 0;
7189         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
7190         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
7191         int8_tArray _payment_hash_arr = init_int8_tArray(32, __LINE__);
7192         memcpy(_payment_hash_arr->elems, _payment_hash.data, 32);
7193         int8_tArray _payment_id_arr = init_int8_tArray(32, __LINE__);
7194         memcpy(_payment_id_arr->elems, _payment_id.data, 32);
7195         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);
7196         void* ret_ptr = untag_ptr(ret);
7197         CHECK_ACCESS(ret_ptr);
7198         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
7199         FREE(untag_ptr(ret));
7200         return ret_conv;
7201 }
7202 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) {
7203         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
7204         int8_tArray recipient_arr = init_int8_tArray(33, __LINE__);
7205         memcpy(recipient_arr->elems, recipient.compressed_form, 33);
7206         LDKCVec_ChannelDetailsZ first_hops_var = first_hops;
7207         uint64_tArray first_hops_arr = NULL;
7208         first_hops_arr = init_uint64_tArray(first_hops_var.datalen, __LINE__);
7209         uint64_t *first_hops_arr_ptr = (uint64_t*)(((uint8_t*)first_hops_arr) + 8);
7210         for (size_t q = 0; q < first_hops_var.datalen; q++) {
7211                 LDKChannelDetails first_hops_conv_16_var = first_hops_var.data[q];
7212                 uint64_t first_hops_conv_16_ref = 0;
7213                 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
7214                 first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
7215                 first_hops_arr_ptr[q] = first_hops_conv_16_ref;
7216         }
7217         
7218         FREE(first_hops_var.data);
7219         LDKReceiveTlvs tlvs_var = tlvs;
7220         uint64_t tlvs_ref = 0;
7221         CHECK_INNER_FIELD_ACCESS_OR_NULL(tlvs_var);
7222         tlvs_ref = tag_ptr(tlvs_var.inner, tlvs_var.is_owned);
7223         int64_t amount_msats_conv = amount_msats;
7224         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);
7225         void* ret_ptr = untag_ptr(ret);
7226         CHECK_ACCESS(ret_ptr);
7227         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ ret_conv = *(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)(ret_ptr);
7228         FREE(untag_ptr(ret));
7229         return ret_conv;
7230 }
7231 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
7232         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
7233         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7234         atomic_fetch_add_explicit(&j_calls->MessageRouter->refcnt, 1, memory_order_release);
7235 }
7236 static inline LDKRouter LDKRouter_init (JSValue o, JSValue MessageRouter) {
7237         LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
7238         atomic_init(&calls->refcnt, 1);
7239         calls->instance_ptr = o;
7240
7241         LDKRouter ret = {
7242                 .this_arg = (void*) calls,
7243                 .find_route = find_route_LDKRouter_jcall,
7244                 .find_route_with_id = find_route_with_id_LDKRouter_jcall,
7245                 .create_blinded_payment_paths = create_blinded_payment_paths_LDKRouter_jcall,
7246                 .free = LDKRouter_JCalls_free,
7247                 .MessageRouter = LDKMessageRouter_init(MessageRouter),
7248         };
7249         calls->MessageRouter = ret.MessageRouter.this_arg;
7250         return ret;
7251 }
7252 uint64_t  __attribute__((export_name("TS_LDKRouter_new"))) TS_LDKRouter_new(JSValue o, JSValue MessageRouter) {
7253         LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
7254         *res_ptr = LDKRouter_init(o, MessageRouter);
7255         return tag_ptr(res_ptr, true);
7256 }
7257 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) {
7258         void* this_arg_ptr = untag_ptr(this_arg);
7259         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7260         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
7261         LDKPublicKey payer_ref;
7262         CHECK(payer->arr_len == 33);
7263         memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
7264         LDKRouteParameters route_params_conv;
7265         route_params_conv.inner = untag_ptr(route_params);
7266         route_params_conv.is_owned = ptr_is_owned(route_params);
7267         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
7268         route_params_conv.is_owned = false;
7269         LDKCVec_ChannelDetailsZ first_hops_constr;
7270         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
7271         if (first_hops != 0) {
7272                 first_hops_constr.datalen = first_hops->arr_len;
7273                 if (first_hops_constr.datalen > 0)
7274                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
7275                 else
7276                         first_hops_constr.data = NULL;
7277                 uint64_t* first_hops_vals = first_hops->elems;
7278                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
7279                         uint64_t first_hops_conv_16 = first_hops_vals[q];
7280                         LDKChannelDetails first_hops_conv_16_conv;
7281                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
7282                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
7283                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
7284                         first_hops_conv_16_conv.is_owned = false;
7285                         first_hops_constr.data[q] = first_hops_conv_16_conv;
7286                 }
7287                 FREE(first_hops);
7288                 first_hops_ptr = &first_hops_constr;
7289         }
7290         LDKInFlightHtlcs inflight_htlcs_conv;
7291         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
7292         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
7293         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
7294         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
7295         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7296         *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, &route_params_conv, first_hops_ptr, inflight_htlcs_conv);
7297         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
7298         return tag_ptr(ret_conv, true);
7299 }
7300
7301 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) {
7302         void* this_arg_ptr = untag_ptr(this_arg);
7303         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7304         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
7305         LDKPublicKey payer_ref;
7306         CHECK(payer->arr_len == 33);
7307         memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
7308         LDKRouteParameters route_params_conv;
7309         route_params_conv.inner = untag_ptr(route_params);
7310         route_params_conv.is_owned = ptr_is_owned(route_params);
7311         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
7312         route_params_conv.is_owned = false;
7313         LDKCVec_ChannelDetailsZ first_hops_constr;
7314         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
7315         if (first_hops != 0) {
7316                 first_hops_constr.datalen = first_hops->arr_len;
7317                 if (first_hops_constr.datalen > 0)
7318                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
7319                 else
7320                         first_hops_constr.data = NULL;
7321                 uint64_t* first_hops_vals = first_hops->elems;
7322                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
7323                         uint64_t first_hops_conv_16 = first_hops_vals[q];
7324                         LDKChannelDetails first_hops_conv_16_conv;
7325                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
7326                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
7327                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
7328                         first_hops_conv_16_conv.is_owned = false;
7329                         first_hops_constr.data[q] = first_hops_conv_16_conv;
7330                 }
7331                 FREE(first_hops);
7332                 first_hops_ptr = &first_hops_constr;
7333         }
7334         LDKInFlightHtlcs inflight_htlcs_conv;
7335         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
7336         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
7337         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
7338         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
7339         LDKThirtyTwoBytes _payment_hash_ref;
7340         CHECK(_payment_hash->arr_len == 32);
7341         memcpy(_payment_hash_ref.data, _payment_hash->elems, 32); FREE(_payment_hash);
7342         LDKThirtyTwoBytes _payment_id_ref;
7343         CHECK(_payment_id->arr_len == 32);
7344         memcpy(_payment_id_ref.data, _payment_id->elems, 32); FREE(_payment_id);
7345         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7346         *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);
7347         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
7348         return tag_ptr(ret_conv, true);
7349 }
7350
7351 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) {
7352         void* this_arg_ptr = untag_ptr(this_arg);
7353         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7354         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
7355         LDKPublicKey recipient_ref;
7356         CHECK(recipient->arr_len == 33);
7357         memcpy(recipient_ref.compressed_form, recipient->elems, 33); FREE(recipient);
7358         LDKCVec_ChannelDetailsZ first_hops_constr;
7359         first_hops_constr.datalen = first_hops->arr_len;
7360         if (first_hops_constr.datalen > 0)
7361                 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
7362         else
7363                 first_hops_constr.data = NULL;
7364         uint64_t* first_hops_vals = first_hops->elems;
7365         for (size_t q = 0; q < first_hops_constr.datalen; q++) {
7366                 uint64_t first_hops_conv_16 = first_hops_vals[q];
7367                 LDKChannelDetails first_hops_conv_16_conv;
7368                 first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
7369                 first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
7370                 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
7371                 first_hops_conv_16_conv = ChannelDetails_clone(&first_hops_conv_16_conv);
7372                 first_hops_constr.data[q] = first_hops_conv_16_conv;
7373         }
7374         FREE(first_hops);
7375         LDKReceiveTlvs tlvs_conv;
7376         tlvs_conv.inner = untag_ptr(tlvs);
7377         tlvs_conv.is_owned = ptr_is_owned(tlvs);
7378         CHECK_INNER_FIELD_ACCESS_OR_NULL(tlvs_conv);
7379         tlvs_conv = ReceiveTlvs_clone(&tlvs_conv);
7380         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
7381         *ret_conv = (this_arg_conv->create_blinded_payment_paths)(this_arg_conv->this_arg, recipient_ref, first_hops_constr, tlvs_conv, amount_msats);
7382         return tag_ptr(ret_conv, true);
7383 }
7384
7385 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *NONNULL_PTR owner){
7386         return ThirtyTwoBytes_clone(&owner->a);
7387 }
7388 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(uint64_t owner) {
7389         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)untag_ptr(owner);
7390         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
7391         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(owner_conv).data, 32);
7392         return ret_arr;
7393 }
7394
7395 static inline struct LDKChannelManager C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *NONNULL_PTR owner){
7396         LDKChannelManager ret = owner->b;
7397         ret.is_owned = false;
7398         return ret;
7399 }
7400 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(uint64_t owner) {
7401         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)untag_ptr(owner);
7402         LDKChannelManager ret_var = C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(owner_conv);
7403         uint64_t ret_ref = 0;
7404         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7405         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7406         return ret_ref;
7407 }
7408
7409 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
7410 CHECK(owner->result_ok);
7411         return &*owner->contents.result;
7412 }
7413 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(uint64_t owner) {
7414         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(owner);
7415         uint64_t ret_ret = tag_ptr(CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(owner_conv), false);
7416         return ret_ret;
7417 }
7418
7419 static inline struct LDKDecodeError CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
7420 CHECK(!owner->result_ok);
7421         return DecodeError_clone(&*owner->contents.err);
7422 }
7423 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(uint64_t owner) {
7424         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(owner);
7425         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7426         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(owner_conv);
7427         uint64_t ret_ref = tag_ptr(ret_copy, true);
7428         return ret_ref;
7429 }
7430
7431 uint32_t __attribute__((export_name("TS_LDKMaxDustHTLCExposure_ty_from_ptr"))) TS_LDKMaxDustHTLCExposure_ty_from_ptr(uint64_t ptr) {
7432         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
7433         switch(obj->tag) {
7434                 case LDKMaxDustHTLCExposure_FixedLimitMsat: return 0;
7435                 case LDKMaxDustHTLCExposure_FeeRateMultiplier: return 1;
7436                 default: abort();
7437         }
7438 }
7439 int64_t __attribute__((export_name("TS_LDKMaxDustHTLCExposure_FixedLimitMsat_get_fixed_limit_msat"))) TS_LDKMaxDustHTLCExposure_FixedLimitMsat_get_fixed_limit_msat(uint64_t ptr) {
7440         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
7441         assert(obj->tag == LDKMaxDustHTLCExposure_FixedLimitMsat);
7442         int64_t fixed_limit_msat_conv = obj->fixed_limit_msat;
7443         return fixed_limit_msat_conv;
7444 }
7445 int64_t __attribute__((export_name("TS_LDKMaxDustHTLCExposure_FeeRateMultiplier_get_fee_rate_multiplier"))) TS_LDKMaxDustHTLCExposure_FeeRateMultiplier_get_fee_rate_multiplier(uint64_t ptr) {
7446         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
7447         assert(obj->tag == LDKMaxDustHTLCExposure_FeeRateMultiplier);
7448         int64_t fee_rate_multiplier_conv = obj->fee_rate_multiplier;
7449         return fee_rate_multiplier_conv;
7450 }
7451 static inline struct LDKMaxDustHTLCExposure CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR owner){
7452 CHECK(owner->result_ok);
7453         return MaxDustHTLCExposure_clone(&*owner->contents.result);
7454 }
7455 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(uint64_t owner) {
7456         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* owner_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(owner);
7457         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
7458         *ret_copy = CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(owner_conv);
7459         uint64_t ret_ref = tag_ptr(ret_copy, true);
7460         return ret_ref;
7461 }
7462
7463 static inline struct LDKDecodeError CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR owner){
7464 CHECK(!owner->result_ok);
7465         return DecodeError_clone(&*owner->contents.err);
7466 }
7467 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_get_err"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(uint64_t owner) {
7468         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* owner_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(owner);
7469         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7470         *ret_copy = CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(owner_conv);
7471         uint64_t ret_ref = tag_ptr(ret_copy, true);
7472         return ret_ref;
7473 }
7474
7475 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
7476         LDKChannelConfig ret = *owner->contents.result;
7477         ret.is_owned = false;
7478         return ret;
7479 }
7480 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_get_ok(uint64_t owner) {
7481         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
7482         LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
7483         uint64_t ret_ref = 0;
7484         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7485         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7486         return ret_ref;
7487 }
7488
7489 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
7490 CHECK(!owner->result_ok);
7491         return DecodeError_clone(&*owner->contents.err);
7492 }
7493 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_err"))) TS_CResult_ChannelConfigDecodeErrorZ_get_err(uint64_t owner) {
7494         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
7495         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7496         *ret_copy = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
7497         uint64_t ret_ref = tag_ptr(ret_copy, true);
7498         return ret_ref;
7499 }
7500
7501 uint32_t __attribute__((export_name("TS_LDKCOption_MaxDustHTLCExposureZ_ty_from_ptr"))) TS_LDKCOption_MaxDustHTLCExposureZ_ty_from_ptr(uint64_t ptr) {
7502         LDKCOption_MaxDustHTLCExposureZ *obj = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(ptr);
7503         switch(obj->tag) {
7504                 case LDKCOption_MaxDustHTLCExposureZ_Some: return 0;
7505                 case LDKCOption_MaxDustHTLCExposureZ_None: return 1;
7506                 default: abort();
7507         }
7508 }
7509 uint64_t __attribute__((export_name("TS_LDKCOption_MaxDustHTLCExposureZ_Some_get_some"))) TS_LDKCOption_MaxDustHTLCExposureZ_Some_get_some(uint64_t ptr) {
7510         LDKCOption_MaxDustHTLCExposureZ *obj = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(ptr);
7511         assert(obj->tag == LDKCOption_MaxDustHTLCExposureZ_Some);
7512         uint64_t some_ref = tag_ptr(&obj->some, false);
7513         return some_ref;
7514 }
7515 uint32_t __attribute__((export_name("TS_LDKCOption_APIErrorZ_ty_from_ptr"))) TS_LDKCOption_APIErrorZ_ty_from_ptr(uint64_t ptr) {
7516         LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr);
7517         switch(obj->tag) {
7518                 case LDKCOption_APIErrorZ_Some: return 0;
7519                 case LDKCOption_APIErrorZ_None: return 1;
7520                 default: abort();
7521         }
7522 }
7523 uint64_t __attribute__((export_name("TS_LDKCOption_APIErrorZ_Some_get_some"))) TS_LDKCOption_APIErrorZ_Some_get_some(uint64_t ptr) {
7524         LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr);
7525         assert(obj->tag == LDKCOption_APIErrorZ_Some);
7526         uint64_t some_ref = tag_ptr(&obj->some, false);
7527         return some_ref;
7528 }
7529 static inline struct LDKCOption_APIErrorZ CResult_COption_APIErrorZDecodeErrorZ_get_ok(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
7530 CHECK(owner->result_ok);
7531         return COption_APIErrorZ_clone(&*owner->contents.result);
7532 }
7533 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_get_ok"))) TS_CResult_COption_APIErrorZDecodeErrorZ_get_ok(uint64_t owner) {
7534         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
7535         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
7536         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_ok(owner_conv);
7537         uint64_t ret_ref = tag_ptr(ret_copy, true);
7538         return ret_ref;
7539 }
7540
7541 static inline struct LDKDecodeError CResult_COption_APIErrorZDecodeErrorZ_get_err(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
7542 CHECK(!owner->result_ok);
7543         return DecodeError_clone(&*owner->contents.err);
7544 }
7545 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_get_err"))) TS_CResult_COption_APIErrorZDecodeErrorZ_get_err(uint64_t owner) {
7546         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
7547         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7548         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_err(owner_conv);
7549         uint64_t ret_ref = tag_ptr(ret_copy, true);
7550         return ret_ref;
7551 }
7552
7553 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
7554         LDKChannelMonitorUpdate ret = *owner->contents.result;
7555         ret.is_owned = false;
7556         return ret;
7557 }
7558 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint64_t owner) {
7559         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
7560         LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
7561         uint64_t ret_ref = 0;
7562         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7563         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7564         return ret_ref;
7565 }
7566
7567 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
7568 CHECK(!owner->result_ok);
7569         return DecodeError_clone(&*owner->contents.err);
7570 }
7571 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint64_t owner) {
7572         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
7573         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7574         *ret_copy = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
7575         uint64_t ret_ref = tag_ptr(ret_copy, true);
7576         return ret_ref;
7577 }
7578
7579 uint32_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_ty_from_ptr"))) TS_LDKCOption_MonitorEventZ_ty_from_ptr(uint64_t ptr) {
7580         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
7581         switch(obj->tag) {
7582                 case LDKCOption_MonitorEventZ_Some: return 0;
7583                 case LDKCOption_MonitorEventZ_None: return 1;
7584                 default: abort();
7585         }
7586 }
7587 uint64_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_Some_get_some"))) TS_LDKCOption_MonitorEventZ_Some_get_some(uint64_t ptr) {
7588         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
7589         assert(obj->tag == LDKCOption_MonitorEventZ_Some);
7590         uint64_t some_ref = tag_ptr(&obj->some, false);
7591         return some_ref;
7592 }
7593 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
7594 CHECK(owner->result_ok);
7595         return COption_MonitorEventZ_clone(&*owner->contents.result);
7596 }
7597 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok(uint64_t owner) {
7598         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
7599         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
7600         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
7601         uint64_t ret_ref = tag_ptr(ret_copy, true);
7602         return ret_ref;
7603 }
7604
7605 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
7606 CHECK(!owner->result_ok);
7607         return DecodeError_clone(&*owner->contents.err);
7608 }
7609 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err(uint64_t owner) {
7610         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
7611         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7612         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
7613         uint64_t ret_ref = tag_ptr(ret_copy, true);
7614         return ret_ref;
7615 }
7616
7617 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
7618         LDKHTLCUpdate ret = *owner->contents.result;
7619         ret.is_owned = false;
7620         return ret;
7621 }
7622 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_ok(uint64_t owner) {
7623         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
7624         LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
7625         uint64_t ret_ref = 0;
7626         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7627         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7628         return ret_ref;
7629 }
7630
7631 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
7632 CHECK(!owner->result_ok);
7633         return DecodeError_clone(&*owner->contents.err);
7634 }
7635 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_err(uint64_t owner) {
7636         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
7637         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7638         *ret_copy = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
7639         uint64_t ret_ref = tag_ptr(ret_copy, true);
7640         return ret_ref;
7641 }
7642
7643 static inline struct LDKOutPoint C2Tuple_OutPointCVec_u8ZZ_get_a(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR owner){
7644         LDKOutPoint ret = owner->a;
7645         ret.is_owned = false;
7646         return ret;
7647 }
7648 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_get_a"))) TS_C2Tuple_OutPointCVec_u8ZZ_get_a(uint64_t owner) {
7649         LDKC2Tuple_OutPointCVec_u8ZZ* owner_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(owner);
7650         LDKOutPoint ret_var = C2Tuple_OutPointCVec_u8ZZ_get_a(owner_conv);
7651         uint64_t ret_ref = 0;
7652         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7653         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7654         return ret_ref;
7655 }
7656
7657 static inline struct LDKCVec_u8Z C2Tuple_OutPointCVec_u8ZZ_get_b(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR owner){
7658         return CVec_u8Z_clone(&owner->b);
7659 }
7660 int8_tArray  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_get_b"))) TS_C2Tuple_OutPointCVec_u8ZZ_get_b(uint64_t owner) {
7661         LDKC2Tuple_OutPointCVec_u8ZZ* owner_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(owner);
7662         LDKCVec_u8Z ret_var = C2Tuple_OutPointCVec_u8ZZ_get_b(owner_conv);
7663         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
7664         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
7665         CVec_u8Z_free(ret_var);
7666         return ret_arr;
7667 }
7668
7669 static inline uint32_t C2Tuple_u32CVec_u8ZZ_get_a(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR owner){
7670         return owner->a;
7671 }
7672 int32_t  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_get_a"))) TS_C2Tuple_u32CVec_u8ZZ_get_a(uint64_t owner) {
7673         LDKC2Tuple_u32CVec_u8ZZ* owner_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(owner);
7674         int32_t ret_conv = C2Tuple_u32CVec_u8ZZ_get_a(owner_conv);
7675         return ret_conv;
7676 }
7677
7678 static inline struct LDKCVec_u8Z C2Tuple_u32CVec_u8ZZ_get_b(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR owner){
7679         return CVec_u8Z_clone(&owner->b);
7680 }
7681 int8_tArray  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_get_b"))) TS_C2Tuple_u32CVec_u8ZZ_get_b(uint64_t owner) {
7682         LDKC2Tuple_u32CVec_u8ZZ* owner_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(owner);
7683         LDKCVec_u8Z ret_var = C2Tuple_u32CVec_u8ZZ_get_b(owner_conv);
7684         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
7685         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
7686         CVec_u8Z_free(ret_var);
7687         return ret_arr;
7688 }
7689
7690 static inline LDKCVec_C2Tuple_u32CVec_u8ZZZ CVec_C2Tuple_u32CVec_u8ZZZ_clone(const LDKCVec_C2Tuple_u32CVec_u8ZZZ *orig) {
7691         LDKCVec_C2Tuple_u32CVec_u8ZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ) * orig->datalen, "LDKCVec_C2Tuple_u32CVec_u8ZZZ clone bytes"), .datalen = orig->datalen };
7692         for (size_t i = 0; i < ret.datalen; i++) {
7693                 ret.data[i] = C2Tuple_u32CVec_u8ZZ_clone(&orig->data[i]);
7694         }
7695         return ret;
7696 }
7697 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR owner){
7698         return ThirtyTwoBytes_clone(&owner->a);
7699 }
7700 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(uint64_t owner) {
7701         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(owner);
7702         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
7703         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(owner_conv).data, 32);
7704         return ret_arr;
7705 }
7706
7707 static inline struct LDKCVec_C2Tuple_u32CVec_u8ZZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR owner){
7708         return CVec_C2Tuple_u32CVec_u8ZZZ_clone(&owner->b);
7709 }
7710 uint64_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(uint64_t owner) {
7711         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(owner);
7712         LDKCVec_C2Tuple_u32CVec_u8ZZZ ret_var = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(owner_conv);
7713         uint64_tArray ret_arr = NULL;
7714         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
7715         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
7716         for (size_t x = 0; x < ret_var.datalen; x++) {
7717                 LDKC2Tuple_u32CVec_u8ZZ* ret_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
7718                 *ret_conv_23_conv = ret_var.data[x];
7719                 ret_arr_ptr[x] = tag_ptr(ret_conv_23_conv, true);
7720         }
7721         
7722         FREE(ret_var.data);
7723         return ret_arr;
7724 }
7725
7726 static inline LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ *orig) {
7727         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 };
7728         for (size_t i = 0; i < ret.datalen; i++) {
7729                 ret.data[i] = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(&orig->data[i]);
7730         }
7731         return ret;
7732 }
7733 static inline LDKCVec_CommitmentTransactionZ CVec_CommitmentTransactionZ_clone(const LDKCVec_CommitmentTransactionZ *orig) {
7734         LDKCVec_CommitmentTransactionZ ret = { .data = MALLOC(sizeof(LDKCommitmentTransaction) * orig->datalen, "LDKCVec_CommitmentTransactionZ clone bytes"), .datalen = orig->datalen };
7735         for (size_t i = 0; i < ret.datalen; i++) {
7736                 ret.data[i] = CommitmentTransaction_clone(&orig->data[i]);
7737         }
7738         return ret;
7739 }
7740 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
7741         return owner->a;
7742 }
7743 int32_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_a"))) TS_C2Tuple_u32TxOutZ_get_a(uint64_t owner) {
7744         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
7745         int32_t ret_conv = C2Tuple_u32TxOutZ_get_a(owner_conv);
7746         return ret_conv;
7747 }
7748
7749 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
7750         return TxOut_clone(&owner->b);
7751 }
7752 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_b"))) TS_C2Tuple_u32TxOutZ_get_b(uint64_t owner) {
7753         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
7754         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
7755         *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
7756         return tag_ptr(ret_ref, true);
7757 }
7758
7759 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
7760         LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
7761         for (size_t i = 0; i < ret.datalen; i++) {
7762                 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
7763         }
7764         return ret;
7765 }
7766 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
7767         return ThirtyTwoBytes_clone(&owner->a);
7768 }
7769 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(uint64_t owner) {
7770         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
7771         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
7772         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data, 32);
7773         return ret_arr;
7774 }
7775
7776 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
7777         return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
7778 }
7779 uint64_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(uint64_t owner) {
7780         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
7781         LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
7782         uint64_tArray ret_arr = NULL;
7783         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
7784         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
7785         for (size_t u = 0; u < ret_var.datalen; u++) {
7786                 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
7787                 *ret_conv_20_conv = ret_var.data[u];
7788                 ret_arr_ptr[u] = tag_ptr(ret_conv_20_conv, true);
7789         }
7790         
7791         FREE(ret_var.data);
7792         return ret_arr;
7793 }
7794
7795 static inline LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ *orig) {
7796         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 };
7797         for (size_t i = 0; i < ret.datalen; i++) {
7798                 ret.data[i] = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
7799         }
7800         return ret;
7801 }
7802 uint32_t __attribute__((export_name("TS_LDKBalance_ty_from_ptr"))) TS_LDKBalance_ty_from_ptr(uint64_t ptr) {
7803         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7804         switch(obj->tag) {
7805                 case LDKBalance_ClaimableOnChannelClose: return 0;
7806                 case LDKBalance_ClaimableAwaitingConfirmations: return 1;
7807                 case LDKBalance_ContentiousClaimable: return 2;
7808                 case LDKBalance_MaybeTimeoutClaimableHTLC: return 3;
7809                 case LDKBalance_MaybePreimageClaimableHTLC: return 4;
7810                 case LDKBalance_CounterpartyRevokedOutputClaimable: return 5;
7811                 default: abort();
7812         }
7813 }
7814 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableOnChannelClose_get_amount_satoshis"))) TS_LDKBalance_ClaimableOnChannelClose_get_amount_satoshis(uint64_t ptr) {
7815         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7816         assert(obj->tag == LDKBalance_ClaimableOnChannelClose);
7817         int64_t amount_satoshis_conv = obj->claimable_on_channel_close.amount_satoshis;
7818         return amount_satoshis_conv;
7819 }
7820 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_amount_satoshis"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_amount_satoshis(uint64_t ptr) {
7821         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7822         assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
7823         int64_t amount_satoshis_conv = obj->claimable_awaiting_confirmations.amount_satoshis;
7824         return amount_satoshis_conv;
7825 }
7826 int32_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height(uint64_t ptr) {
7827         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7828         assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
7829         int32_t confirmation_height_conv = obj->claimable_awaiting_confirmations.confirmation_height;
7830         return confirmation_height_conv;
7831 }
7832 int64_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_amount_satoshis"))) TS_LDKBalance_ContentiousClaimable_get_amount_satoshis(uint64_t ptr) {
7833         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7834         assert(obj->tag == LDKBalance_ContentiousClaimable);
7835         int64_t amount_satoshis_conv = obj->contentious_claimable.amount_satoshis;
7836         return amount_satoshis_conv;
7837 }
7838 int32_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_timeout_height"))) TS_LDKBalance_ContentiousClaimable_get_timeout_height(uint64_t ptr) {
7839         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7840         assert(obj->tag == LDKBalance_ContentiousClaimable);
7841         int32_t timeout_height_conv = obj->contentious_claimable.timeout_height;
7842         return timeout_height_conv;
7843 }
7844 int8_tArray __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_payment_hash"))) TS_LDKBalance_ContentiousClaimable_get_payment_hash(uint64_t ptr) {
7845         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7846         assert(obj->tag == LDKBalance_ContentiousClaimable);
7847         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
7848         memcpy(payment_hash_arr->elems, obj->contentious_claimable.payment_hash.data, 32);
7849         return payment_hash_arr;
7850 }
7851 int8_tArray __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_payment_preimage"))) TS_LDKBalance_ContentiousClaimable_get_payment_preimage(uint64_t ptr) {
7852         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7853         assert(obj->tag == LDKBalance_ContentiousClaimable);
7854         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
7855         memcpy(payment_preimage_arr->elems, obj->contentious_claimable.payment_preimage.data, 32);
7856         return payment_preimage_arr;
7857 }
7858 int64_t __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_amount_satoshis"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_amount_satoshis(uint64_t ptr) {
7859         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7860         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
7861         int64_t amount_satoshis_conv = obj->maybe_timeout_claimable_htlc.amount_satoshis;
7862         return amount_satoshis_conv;
7863 }
7864 int32_t __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_height"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_height(uint64_t ptr) {
7865         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7866         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
7867         int32_t claimable_height_conv = obj->maybe_timeout_claimable_htlc.claimable_height;
7868         return claimable_height_conv;
7869 }
7870 int8_tArray __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_payment_hash"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_payment_hash(uint64_t ptr) {
7871         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7872         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
7873         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
7874         memcpy(payment_hash_arr->elems, obj->maybe_timeout_claimable_htlc.payment_hash.data, 32);
7875         return payment_hash_arr;
7876 }
7877 int64_t __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_amount_satoshis"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_amount_satoshis(uint64_t ptr) {
7878         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7879         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
7880         int64_t amount_satoshis_conv = obj->maybe_preimage_claimable_htlc.amount_satoshis;
7881         return amount_satoshis_conv;
7882 }
7883 int32_t __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_expiry_height"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_expiry_height(uint64_t ptr) {
7884         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7885         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
7886         int32_t expiry_height_conv = obj->maybe_preimage_claimable_htlc.expiry_height;
7887         return expiry_height_conv;
7888 }
7889 int8_tArray __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_payment_hash"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_payment_hash(uint64_t ptr) {
7890         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7891         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
7892         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
7893         memcpy(payment_hash_arr->elems, obj->maybe_preimage_claimable_htlc.payment_hash.data, 32);
7894         return payment_hash_arr;
7895 }
7896 int64_t __attribute__((export_name("TS_LDKBalance_CounterpartyRevokedOutputClaimable_get_amount_satoshis"))) TS_LDKBalance_CounterpartyRevokedOutputClaimable_get_amount_satoshis(uint64_t ptr) {
7897         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7898         assert(obj->tag == LDKBalance_CounterpartyRevokedOutputClaimable);
7899         int64_t amount_satoshis_conv = obj->counterparty_revoked_output_claimable.amount_satoshis;
7900         return amount_satoshis_conv;
7901 }
7902 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
7903         LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
7904         for (size_t i = 0; i < ret.datalen; i++) {
7905                 ret.data[i] = Balance_clone(&orig->data[i]);
7906         }
7907         return ret;
7908 }
7909 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR owner){
7910         return ThirtyTwoBytes_clone(&owner->a);
7911 }
7912 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(uint64_t owner) {
7913         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(owner);
7914         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
7915         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(owner_conv).data, 32);
7916         return ret_arr;
7917 }
7918
7919 static inline struct LDKChannelMonitor C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR owner){
7920         LDKChannelMonitor ret = owner->b;
7921         ret.is_owned = false;
7922         return ret;
7923 }
7924 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(uint64_t owner) {
7925         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(owner);
7926         LDKChannelMonitor ret_var = C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(owner_conv);
7927         uint64_t ret_ref = 0;
7928         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7929         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7930         return ret_ref;
7931 }
7932
7933 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
7934 CHECK(owner->result_ok);
7935         return C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&*owner->contents.result);
7936 }
7937 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(uint64_t owner) {
7938         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
7939         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
7940         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
7941         return tag_ptr(ret_conv, true);
7942 }
7943
7944 static inline struct LDKDecodeError CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
7945 CHECK(!owner->result_ok);
7946         return DecodeError_clone(&*owner->contents.err);
7947 }
7948 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(uint64_t owner) {
7949         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
7950         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7951         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(owner_conv);
7952         uint64_t ret_ref = tag_ptr(ret_copy, true);
7953         return ret_ref;
7954 }
7955
7956 typedef struct LDKType_JCalls {
7957         atomic_size_t refcnt;
7958         uint32_t instance_ptr;
7959 } LDKType_JCalls;
7960 static void LDKType_JCalls_free(void* this_arg) {
7961         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
7962         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7963                 FREE(j_calls);
7964         }
7965 }
7966 uint16_t type_id_LDKType_jcall(const void* this_arg) {
7967         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
7968         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 41, 0, 0, 0, 0, 0, 0);
7969 }
7970 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
7971         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
7972         jstring ret = (jstring)js_invoke_function_uuuuuu(j_calls->instance_ptr, 42, 0, 0, 0, 0, 0, 0);
7973         LDKStr ret_conv = str_ref_to_owned_c(ret);
7974         return ret_conv;
7975 }
7976 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
7977         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
7978         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 43, 0, 0, 0, 0, 0, 0);
7979         LDKCVec_u8Z ret_ref;
7980         ret_ref.datalen = ret->arr_len;
7981         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
7982         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
7983         return ret_ref;
7984 }
7985 static void LDKType_JCalls_cloned(LDKType* new_obj) {
7986         LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
7987         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7988 }
7989 static inline LDKType LDKType_init (JSValue o) {
7990         LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
7991         atomic_init(&calls->refcnt, 1);
7992         calls->instance_ptr = o;
7993
7994         LDKType ret = {
7995                 .this_arg = (void*) calls,
7996                 .type_id = type_id_LDKType_jcall,
7997                 .debug_str = debug_str_LDKType_jcall,
7998                 .write = write_LDKType_jcall,
7999                 .cloned = LDKType_JCalls_cloned,
8000                 .free = LDKType_JCalls_free,
8001         };
8002         return ret;
8003 }
8004 uint64_t  __attribute__((export_name("TS_LDKType_new"))) TS_LDKType_new(JSValue o) {
8005         LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
8006         *res_ptr = LDKType_init(o);
8007         return tag_ptr(res_ptr, true);
8008 }
8009 int16_t  __attribute__((export_name("TS_Type_type_id"))) TS_Type_type_id(uint64_t this_arg) {
8010         void* this_arg_ptr = untag_ptr(this_arg);
8011         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8012         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
8013         int16_t ret_conv = (this_arg_conv->type_id)(this_arg_conv->this_arg);
8014         return ret_conv;
8015 }
8016
8017 jstring  __attribute__((export_name("TS_Type_debug_str"))) TS_Type_debug_str(uint64_t this_arg) {
8018         void* this_arg_ptr = untag_ptr(this_arg);
8019         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8020         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
8021         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
8022         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
8023         Str_free(ret_str);
8024         return ret_conv;
8025 }
8026
8027 int8_tArray  __attribute__((export_name("TS_Type_write"))) TS_Type_write(uint64_t this_arg) {
8028         void* this_arg_ptr = untag_ptr(this_arg);
8029         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8030         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
8031         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
8032         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
8033         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8034         CVec_u8Z_free(ret_var);
8035         return ret_arr;
8036 }
8037
8038 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
8039         return owner->a;
8040 }
8041 int8_tArray  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_a"))) TS_C2Tuple_PublicKeyTypeZ_get_a(uint64_t owner) {
8042         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
8043         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
8044         memcpy(ret_arr->elems, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form, 33);
8045         return ret_arr;
8046 }
8047
8048 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
8049         return Type_clone(&owner->b);
8050 }
8051 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_b"))) TS_C2Tuple_PublicKeyTypeZ_get_b(uint64_t owner) {
8052         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
8053         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
8054         *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
8055         return tag_ptr(ret_ret, true);
8056 }
8057
8058 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
8059         LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
8060         for (size_t i = 0; i < ret.datalen; i++) {
8061                 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
8062         }
8063         return ret;
8064 }
8065 static inline struct LDKPublicKey C2Tuple_PublicKeyCVec_SocketAddressZZ_get_a(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ *NONNULL_PTR owner){
8066         return owner->a;
8067 }
8068 int8_tArray  __attribute__((export_name("TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_get_a"))) TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_get_a(uint64_t owner) {
8069         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(owner);
8070         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
8071         memcpy(ret_arr->elems, C2Tuple_PublicKeyCVec_SocketAddressZZ_get_a(owner_conv).compressed_form, 33);
8072         return ret_arr;
8073 }
8074
8075 static inline struct LDKCVec_SocketAddressZ C2Tuple_PublicKeyCVec_SocketAddressZZ_get_b(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ *NONNULL_PTR owner){
8076         return CVec_SocketAddressZ_clone(&owner->b);
8077 }
8078 uint64_tArray  __attribute__((export_name("TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_get_b"))) TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_get_b(uint64_t owner) {
8079         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(owner);
8080         LDKCVec_SocketAddressZ ret_var = C2Tuple_PublicKeyCVec_SocketAddressZZ_get_b(owner_conv);
8081         uint64_tArray ret_arr = NULL;
8082         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
8083         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
8084         for (size_t p = 0; p < ret_var.datalen; p++) {
8085                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
8086                 *ret_conv_15_copy = ret_var.data[p];
8087                 uint64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
8088                 ret_arr_ptr[p] = ret_conv_15_ref;
8089         }
8090         
8091         FREE(ret_var.data);
8092         return ret_arr;
8093 }
8094
8095 static inline LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_clone(const LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ *orig) {
8096         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ clone bytes"), .datalen = orig->datalen };
8097         for (size_t i = 0; i < ret.datalen; i++) {
8098                 ret.data[i] = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(&orig->data[i]);
8099         }
8100         return ret;
8101 }
8102 typedef struct LDKOnionMessageContents_JCalls {
8103         atomic_size_t refcnt;
8104         uint32_t instance_ptr;
8105 } LDKOnionMessageContents_JCalls;
8106 static void LDKOnionMessageContents_JCalls_free(void* this_arg) {
8107         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
8108         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8109                 FREE(j_calls);
8110         }
8111 }
8112 uint64_t tlv_type_LDKOnionMessageContents_jcall(const void* this_arg) {
8113         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
8114         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 44, 0, 0, 0, 0, 0, 0);
8115 }
8116 LDKCVec_u8Z write_LDKOnionMessageContents_jcall(const void* this_arg) {
8117         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
8118         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 45, 0, 0, 0, 0, 0, 0);
8119         LDKCVec_u8Z ret_ref;
8120         ret_ref.datalen = ret->arr_len;
8121         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
8122         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
8123         return ret_ref;
8124 }
8125 LDKStr debug_str_LDKOnionMessageContents_jcall(const void* this_arg) {
8126         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
8127         jstring ret = (jstring)js_invoke_function_uuuuuu(j_calls->instance_ptr, 46, 0, 0, 0, 0, 0, 0);
8128         LDKStr ret_conv = str_ref_to_owned_c(ret);
8129         return ret_conv;
8130 }
8131 static void LDKOnionMessageContents_JCalls_cloned(LDKOnionMessageContents* new_obj) {
8132         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) new_obj->this_arg;
8133         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8134 }
8135 static inline LDKOnionMessageContents LDKOnionMessageContents_init (JSValue o) {
8136         LDKOnionMessageContents_JCalls *calls = MALLOC(sizeof(LDKOnionMessageContents_JCalls), "LDKOnionMessageContents_JCalls");
8137         atomic_init(&calls->refcnt, 1);
8138         calls->instance_ptr = o;
8139
8140         LDKOnionMessageContents ret = {
8141                 .this_arg = (void*) calls,
8142                 .tlv_type = tlv_type_LDKOnionMessageContents_jcall,
8143                 .write = write_LDKOnionMessageContents_jcall,
8144                 .debug_str = debug_str_LDKOnionMessageContents_jcall,
8145                 .cloned = LDKOnionMessageContents_JCalls_cloned,
8146                 .free = LDKOnionMessageContents_JCalls_free,
8147         };
8148         return ret;
8149 }
8150 uint64_t  __attribute__((export_name("TS_LDKOnionMessageContents_new"))) TS_LDKOnionMessageContents_new(JSValue o) {
8151         LDKOnionMessageContents *res_ptr = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
8152         *res_ptr = LDKOnionMessageContents_init(o);
8153         return tag_ptr(res_ptr, true);
8154 }
8155 int64_t  __attribute__((export_name("TS_OnionMessageContents_tlv_type"))) TS_OnionMessageContents_tlv_type(uint64_t this_arg) {
8156         void* this_arg_ptr = untag_ptr(this_arg);
8157         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8158         LDKOnionMessageContents* this_arg_conv = (LDKOnionMessageContents*)this_arg_ptr;
8159         int64_t ret_conv = (this_arg_conv->tlv_type)(this_arg_conv->this_arg);
8160         return ret_conv;
8161 }
8162
8163 int8_tArray  __attribute__((export_name("TS_OnionMessageContents_write"))) TS_OnionMessageContents_write(uint64_t this_arg) {
8164         void* this_arg_ptr = untag_ptr(this_arg);
8165         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8166         LDKOnionMessageContents* this_arg_conv = (LDKOnionMessageContents*)this_arg_ptr;
8167         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
8168         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
8169         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8170         CVec_u8Z_free(ret_var);
8171         return ret_arr;
8172 }
8173
8174 jstring  __attribute__((export_name("TS_OnionMessageContents_debug_str"))) TS_OnionMessageContents_debug_str(uint64_t this_arg) {
8175         void* this_arg_ptr = untag_ptr(this_arg);
8176         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8177         LDKOnionMessageContents* this_arg_conv = (LDKOnionMessageContents*)this_arg_ptr;
8178         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
8179         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
8180         Str_free(ret_str);
8181         return ret_conv;
8182 }
8183
8184 uint32_t __attribute__((export_name("TS_LDKCOption_OnionMessageContentsZ_ty_from_ptr"))) TS_LDKCOption_OnionMessageContentsZ_ty_from_ptr(uint64_t ptr) {
8185         LDKCOption_OnionMessageContentsZ *obj = (LDKCOption_OnionMessageContentsZ*)untag_ptr(ptr);
8186         switch(obj->tag) {
8187                 case LDKCOption_OnionMessageContentsZ_Some: return 0;
8188                 case LDKCOption_OnionMessageContentsZ_None: return 1;
8189                 default: abort();
8190         }
8191 }
8192 uint64_t __attribute__((export_name("TS_LDKCOption_OnionMessageContentsZ_Some_get_some"))) TS_LDKCOption_OnionMessageContentsZ_Some_get_some(uint64_t ptr) {
8193         LDKCOption_OnionMessageContentsZ *obj = (LDKCOption_OnionMessageContentsZ*)untag_ptr(ptr);
8194         assert(obj->tag == LDKCOption_OnionMessageContentsZ_Some);
8195         LDKOnionMessageContents* some_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
8196         *some_ret = OnionMessageContents_clone(&obj->some);
8197         return tag_ptr(some_ret, true);
8198 }
8199 static inline struct LDKCOption_OnionMessageContentsZ CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
8200 CHECK(owner->result_ok);
8201         return COption_OnionMessageContentsZ_clone(&*owner->contents.result);
8202 }
8203 uint64_t  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok(uint64_t owner) {
8204         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
8205         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
8206         *ret_copy = CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok(owner_conv);
8207         uint64_t ret_ref = tag_ptr(ret_copy, true);
8208         return ret_ref;
8209 }
8210
8211 static inline struct LDKDecodeError CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
8212 CHECK(!owner->result_ok);
8213         return DecodeError_clone(&*owner->contents.err);
8214 }
8215 uint64_t  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err(uint64_t owner) {
8216         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
8217         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8218         *ret_copy = CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err(owner_conv);
8219         uint64_t ret_ref = tag_ptr(ret_copy, true);
8220         return ret_ref;
8221 }
8222
8223 static inline struct LDKOnionMessageContents C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
8224         return OnionMessageContents_clone(&owner->a);
8225 }
8226 uint64_t  __attribute__((export_name("TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a"))) TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a(uint64_t owner) {
8227         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
8228         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
8229         *ret_ret = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a(owner_conv);
8230         return tag_ptr(ret_ret, true);
8231 }
8232
8233 static inline struct LDKDestination C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
8234         return Destination_clone(&owner->b);
8235 }
8236 uint64_t  __attribute__((export_name("TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b"))) TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b(uint64_t owner) {
8237         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
8238         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
8239         *ret_copy = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b(owner_conv);
8240         uint64_t ret_ref = tag_ptr(ret_copy, true);
8241         return ret_ref;
8242 }
8243
8244 static inline struct LDKBlindedPath C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
8245         LDKBlindedPath ret = owner->c;
8246         ret.is_owned = false;
8247         return ret;
8248 }
8249 uint64_t  __attribute__((export_name("TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c"))) TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c(uint64_t owner) {
8250         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
8251         LDKBlindedPath ret_var = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c(owner_conv);
8252         uint64_t ret_ref = 0;
8253         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8254         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8255         return ret_ref;
8256 }
8257
8258 static inline LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_clone(const LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ *orig) {
8259         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ) * orig->datalen, "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ clone bytes"), .datalen = orig->datalen };
8260         for (size_t i = 0; i < ret.datalen; i++) {
8261                 ret.data[i] = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(&orig->data[i]);
8262         }
8263         return ret;
8264 }
8265 uint32_t __attribute__((export_name("TS_LDKCOption_TypeZ_ty_from_ptr"))) TS_LDKCOption_TypeZ_ty_from_ptr(uint64_t ptr) {
8266         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
8267         switch(obj->tag) {
8268                 case LDKCOption_TypeZ_Some: return 0;
8269                 case LDKCOption_TypeZ_None: return 1;
8270                 default: abort();
8271         }
8272 }
8273 uint64_t __attribute__((export_name("TS_LDKCOption_TypeZ_Some_get_some"))) TS_LDKCOption_TypeZ_Some_get_some(uint64_t ptr) {
8274         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
8275         assert(obj->tag == LDKCOption_TypeZ_Some);
8276         LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
8277         *some_ret = Type_clone(&obj->some);
8278         return tag_ptr(some_ret, true);
8279 }
8280 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
8281 CHECK(owner->result_ok);
8282         return COption_TypeZ_clone(&*owner->contents.result);
8283 }
8284 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_get_ok(uint64_t owner) {
8285         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
8286         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
8287         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
8288         uint64_t ret_ref = tag_ptr(ret_copy, true);
8289         return ret_ref;
8290 }
8291
8292 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
8293 CHECK(!owner->result_ok);
8294         return DecodeError_clone(&*owner->contents.err);
8295 }
8296 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_err"))) TS_CResult_COption_TypeZDecodeErrorZ_get_err(uint64_t owner) {
8297         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
8298         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8299         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
8300         uint64_t ret_ref = tag_ptr(ret_copy, true);
8301         return ret_ref;
8302 }
8303
8304 uint32_t __attribute__((export_name("TS_LDKCOption_SocketAddressZ_ty_from_ptr"))) TS_LDKCOption_SocketAddressZ_ty_from_ptr(uint64_t ptr) {
8305         LDKCOption_SocketAddressZ *obj = (LDKCOption_SocketAddressZ*)untag_ptr(ptr);
8306         switch(obj->tag) {
8307                 case LDKCOption_SocketAddressZ_Some: return 0;
8308                 case LDKCOption_SocketAddressZ_None: return 1;
8309                 default: abort();
8310         }
8311 }
8312 uint64_t __attribute__((export_name("TS_LDKCOption_SocketAddressZ_Some_get_some"))) TS_LDKCOption_SocketAddressZ_Some_get_some(uint64_t ptr) {
8313         LDKCOption_SocketAddressZ *obj = (LDKCOption_SocketAddressZ*)untag_ptr(ptr);
8314         assert(obj->tag == LDKCOption_SocketAddressZ_Some);
8315         uint64_t some_ref = tag_ptr(&obj->some, false);
8316         return some_ref;
8317 }
8318 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
8319 CHECK(owner->result_ok);
8320         return CVec_u8Z_clone(&*owner->contents.result);
8321 }
8322 int8_tArray  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint64_t owner) {
8323         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
8324         LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
8325         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
8326         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8327         CVec_u8Z_free(ret_var);
8328         return ret_arr;
8329 }
8330
8331 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
8332         LDKPeerHandleError ret = *owner->contents.err;
8333         ret.is_owned = false;
8334         return ret;
8335 }
8336 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err(uint64_t owner) {
8337         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
8338         LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
8339         uint64_t ret_ref = 0;
8340         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8341         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8342         return ret_ref;
8343 }
8344
8345 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
8346 CHECK(owner->result_ok);
8347         return *owner->contents.result;
8348 }
8349 void  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_ok"))) TS_CResult_NonePeerHandleErrorZ_get_ok(uint64_t owner) {
8350         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
8351         CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
8352 }
8353
8354 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
8355         LDKPeerHandleError ret = *owner->contents.err;
8356         ret.is_owned = false;
8357         return ret;
8358 }
8359 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_err"))) TS_CResult_NonePeerHandleErrorZ_get_err(uint64_t owner) {
8360         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
8361         LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
8362         uint64_t ret_ref = 0;
8363         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8364         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8365         return ret_ref;
8366 }
8367
8368 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
8369 CHECK(owner->result_ok);
8370         return *owner->contents.result;
8371 }
8372 jboolean  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_ok"))) TS_CResult_boolPeerHandleErrorZ_get_ok(uint64_t owner) {
8373         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
8374         jboolean ret_conv = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
8375         return ret_conv;
8376 }
8377
8378 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
8379         LDKPeerHandleError ret = *owner->contents.err;
8380         ret.is_owned = false;
8381         return ret;
8382 }
8383 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_err"))) TS_CResult_boolPeerHandleErrorZ_get_err(uint64_t owner) {
8384         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
8385         LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
8386         uint64_t ret_ref = 0;
8387         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8388         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8389         return ret_ref;
8390 }
8391
8392 uint32_t __attribute__((export_name("TS_LDKGraphSyncError_ty_from_ptr"))) TS_LDKGraphSyncError_ty_from_ptr(uint64_t ptr) {
8393         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
8394         switch(obj->tag) {
8395                 case LDKGraphSyncError_DecodeError: return 0;
8396                 case LDKGraphSyncError_LightningError: return 1;
8397                 default: abort();
8398         }
8399 }
8400 uint64_t __attribute__((export_name("TS_LDKGraphSyncError_DecodeError_get_decode_error"))) TS_LDKGraphSyncError_DecodeError_get_decode_error(uint64_t ptr) {
8401         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
8402         assert(obj->tag == LDKGraphSyncError_DecodeError);
8403         uint64_t decode_error_ref = tag_ptr(&obj->decode_error, false);
8404         return decode_error_ref;
8405 }
8406 uint64_t __attribute__((export_name("TS_LDKGraphSyncError_LightningError_get_lightning_error"))) TS_LDKGraphSyncError_LightningError_get_lightning_error(uint64_t ptr) {
8407         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
8408         assert(obj->tag == LDKGraphSyncError_LightningError);
8409         LDKLightningError lightning_error_var = obj->lightning_error;
8410                         uint64_t lightning_error_ref = 0;
8411                         CHECK_INNER_FIELD_ACCESS_OR_NULL(lightning_error_var);
8412                         lightning_error_ref = tag_ptr(lightning_error_var.inner, false);
8413         return lightning_error_ref;
8414 }
8415 static inline uint32_t CResult_u32GraphSyncErrorZ_get_ok(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
8416 CHECK(owner->result_ok);
8417         return *owner->contents.result;
8418 }
8419 int32_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_get_ok"))) TS_CResult_u32GraphSyncErrorZ_get_ok(uint64_t owner) {
8420         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
8421         int32_t ret_conv = CResult_u32GraphSyncErrorZ_get_ok(owner_conv);
8422         return ret_conv;
8423 }
8424
8425 static inline struct LDKGraphSyncError CResult_u32GraphSyncErrorZ_get_err(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
8426 CHECK(!owner->result_ok);
8427         return GraphSyncError_clone(&*owner->contents.err);
8428 }
8429 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_get_err"))) TS_CResult_u32GraphSyncErrorZ_get_err(uint64_t owner) {
8430         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
8431         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
8432         *ret_copy = CResult_u32GraphSyncErrorZ_get_err(owner_conv);
8433         uint64_t ret_ref = tag_ptr(ret_copy, true);
8434         return ret_ref;
8435 }
8436
8437 static inline struct LDKCVec_u8Z CResult_CVec_u8ZIOErrorZ_get_ok(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR owner){
8438 CHECK(owner->result_ok);
8439         return CVec_u8Z_clone(&*owner->contents.result);
8440 }
8441 int8_tArray  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_get_ok"))) TS_CResult_CVec_u8ZIOErrorZ_get_ok(uint64_t owner) {
8442         LDKCResult_CVec_u8ZIOErrorZ* owner_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(owner);
8443         LDKCVec_u8Z ret_var = CResult_CVec_u8ZIOErrorZ_get_ok(owner_conv);
8444         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
8445         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8446         CVec_u8Z_free(ret_var);
8447         return ret_arr;
8448 }
8449
8450 static inline enum LDKIOError CResult_CVec_u8ZIOErrorZ_get_err(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR owner){
8451 CHECK(!owner->result_ok);
8452         return *owner->contents.err;
8453 }
8454 uint32_t  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_get_err"))) TS_CResult_CVec_u8ZIOErrorZ_get_err(uint64_t owner) {
8455         LDKCResult_CVec_u8ZIOErrorZ* owner_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(owner);
8456         uint32_t ret_conv = LDKIOError_to_js(CResult_CVec_u8ZIOErrorZ_get_err(owner_conv));
8457         return ret_conv;
8458 }
8459
8460 static inline void CResult_NoneIOErrorZ_get_ok(LDKCResult_NoneIOErrorZ *NONNULL_PTR owner){
8461 CHECK(owner->result_ok);
8462         return *owner->contents.result;
8463 }
8464 void  __attribute__((export_name("TS_CResult_NoneIOErrorZ_get_ok"))) TS_CResult_NoneIOErrorZ_get_ok(uint64_t owner) {
8465         LDKCResult_NoneIOErrorZ* owner_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(owner);
8466         CResult_NoneIOErrorZ_get_ok(owner_conv);
8467 }
8468
8469 static inline enum LDKIOError CResult_NoneIOErrorZ_get_err(LDKCResult_NoneIOErrorZ *NONNULL_PTR owner){
8470 CHECK(!owner->result_ok);
8471         return *owner->contents.err;
8472 }
8473 uint32_t  __attribute__((export_name("TS_CResult_NoneIOErrorZ_get_err"))) TS_CResult_NoneIOErrorZ_get_err(uint64_t owner) {
8474         LDKCResult_NoneIOErrorZ* owner_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(owner);
8475         uint32_t ret_conv = LDKIOError_to_js(CResult_NoneIOErrorZ_get_err(owner_conv));
8476         return ret_conv;
8477 }
8478
8479 static inline struct LDKCVec_StrZ CResult_CVec_StrZIOErrorZ_get_ok(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR owner){
8480 CHECK(owner->result_ok);
8481         return *owner->contents.result;
8482 }
8483 ptrArray  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_get_ok"))) TS_CResult_CVec_StrZIOErrorZ_get_ok(uint64_t owner) {
8484         LDKCResult_CVec_StrZIOErrorZ* owner_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(owner);
8485         LDKCVec_StrZ ret_var = CResult_CVec_StrZIOErrorZ_get_ok(owner_conv);
8486         ptrArray ret_arr = NULL;
8487         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
8488         jstring *ret_arr_ptr = (jstring*)(((uint8_t*)ret_arr) + 8);
8489         for (size_t i = 0; i < ret_var.datalen; i++) {
8490                 LDKStr ret_conv_8_str = ret_var.data[i];
8491                 jstring ret_conv_8_conv = str_ref_to_ts(ret_conv_8_str.chars, ret_conv_8_str.len);
8492                 ret_arr_ptr[i] = ret_conv_8_conv;
8493         }
8494         
8495         return ret_arr;
8496 }
8497
8498 static inline enum LDKIOError CResult_CVec_StrZIOErrorZ_get_err(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR owner){
8499 CHECK(!owner->result_ok);
8500         return *owner->contents.err;
8501 }
8502 uint32_t  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_get_err"))) TS_CResult_CVec_StrZIOErrorZ_get_err(uint64_t owner) {
8503         LDKCResult_CVec_StrZIOErrorZ* owner_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(owner);
8504         uint32_t ret_conv = LDKIOError_to_js(CResult_CVec_StrZIOErrorZ_get_err(owner_conv));
8505         return ret_conv;
8506 }
8507
8508 static inline LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ *orig) {
8509         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ clone bytes"), .datalen = orig->datalen };
8510         for (size_t i = 0; i < ret.datalen; i++) {
8511                 ret.data[i] = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&orig->data[i]);
8512         }
8513         return ret;
8514 }
8515 static inline struct LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR owner){
8516 CHECK(owner->result_ok);
8517         return CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_clone(&*owner->contents.result);
8518 }
8519 uint64_tArray  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(uint64_t owner) {
8520         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(owner);
8521         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ ret_var = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(owner_conv);
8522         uint64_tArray ret_arr = NULL;
8523         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
8524         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
8525         for (size_t o = 0; o < ret_var.datalen; o++) {
8526                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
8527                 *ret_conv_40_conv = ret_var.data[o];
8528                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
8529         }
8530         
8531         FREE(ret_var.data);
8532         return ret_arr;
8533 }
8534
8535 static inline enum LDKIOError CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR owner){
8536 CHECK(!owner->result_ok);
8537         return *owner->contents.err;
8538 }
8539 uint32_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(uint64_t owner) {
8540         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(owner);
8541         uint32_t ret_conv = LDKIOError_to_js(CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(owner_conv));
8542         return ret_conv;
8543 }
8544
8545 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR owner){
8546 CHECK(owner->result_ok);
8547         return C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&*owner->contents.result);
8548 }
8549 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(uint64_t owner) {
8550         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(owner);
8551         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
8552         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(owner_conv);
8553         return tag_ptr(ret_conv, true);
8554 }
8555
8556 static inline enum LDKIOError CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR owner){
8557 CHECK(!owner->result_ok);
8558         return *owner->contents.err;
8559 }
8560 uint32_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(uint64_t owner) {
8561         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(owner);
8562         uint32_t ret_conv = LDKIOError_to_js(CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(owner_conv));
8563         return ret_conv;
8564 }
8565
8566 static inline struct LDKUnsignedInvoiceRequest CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_get_ok(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR owner){
8567         LDKUnsignedInvoiceRequest ret = *owner->contents.result;
8568         ret.is_owned = false;
8569         return ret;
8570 }
8571 uint64_t  __attribute__((export_name("TS_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_get_ok"))) TS_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_get_ok(uint64_t owner) {
8572         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* owner_conv = (LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ*)untag_ptr(owner);
8573         LDKUnsignedInvoiceRequest ret_var = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_get_ok(owner_conv);
8574         uint64_t ret_ref = 0;
8575         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8576         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8577         return ret_ref;
8578 }
8579
8580 static inline enum LDKBolt12SemanticError CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_get_err(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR owner){
8581 CHECK(!owner->result_ok);
8582         return Bolt12SemanticError_clone(&*owner->contents.err);
8583 }
8584 uint32_t  __attribute__((export_name("TS_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_get_err"))) TS_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_get_err(uint64_t owner) {
8585         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* owner_conv = (LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ*)untag_ptr(owner);
8586         uint32_t ret_conv = LDKBolt12SemanticError_to_js(CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_get_err(owner_conv));
8587         return ret_conv;
8588 }
8589
8590 static inline struct LDKInvoiceRequest CResult_InvoiceRequestBolt12SemanticErrorZ_get_ok(LDKCResult_InvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR owner){
8591         LDKInvoiceRequest ret = *owner->contents.result;
8592         ret.is_owned = false;
8593         return ret;
8594 }
8595 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestBolt12SemanticErrorZ_get_ok"))) TS_CResult_InvoiceRequestBolt12SemanticErrorZ_get_ok(uint64_t owner) {
8596         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceRequestBolt12SemanticErrorZ*)untag_ptr(owner);
8597         LDKInvoiceRequest ret_var = CResult_InvoiceRequestBolt12SemanticErrorZ_get_ok(owner_conv);
8598         uint64_t ret_ref = 0;
8599         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8600         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8601         return ret_ref;
8602 }
8603
8604 static inline enum LDKBolt12SemanticError CResult_InvoiceRequestBolt12SemanticErrorZ_get_err(LDKCResult_InvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR owner){
8605 CHECK(!owner->result_ok);
8606         return Bolt12SemanticError_clone(&*owner->contents.err);
8607 }
8608 uint32_t  __attribute__((export_name("TS_CResult_InvoiceRequestBolt12SemanticErrorZ_get_err"))) TS_CResult_InvoiceRequestBolt12SemanticErrorZ_get_err(uint64_t owner) {
8609         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceRequestBolt12SemanticErrorZ*)untag_ptr(owner);
8610         uint32_t ret_conv = LDKBolt12SemanticError_to_js(CResult_InvoiceRequestBolt12SemanticErrorZ_get_err(owner_conv));
8611         return ret_conv;
8612 }
8613
8614 uint32_t __attribute__((export_name("TS_LDKCOption_SecretKeyZ_ty_from_ptr"))) TS_LDKCOption_SecretKeyZ_ty_from_ptr(uint64_t ptr) {
8615         LDKCOption_SecretKeyZ *obj = (LDKCOption_SecretKeyZ*)untag_ptr(ptr);
8616         switch(obj->tag) {
8617                 case LDKCOption_SecretKeyZ_Some: return 0;
8618                 case LDKCOption_SecretKeyZ_None: return 1;
8619                 default: abort();
8620         }
8621 }
8622 int8_tArray __attribute__((export_name("TS_LDKCOption_SecretKeyZ_Some_get_some"))) TS_LDKCOption_SecretKeyZ_Some_get_some(uint64_t ptr) {
8623         LDKCOption_SecretKeyZ *obj = (LDKCOption_SecretKeyZ*)untag_ptr(ptr);
8624         assert(obj->tag == LDKCOption_SecretKeyZ_Some);
8625         int8_tArray some_arr = init_int8_tArray(32, __LINE__);
8626         memcpy(some_arr->elems, obj->some.bytes, 32);
8627         return some_arr;
8628 }
8629 static inline struct LDKInvoiceWithExplicitSigningPubkeyBuilder CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_get_ok(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
8630         LDKInvoiceWithExplicitSigningPubkeyBuilder ret = *owner->contents.result;
8631         ret.is_owned = false;
8632         return ret;
8633 }
8634 uint64_t  __attribute__((export_name("TS_CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_get_ok"))) TS_CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_get_ok(uint64_t owner) {
8635         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
8636         LDKInvoiceWithExplicitSigningPubkeyBuilder ret_var = CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_get_ok(owner_conv);
8637         uint64_t ret_ref = 0;
8638         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8639         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8640         return ret_ref;
8641 }
8642
8643 static inline enum LDKBolt12SemanticError CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_get_err(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
8644 CHECK(!owner->result_ok);
8645         return Bolt12SemanticError_clone(&*owner->contents.err);
8646 }
8647 uint32_t  __attribute__((export_name("TS_CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_get_err"))) TS_CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_get_err(uint64_t owner) {
8648         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
8649         uint32_t ret_conv = LDKBolt12SemanticError_to_js(CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_get_err(owner_conv));
8650         return ret_conv;
8651 }
8652
8653 static inline struct LDKVerifiedInvoiceRequest CResult_VerifiedInvoiceRequestNoneZ_get_ok(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR owner){
8654         LDKVerifiedInvoiceRequest ret = *owner->contents.result;
8655         ret.is_owned = false;
8656         return ret;
8657 }
8658 uint64_t  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_get_ok"))) TS_CResult_VerifiedInvoiceRequestNoneZ_get_ok(uint64_t owner) {
8659         LDKCResult_VerifiedInvoiceRequestNoneZ* owner_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(owner);
8660         LDKVerifiedInvoiceRequest ret_var = CResult_VerifiedInvoiceRequestNoneZ_get_ok(owner_conv);
8661         uint64_t ret_ref = 0;
8662         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8663         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8664         return ret_ref;
8665 }
8666
8667 static inline void CResult_VerifiedInvoiceRequestNoneZ_get_err(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR owner){
8668 CHECK(!owner->result_ok);
8669         return *owner->contents.err;
8670 }
8671 void  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_get_err"))) TS_CResult_VerifiedInvoiceRequestNoneZ_get_err(uint64_t owner) {
8672         LDKCResult_VerifiedInvoiceRequestNoneZ* owner_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(owner);
8673         CResult_VerifiedInvoiceRequestNoneZ_get_err(owner_conv);
8674 }
8675
8676 static inline struct LDKInvoiceWithDerivedSigningPubkeyBuilder CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_get_ok(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
8677         LDKInvoiceWithDerivedSigningPubkeyBuilder ret = *owner->contents.result;
8678         ret.is_owned = false;
8679         return ret;
8680 }
8681 uint64_t  __attribute__((export_name("TS_CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_get_ok"))) TS_CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_get_ok(uint64_t owner) {
8682         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
8683         LDKInvoiceWithDerivedSigningPubkeyBuilder ret_var = CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_get_ok(owner_conv);
8684         uint64_t ret_ref = 0;
8685         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8686         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8687         return ret_ref;
8688 }
8689
8690 static inline enum LDKBolt12SemanticError CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_get_err(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
8691 CHECK(!owner->result_ok);
8692         return Bolt12SemanticError_clone(&*owner->contents.err);
8693 }
8694 uint32_t  __attribute__((export_name("TS_CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_get_err"))) TS_CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_get_err(uint64_t owner) {
8695         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
8696         uint32_t ret_conv = LDKBolt12SemanticError_to_js(CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_get_err(owner_conv));
8697         return ret_conv;
8698 }
8699
8700 static inline struct LDKInvoiceRequestFields CResult_InvoiceRequestFieldsDecodeErrorZ_get_ok(LDKCResult_InvoiceRequestFieldsDecodeErrorZ *NONNULL_PTR owner){
8701         LDKInvoiceRequestFields ret = *owner->contents.result;
8702         ret.is_owned = false;
8703         return ret;
8704 }
8705 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestFieldsDecodeErrorZ_get_ok"))) TS_CResult_InvoiceRequestFieldsDecodeErrorZ_get_ok(uint64_t owner) {
8706         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* owner_conv = (LDKCResult_InvoiceRequestFieldsDecodeErrorZ*)untag_ptr(owner);
8707         LDKInvoiceRequestFields ret_var = CResult_InvoiceRequestFieldsDecodeErrorZ_get_ok(owner_conv);
8708         uint64_t ret_ref = 0;
8709         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8710         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8711         return ret_ref;
8712 }
8713
8714 static inline struct LDKDecodeError CResult_InvoiceRequestFieldsDecodeErrorZ_get_err(LDKCResult_InvoiceRequestFieldsDecodeErrorZ *NONNULL_PTR owner){
8715 CHECK(!owner->result_ok);
8716         return DecodeError_clone(&*owner->contents.err);
8717 }
8718 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestFieldsDecodeErrorZ_get_err"))) TS_CResult_InvoiceRequestFieldsDecodeErrorZ_get_err(uint64_t owner) {
8719         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* owner_conv = (LDKCResult_InvoiceRequestFieldsDecodeErrorZ*)untag_ptr(owner);
8720         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8721         *ret_copy = CResult_InvoiceRequestFieldsDecodeErrorZ_get_err(owner_conv);
8722         uint64_t ret_ref = tag_ptr(ret_copy, true);
8723         return ret_ref;
8724 }
8725
8726 static inline LDKCVec_WitnessZ CVec_WitnessZ_clone(const LDKCVec_WitnessZ *orig) {
8727         LDKCVec_WitnessZ ret = { .data = MALLOC(sizeof(LDKWitness) * orig->datalen, "LDKCVec_WitnessZ clone bytes"), .datalen = orig->datalen };
8728         for (size_t i = 0; i < ret.datalen; i++) {
8729                 ret.data[i] = Witness_clone(&orig->data[i]);
8730         }
8731         return ret;
8732 }
8733 uint32_t __attribute__((export_name("TS_LDKCOption_ECDSASignatureZ_ty_from_ptr"))) TS_LDKCOption_ECDSASignatureZ_ty_from_ptr(uint64_t ptr) {
8734         LDKCOption_ECDSASignatureZ *obj = (LDKCOption_ECDSASignatureZ*)untag_ptr(ptr);
8735         switch(obj->tag) {
8736                 case LDKCOption_ECDSASignatureZ_Some: return 0;
8737                 case LDKCOption_ECDSASignatureZ_None: return 1;
8738                 default: abort();
8739         }
8740 }
8741 int8_tArray __attribute__((export_name("TS_LDKCOption_ECDSASignatureZ_Some_get_some"))) TS_LDKCOption_ECDSASignatureZ_Some_get_some(uint64_t ptr) {
8742         LDKCOption_ECDSASignatureZ *obj = (LDKCOption_ECDSASignatureZ*)untag_ptr(ptr);
8743         assert(obj->tag == LDKCOption_ECDSASignatureZ_Some);
8744         int8_tArray some_arr = init_int8_tArray(64, __LINE__);
8745         memcpy(some_arr->elems, obj->some.compact_form, 64);
8746         return some_arr;
8747 }
8748 uint32_t __attribute__((export_name("TS_LDKCOption_i64Z_ty_from_ptr"))) TS_LDKCOption_i64Z_ty_from_ptr(uint64_t ptr) {
8749         LDKCOption_i64Z *obj = (LDKCOption_i64Z*)untag_ptr(ptr);
8750         switch(obj->tag) {
8751                 case LDKCOption_i64Z_Some: return 0;
8752                 case LDKCOption_i64Z_None: return 1;
8753                 default: abort();
8754         }
8755 }
8756 int64_t __attribute__((export_name("TS_LDKCOption_i64Z_Some_get_some"))) TS_LDKCOption_i64Z_Some_get_some(uint64_t ptr) {
8757         LDKCOption_i64Z *obj = (LDKCOption_i64Z*)untag_ptr(ptr);
8758         assert(obj->tag == LDKCOption_i64Z_Some);
8759         int64_t some_conv = obj->some;
8760         return some_conv;
8761 }
8762 static inline struct LDKSocketAddress CResult_SocketAddressDecodeErrorZ_get_ok(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR owner){
8763 CHECK(owner->result_ok);
8764         return SocketAddress_clone(&*owner->contents.result);
8765 }
8766 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_get_ok"))) TS_CResult_SocketAddressDecodeErrorZ_get_ok(uint64_t owner) {
8767         LDKCResult_SocketAddressDecodeErrorZ* owner_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(owner);
8768         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
8769         *ret_copy = CResult_SocketAddressDecodeErrorZ_get_ok(owner_conv);
8770         uint64_t ret_ref = tag_ptr(ret_copy, true);
8771         return ret_ref;
8772 }
8773
8774 static inline struct LDKDecodeError CResult_SocketAddressDecodeErrorZ_get_err(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR owner){
8775 CHECK(!owner->result_ok);
8776         return DecodeError_clone(&*owner->contents.err);
8777 }
8778 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_get_err"))) TS_CResult_SocketAddressDecodeErrorZ_get_err(uint64_t owner) {
8779         LDKCResult_SocketAddressDecodeErrorZ* owner_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(owner);
8780         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8781         *ret_copy = CResult_SocketAddressDecodeErrorZ_get_err(owner_conv);
8782         uint64_t ret_ref = tag_ptr(ret_copy, true);
8783         return ret_ref;
8784 }
8785
8786 static inline struct LDKSocketAddress CResult_SocketAddressSocketAddressParseErrorZ_get_ok(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR owner){
8787 CHECK(owner->result_ok);
8788         return SocketAddress_clone(&*owner->contents.result);
8789 }
8790 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_get_ok"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_get_ok(uint64_t owner) {
8791         LDKCResult_SocketAddressSocketAddressParseErrorZ* owner_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(owner);
8792         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
8793         *ret_copy = CResult_SocketAddressSocketAddressParseErrorZ_get_ok(owner_conv);
8794         uint64_t ret_ref = tag_ptr(ret_copy, true);
8795         return ret_ref;
8796 }
8797
8798 static inline enum LDKSocketAddressParseError CResult_SocketAddressSocketAddressParseErrorZ_get_err(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR owner){
8799 CHECK(!owner->result_ok);
8800         return SocketAddressParseError_clone(&*owner->contents.err);
8801 }
8802 uint32_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_get_err"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_get_err(uint64_t owner) {
8803         LDKCResult_SocketAddressSocketAddressParseErrorZ* owner_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(owner);
8804         uint32_t ret_conv = LDKSocketAddressParseError_to_js(CResult_SocketAddressSocketAddressParseErrorZ_get_err(owner_conv));
8805         return ret_conv;
8806 }
8807
8808 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
8809         LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
8810         for (size_t i = 0; i < ret.datalen; i++) {
8811                 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
8812         }
8813         return ret;
8814 }
8815 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
8816         LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
8817         for (size_t i = 0; i < ret.datalen; i++) {
8818                 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
8819         }
8820         return ret;
8821 }
8822 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
8823         LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
8824         for (size_t i = 0; i < ret.datalen; i++) {
8825                 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
8826         }
8827         return ret;
8828 }
8829 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
8830         LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
8831         for (size_t i = 0; i < ret.datalen; i++) {
8832                 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
8833         }
8834         return ret;
8835 }
8836 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
8837         LDKAcceptChannel ret = *owner->contents.result;
8838         ret.is_owned = false;
8839         return ret;
8840 }
8841 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_get_ok(uint64_t owner) {
8842         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
8843         LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
8844         uint64_t ret_ref = 0;
8845         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8846         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8847         return ret_ref;
8848 }
8849
8850 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
8851 CHECK(!owner->result_ok);
8852         return DecodeError_clone(&*owner->contents.err);
8853 }
8854 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_err"))) TS_CResult_AcceptChannelDecodeErrorZ_get_err(uint64_t owner) {
8855         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
8856         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8857         *ret_copy = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
8858         uint64_t ret_ref = tag_ptr(ret_copy, true);
8859         return ret_ref;
8860 }
8861
8862 static inline struct LDKAcceptChannelV2 CResult_AcceptChannelV2DecodeErrorZ_get_ok(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR owner){
8863         LDKAcceptChannelV2 ret = *owner->contents.result;
8864         ret.is_owned = false;
8865         return ret;
8866 }
8867 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_get_ok"))) TS_CResult_AcceptChannelV2DecodeErrorZ_get_ok(uint64_t owner) {
8868         LDKCResult_AcceptChannelV2DecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(owner);
8869         LDKAcceptChannelV2 ret_var = CResult_AcceptChannelV2DecodeErrorZ_get_ok(owner_conv);
8870         uint64_t ret_ref = 0;
8871         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8872         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8873         return ret_ref;
8874 }
8875
8876 static inline struct LDKDecodeError CResult_AcceptChannelV2DecodeErrorZ_get_err(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR owner){
8877 CHECK(!owner->result_ok);
8878         return DecodeError_clone(&*owner->contents.err);
8879 }
8880 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_get_err"))) TS_CResult_AcceptChannelV2DecodeErrorZ_get_err(uint64_t owner) {
8881         LDKCResult_AcceptChannelV2DecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(owner);
8882         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8883         *ret_copy = CResult_AcceptChannelV2DecodeErrorZ_get_err(owner_conv);
8884         uint64_t ret_ref = tag_ptr(ret_copy, true);
8885         return ret_ref;
8886 }
8887
8888 static inline struct LDKStfu CResult_StfuDecodeErrorZ_get_ok(LDKCResult_StfuDecodeErrorZ *NONNULL_PTR owner){
8889         LDKStfu ret = *owner->contents.result;
8890         ret.is_owned = false;
8891         return ret;
8892 }
8893 uint64_t  __attribute__((export_name("TS_CResult_StfuDecodeErrorZ_get_ok"))) TS_CResult_StfuDecodeErrorZ_get_ok(uint64_t owner) {
8894         LDKCResult_StfuDecodeErrorZ* owner_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(owner);
8895         LDKStfu ret_var = CResult_StfuDecodeErrorZ_get_ok(owner_conv);
8896         uint64_t ret_ref = 0;
8897         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8898         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8899         return ret_ref;
8900 }
8901
8902 static inline struct LDKDecodeError CResult_StfuDecodeErrorZ_get_err(LDKCResult_StfuDecodeErrorZ *NONNULL_PTR owner){
8903 CHECK(!owner->result_ok);
8904         return DecodeError_clone(&*owner->contents.err);
8905 }
8906 uint64_t  __attribute__((export_name("TS_CResult_StfuDecodeErrorZ_get_err"))) TS_CResult_StfuDecodeErrorZ_get_err(uint64_t owner) {
8907         LDKCResult_StfuDecodeErrorZ* owner_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(owner);
8908         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8909         *ret_copy = CResult_StfuDecodeErrorZ_get_err(owner_conv);
8910         uint64_t ret_ref = tag_ptr(ret_copy, true);
8911         return ret_ref;
8912 }
8913
8914 static inline struct LDKSplice CResult_SpliceDecodeErrorZ_get_ok(LDKCResult_SpliceDecodeErrorZ *NONNULL_PTR owner){
8915         LDKSplice ret = *owner->contents.result;
8916         ret.is_owned = false;
8917         return ret;
8918 }
8919 uint64_t  __attribute__((export_name("TS_CResult_SpliceDecodeErrorZ_get_ok"))) TS_CResult_SpliceDecodeErrorZ_get_ok(uint64_t owner) {
8920         LDKCResult_SpliceDecodeErrorZ* owner_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(owner);
8921         LDKSplice ret_var = CResult_SpliceDecodeErrorZ_get_ok(owner_conv);
8922         uint64_t ret_ref = 0;
8923         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8924         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8925         return ret_ref;
8926 }
8927
8928 static inline struct LDKDecodeError CResult_SpliceDecodeErrorZ_get_err(LDKCResult_SpliceDecodeErrorZ *NONNULL_PTR owner){
8929 CHECK(!owner->result_ok);
8930         return DecodeError_clone(&*owner->contents.err);
8931 }
8932 uint64_t  __attribute__((export_name("TS_CResult_SpliceDecodeErrorZ_get_err"))) TS_CResult_SpliceDecodeErrorZ_get_err(uint64_t owner) {
8933         LDKCResult_SpliceDecodeErrorZ* owner_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(owner);
8934         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8935         *ret_copy = CResult_SpliceDecodeErrorZ_get_err(owner_conv);
8936         uint64_t ret_ref = tag_ptr(ret_copy, true);
8937         return ret_ref;
8938 }
8939
8940 static inline struct LDKSpliceAck CResult_SpliceAckDecodeErrorZ_get_ok(LDKCResult_SpliceAckDecodeErrorZ *NONNULL_PTR owner){
8941         LDKSpliceAck ret = *owner->contents.result;
8942         ret.is_owned = false;
8943         return ret;
8944 }
8945 uint64_t  __attribute__((export_name("TS_CResult_SpliceAckDecodeErrorZ_get_ok"))) TS_CResult_SpliceAckDecodeErrorZ_get_ok(uint64_t owner) {
8946         LDKCResult_SpliceAckDecodeErrorZ* owner_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(owner);
8947         LDKSpliceAck ret_var = CResult_SpliceAckDecodeErrorZ_get_ok(owner_conv);
8948         uint64_t ret_ref = 0;
8949         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8950         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8951         return ret_ref;
8952 }
8953
8954 static inline struct LDKDecodeError CResult_SpliceAckDecodeErrorZ_get_err(LDKCResult_SpliceAckDecodeErrorZ *NONNULL_PTR owner){
8955 CHECK(!owner->result_ok);
8956         return DecodeError_clone(&*owner->contents.err);
8957 }
8958 uint64_t  __attribute__((export_name("TS_CResult_SpliceAckDecodeErrorZ_get_err"))) TS_CResult_SpliceAckDecodeErrorZ_get_err(uint64_t owner) {
8959         LDKCResult_SpliceAckDecodeErrorZ* owner_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(owner);
8960         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8961         *ret_copy = CResult_SpliceAckDecodeErrorZ_get_err(owner_conv);
8962         uint64_t ret_ref = tag_ptr(ret_copy, true);
8963         return ret_ref;
8964 }
8965
8966 static inline struct LDKSpliceLocked CResult_SpliceLockedDecodeErrorZ_get_ok(LDKCResult_SpliceLockedDecodeErrorZ *NONNULL_PTR owner){
8967         LDKSpliceLocked ret = *owner->contents.result;
8968         ret.is_owned = false;
8969         return ret;
8970 }
8971 uint64_t  __attribute__((export_name("TS_CResult_SpliceLockedDecodeErrorZ_get_ok"))) TS_CResult_SpliceLockedDecodeErrorZ_get_ok(uint64_t owner) {
8972         LDKCResult_SpliceLockedDecodeErrorZ* owner_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(owner);
8973         LDKSpliceLocked ret_var = CResult_SpliceLockedDecodeErrorZ_get_ok(owner_conv);
8974         uint64_t ret_ref = 0;
8975         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8976         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8977         return ret_ref;
8978 }
8979
8980 static inline struct LDKDecodeError CResult_SpliceLockedDecodeErrorZ_get_err(LDKCResult_SpliceLockedDecodeErrorZ *NONNULL_PTR owner){
8981 CHECK(!owner->result_ok);
8982         return DecodeError_clone(&*owner->contents.err);
8983 }
8984 uint64_t  __attribute__((export_name("TS_CResult_SpliceLockedDecodeErrorZ_get_err"))) TS_CResult_SpliceLockedDecodeErrorZ_get_err(uint64_t owner) {
8985         LDKCResult_SpliceLockedDecodeErrorZ* owner_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(owner);
8986         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8987         *ret_copy = CResult_SpliceLockedDecodeErrorZ_get_err(owner_conv);
8988         uint64_t ret_ref = tag_ptr(ret_copy, true);
8989         return ret_ref;
8990 }
8991
8992 static inline struct LDKTxAddInput CResult_TxAddInputDecodeErrorZ_get_ok(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR owner){
8993         LDKTxAddInput ret = *owner->contents.result;
8994         ret.is_owned = false;
8995         return ret;
8996 }
8997 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_get_ok"))) TS_CResult_TxAddInputDecodeErrorZ_get_ok(uint64_t owner) {
8998         LDKCResult_TxAddInputDecodeErrorZ* owner_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(owner);
8999         LDKTxAddInput ret_var = CResult_TxAddInputDecodeErrorZ_get_ok(owner_conv);
9000         uint64_t ret_ref = 0;
9001         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9002         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9003         return ret_ref;
9004 }
9005
9006 static inline struct LDKDecodeError CResult_TxAddInputDecodeErrorZ_get_err(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR owner){
9007 CHECK(!owner->result_ok);
9008         return DecodeError_clone(&*owner->contents.err);
9009 }
9010 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_get_err"))) TS_CResult_TxAddInputDecodeErrorZ_get_err(uint64_t owner) {
9011         LDKCResult_TxAddInputDecodeErrorZ* owner_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(owner);
9012         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9013         *ret_copy = CResult_TxAddInputDecodeErrorZ_get_err(owner_conv);
9014         uint64_t ret_ref = tag_ptr(ret_copy, true);
9015         return ret_ref;
9016 }
9017
9018 static inline struct LDKTxAddOutput CResult_TxAddOutputDecodeErrorZ_get_ok(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR owner){
9019         LDKTxAddOutput ret = *owner->contents.result;
9020         ret.is_owned = false;
9021         return ret;
9022 }
9023 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_get_ok"))) TS_CResult_TxAddOutputDecodeErrorZ_get_ok(uint64_t owner) {
9024         LDKCResult_TxAddOutputDecodeErrorZ* owner_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(owner);
9025         LDKTxAddOutput ret_var = CResult_TxAddOutputDecodeErrorZ_get_ok(owner_conv);
9026         uint64_t ret_ref = 0;
9027         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9028         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9029         return ret_ref;
9030 }
9031
9032 static inline struct LDKDecodeError CResult_TxAddOutputDecodeErrorZ_get_err(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR owner){
9033 CHECK(!owner->result_ok);
9034         return DecodeError_clone(&*owner->contents.err);
9035 }
9036 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_get_err"))) TS_CResult_TxAddOutputDecodeErrorZ_get_err(uint64_t owner) {
9037         LDKCResult_TxAddOutputDecodeErrorZ* owner_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(owner);
9038         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9039         *ret_copy = CResult_TxAddOutputDecodeErrorZ_get_err(owner_conv);
9040         uint64_t ret_ref = tag_ptr(ret_copy, true);
9041         return ret_ref;
9042 }
9043
9044 static inline struct LDKTxRemoveInput CResult_TxRemoveInputDecodeErrorZ_get_ok(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR owner){
9045         LDKTxRemoveInput ret = *owner->contents.result;
9046         ret.is_owned = false;
9047         return ret;
9048 }
9049 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_get_ok"))) TS_CResult_TxRemoveInputDecodeErrorZ_get_ok(uint64_t owner) {
9050         LDKCResult_TxRemoveInputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(owner);
9051         LDKTxRemoveInput ret_var = CResult_TxRemoveInputDecodeErrorZ_get_ok(owner_conv);
9052         uint64_t ret_ref = 0;
9053         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9054         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9055         return ret_ref;
9056 }
9057
9058 static inline struct LDKDecodeError CResult_TxRemoveInputDecodeErrorZ_get_err(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR owner){
9059 CHECK(!owner->result_ok);
9060         return DecodeError_clone(&*owner->contents.err);
9061 }
9062 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_get_err"))) TS_CResult_TxRemoveInputDecodeErrorZ_get_err(uint64_t owner) {
9063         LDKCResult_TxRemoveInputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(owner);
9064         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9065         *ret_copy = CResult_TxRemoveInputDecodeErrorZ_get_err(owner_conv);
9066         uint64_t ret_ref = tag_ptr(ret_copy, true);
9067         return ret_ref;
9068 }
9069
9070 static inline struct LDKTxRemoveOutput CResult_TxRemoveOutputDecodeErrorZ_get_ok(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR owner){
9071         LDKTxRemoveOutput ret = *owner->contents.result;
9072         ret.is_owned = false;
9073         return ret;
9074 }
9075 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_get_ok"))) TS_CResult_TxRemoveOutputDecodeErrorZ_get_ok(uint64_t owner) {
9076         LDKCResult_TxRemoveOutputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(owner);
9077         LDKTxRemoveOutput ret_var = CResult_TxRemoveOutputDecodeErrorZ_get_ok(owner_conv);
9078         uint64_t ret_ref = 0;
9079         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9080         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9081         return ret_ref;
9082 }
9083
9084 static inline struct LDKDecodeError CResult_TxRemoveOutputDecodeErrorZ_get_err(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR owner){
9085 CHECK(!owner->result_ok);
9086         return DecodeError_clone(&*owner->contents.err);
9087 }
9088 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_get_err"))) TS_CResult_TxRemoveOutputDecodeErrorZ_get_err(uint64_t owner) {
9089         LDKCResult_TxRemoveOutputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(owner);
9090         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9091         *ret_copy = CResult_TxRemoveOutputDecodeErrorZ_get_err(owner_conv);
9092         uint64_t ret_ref = tag_ptr(ret_copy, true);
9093         return ret_ref;
9094 }
9095
9096 static inline struct LDKTxComplete CResult_TxCompleteDecodeErrorZ_get_ok(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR owner){
9097         LDKTxComplete ret = *owner->contents.result;
9098         ret.is_owned = false;
9099         return ret;
9100 }
9101 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_get_ok"))) TS_CResult_TxCompleteDecodeErrorZ_get_ok(uint64_t owner) {
9102         LDKCResult_TxCompleteDecodeErrorZ* owner_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(owner);
9103         LDKTxComplete ret_var = CResult_TxCompleteDecodeErrorZ_get_ok(owner_conv);
9104         uint64_t ret_ref = 0;
9105         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9106         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9107         return ret_ref;
9108 }
9109
9110 static inline struct LDKDecodeError CResult_TxCompleteDecodeErrorZ_get_err(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR owner){
9111 CHECK(!owner->result_ok);
9112         return DecodeError_clone(&*owner->contents.err);
9113 }
9114 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_get_err"))) TS_CResult_TxCompleteDecodeErrorZ_get_err(uint64_t owner) {
9115         LDKCResult_TxCompleteDecodeErrorZ* owner_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(owner);
9116         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9117         *ret_copy = CResult_TxCompleteDecodeErrorZ_get_err(owner_conv);
9118         uint64_t ret_ref = tag_ptr(ret_copy, true);
9119         return ret_ref;
9120 }
9121
9122 static inline struct LDKTxSignatures CResult_TxSignaturesDecodeErrorZ_get_ok(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR owner){
9123         LDKTxSignatures ret = *owner->contents.result;
9124         ret.is_owned = false;
9125         return ret;
9126 }
9127 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_get_ok"))) TS_CResult_TxSignaturesDecodeErrorZ_get_ok(uint64_t owner) {
9128         LDKCResult_TxSignaturesDecodeErrorZ* owner_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(owner);
9129         LDKTxSignatures ret_var = CResult_TxSignaturesDecodeErrorZ_get_ok(owner_conv);
9130         uint64_t ret_ref = 0;
9131         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9132         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9133         return ret_ref;
9134 }
9135
9136 static inline struct LDKDecodeError CResult_TxSignaturesDecodeErrorZ_get_err(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR owner){
9137 CHECK(!owner->result_ok);
9138         return DecodeError_clone(&*owner->contents.err);
9139 }
9140 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_get_err"))) TS_CResult_TxSignaturesDecodeErrorZ_get_err(uint64_t owner) {
9141         LDKCResult_TxSignaturesDecodeErrorZ* owner_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(owner);
9142         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9143         *ret_copy = CResult_TxSignaturesDecodeErrorZ_get_err(owner_conv);
9144         uint64_t ret_ref = tag_ptr(ret_copy, true);
9145         return ret_ref;
9146 }
9147
9148 static inline struct LDKTxInitRbf CResult_TxInitRbfDecodeErrorZ_get_ok(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR owner){
9149         LDKTxInitRbf ret = *owner->contents.result;
9150         ret.is_owned = false;
9151         return ret;
9152 }
9153 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_get_ok"))) TS_CResult_TxInitRbfDecodeErrorZ_get_ok(uint64_t owner) {
9154         LDKCResult_TxInitRbfDecodeErrorZ* owner_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(owner);
9155         LDKTxInitRbf ret_var = CResult_TxInitRbfDecodeErrorZ_get_ok(owner_conv);
9156         uint64_t ret_ref = 0;
9157         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9158         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9159         return ret_ref;
9160 }
9161
9162 static inline struct LDKDecodeError CResult_TxInitRbfDecodeErrorZ_get_err(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR owner){
9163 CHECK(!owner->result_ok);
9164         return DecodeError_clone(&*owner->contents.err);
9165 }
9166 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_get_err"))) TS_CResult_TxInitRbfDecodeErrorZ_get_err(uint64_t owner) {
9167         LDKCResult_TxInitRbfDecodeErrorZ* owner_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(owner);
9168         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9169         *ret_copy = CResult_TxInitRbfDecodeErrorZ_get_err(owner_conv);
9170         uint64_t ret_ref = tag_ptr(ret_copy, true);
9171         return ret_ref;
9172 }
9173
9174 static inline struct LDKTxAckRbf CResult_TxAckRbfDecodeErrorZ_get_ok(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR owner){
9175         LDKTxAckRbf ret = *owner->contents.result;
9176         ret.is_owned = false;
9177         return ret;
9178 }
9179 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_get_ok"))) TS_CResult_TxAckRbfDecodeErrorZ_get_ok(uint64_t owner) {
9180         LDKCResult_TxAckRbfDecodeErrorZ* owner_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(owner);
9181         LDKTxAckRbf ret_var = CResult_TxAckRbfDecodeErrorZ_get_ok(owner_conv);
9182         uint64_t ret_ref = 0;
9183         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9184         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9185         return ret_ref;
9186 }
9187
9188 static inline struct LDKDecodeError CResult_TxAckRbfDecodeErrorZ_get_err(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR owner){
9189 CHECK(!owner->result_ok);
9190         return DecodeError_clone(&*owner->contents.err);
9191 }
9192 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_get_err"))) TS_CResult_TxAckRbfDecodeErrorZ_get_err(uint64_t owner) {
9193         LDKCResult_TxAckRbfDecodeErrorZ* owner_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(owner);
9194         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9195         *ret_copy = CResult_TxAckRbfDecodeErrorZ_get_err(owner_conv);
9196         uint64_t ret_ref = tag_ptr(ret_copy, true);
9197         return ret_ref;
9198 }
9199
9200 static inline struct LDKTxAbort CResult_TxAbortDecodeErrorZ_get_ok(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR owner){
9201         LDKTxAbort ret = *owner->contents.result;
9202         ret.is_owned = false;
9203         return ret;
9204 }
9205 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_get_ok"))) TS_CResult_TxAbortDecodeErrorZ_get_ok(uint64_t owner) {
9206         LDKCResult_TxAbortDecodeErrorZ* owner_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(owner);
9207         LDKTxAbort ret_var = CResult_TxAbortDecodeErrorZ_get_ok(owner_conv);
9208         uint64_t ret_ref = 0;
9209         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9210         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9211         return ret_ref;
9212 }
9213
9214 static inline struct LDKDecodeError CResult_TxAbortDecodeErrorZ_get_err(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR owner){
9215 CHECK(!owner->result_ok);
9216         return DecodeError_clone(&*owner->contents.err);
9217 }
9218 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_get_err"))) TS_CResult_TxAbortDecodeErrorZ_get_err(uint64_t owner) {
9219         LDKCResult_TxAbortDecodeErrorZ* owner_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(owner);
9220         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9221         *ret_copy = CResult_TxAbortDecodeErrorZ_get_err(owner_conv);
9222         uint64_t ret_ref = tag_ptr(ret_copy, true);
9223         return ret_ref;
9224 }
9225
9226 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
9227         LDKAnnouncementSignatures ret = *owner->contents.result;
9228         ret.is_owned = false;
9229         return ret;
9230 }
9231 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint64_t owner) {
9232         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
9233         LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
9234         uint64_t ret_ref = 0;
9235         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9236         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9237         return ret_ref;
9238 }
9239
9240 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
9241 CHECK(!owner->result_ok);
9242         return DecodeError_clone(&*owner->contents.err);
9243 }
9244 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint64_t owner) {
9245         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
9246         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9247         *ret_copy = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
9248         uint64_t ret_ref = tag_ptr(ret_copy, true);
9249         return ret_ref;
9250 }
9251
9252 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
9253         LDKChannelReestablish ret = *owner->contents.result;
9254         ret.is_owned = false;
9255         return ret;
9256 }
9257 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_ok(uint64_t owner) {
9258         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
9259         LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
9260         uint64_t ret_ref = 0;
9261         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9262         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9263         return ret_ref;
9264 }
9265
9266 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
9267 CHECK(!owner->result_ok);
9268         return DecodeError_clone(&*owner->contents.err);
9269 }
9270 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_err(uint64_t owner) {
9271         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
9272         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9273         *ret_copy = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
9274         uint64_t ret_ref = tag_ptr(ret_copy, true);
9275         return ret_ref;
9276 }
9277
9278 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
9279         LDKClosingSigned ret = *owner->contents.result;
9280         ret.is_owned = false;
9281         return ret;
9282 }
9283 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_get_ok(uint64_t owner) {
9284         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
9285         LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
9286         uint64_t ret_ref = 0;
9287         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9288         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9289         return ret_ref;
9290 }
9291
9292 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
9293 CHECK(!owner->result_ok);
9294         return DecodeError_clone(&*owner->contents.err);
9295 }
9296 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedDecodeErrorZ_get_err(uint64_t owner) {
9297         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
9298         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9299         *ret_copy = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
9300         uint64_t ret_ref = tag_ptr(ret_copy, true);
9301         return ret_ref;
9302 }
9303
9304 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
9305         LDKClosingSignedFeeRange ret = *owner->contents.result;
9306         ret.is_owned = false;
9307         return ret;
9308 }
9309 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(uint64_t owner) {
9310         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
9311         LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
9312         uint64_t ret_ref = 0;
9313         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9314         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9315         return ret_ref;
9316 }
9317
9318 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
9319 CHECK(!owner->result_ok);
9320         return DecodeError_clone(&*owner->contents.err);
9321 }
9322 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(uint64_t owner) {
9323         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
9324         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9325         *ret_copy = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
9326         uint64_t ret_ref = tag_ptr(ret_copy, true);
9327         return ret_ref;
9328 }
9329
9330 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
9331         LDKCommitmentSigned ret = *owner->contents.result;
9332         ret.is_owned = false;
9333         return ret;
9334 }
9335 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_ok(uint64_t owner) {
9336         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
9337         LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
9338         uint64_t ret_ref = 0;
9339         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9340         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9341         return ret_ref;
9342 }
9343
9344 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
9345 CHECK(!owner->result_ok);
9346         return DecodeError_clone(&*owner->contents.err);
9347 }
9348 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_err(uint64_t owner) {
9349         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
9350         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9351         *ret_copy = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
9352         uint64_t ret_ref = tag_ptr(ret_copy, true);
9353         return ret_ref;
9354 }
9355
9356 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
9357         LDKFundingCreated ret = *owner->contents.result;
9358         ret.is_owned = false;
9359         return ret;
9360 }
9361 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_get_ok(uint64_t owner) {
9362         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
9363         LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
9364         uint64_t ret_ref = 0;
9365         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9366         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9367         return ret_ref;
9368 }
9369
9370 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
9371 CHECK(!owner->result_ok);
9372         return DecodeError_clone(&*owner->contents.err);
9373 }
9374 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_err"))) TS_CResult_FundingCreatedDecodeErrorZ_get_err(uint64_t owner) {
9375         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
9376         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9377         *ret_copy = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
9378         uint64_t ret_ref = tag_ptr(ret_copy, true);
9379         return ret_ref;
9380 }
9381
9382 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
9383         LDKFundingSigned ret = *owner->contents.result;
9384         ret.is_owned = false;
9385         return ret;
9386 }
9387 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_ok"))) TS_CResult_FundingSignedDecodeErrorZ_get_ok(uint64_t owner) {
9388         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
9389         LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
9390         uint64_t ret_ref = 0;
9391         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9392         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9393         return ret_ref;
9394 }
9395
9396 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
9397 CHECK(!owner->result_ok);
9398         return DecodeError_clone(&*owner->contents.err);
9399 }
9400 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_err"))) TS_CResult_FundingSignedDecodeErrorZ_get_err(uint64_t owner) {
9401         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
9402         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9403         *ret_copy = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
9404         uint64_t ret_ref = tag_ptr(ret_copy, true);
9405         return ret_ref;
9406 }
9407
9408 static inline struct LDKChannelReady CResult_ChannelReadyDecodeErrorZ_get_ok(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
9409         LDKChannelReady ret = *owner->contents.result;
9410         ret.is_owned = false;
9411         return ret;
9412 }
9413 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_get_ok(uint64_t owner) {
9414         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
9415         LDKChannelReady ret_var = CResult_ChannelReadyDecodeErrorZ_get_ok(owner_conv);
9416         uint64_t ret_ref = 0;
9417         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9418         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9419         return ret_ref;
9420 }
9421
9422 static inline struct LDKDecodeError CResult_ChannelReadyDecodeErrorZ_get_err(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
9423 CHECK(!owner->result_ok);
9424         return DecodeError_clone(&*owner->contents.err);
9425 }
9426 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_err"))) TS_CResult_ChannelReadyDecodeErrorZ_get_err(uint64_t owner) {
9427         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
9428         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9429         *ret_copy = CResult_ChannelReadyDecodeErrorZ_get_err(owner_conv);
9430         uint64_t ret_ref = tag_ptr(ret_copy, true);
9431         return ret_ref;
9432 }
9433
9434 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
9435         LDKInit ret = *owner->contents.result;
9436         ret.is_owned = false;
9437         return ret;
9438 }
9439 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_ok"))) TS_CResult_InitDecodeErrorZ_get_ok(uint64_t owner) {
9440         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
9441         LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
9442         uint64_t ret_ref = 0;
9443         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9444         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9445         return ret_ref;
9446 }
9447
9448 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
9449 CHECK(!owner->result_ok);
9450         return DecodeError_clone(&*owner->contents.err);
9451 }
9452 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_err"))) TS_CResult_InitDecodeErrorZ_get_err(uint64_t owner) {
9453         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
9454         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9455         *ret_copy = CResult_InitDecodeErrorZ_get_err(owner_conv);
9456         uint64_t ret_ref = tag_ptr(ret_copy, true);
9457         return ret_ref;
9458 }
9459
9460 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
9461         LDKOpenChannel ret = *owner->contents.result;
9462         ret.is_owned = false;
9463         return ret;
9464 }
9465 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_ok"))) TS_CResult_OpenChannelDecodeErrorZ_get_ok(uint64_t owner) {
9466         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
9467         LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
9468         uint64_t ret_ref = 0;
9469         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9470         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9471         return ret_ref;
9472 }
9473
9474 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
9475 CHECK(!owner->result_ok);
9476         return DecodeError_clone(&*owner->contents.err);
9477 }
9478 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_err"))) TS_CResult_OpenChannelDecodeErrorZ_get_err(uint64_t owner) {
9479         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
9480         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9481         *ret_copy = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
9482         uint64_t ret_ref = tag_ptr(ret_copy, true);
9483         return ret_ref;
9484 }
9485
9486 static inline struct LDKOpenChannelV2 CResult_OpenChannelV2DecodeErrorZ_get_ok(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR owner){
9487         LDKOpenChannelV2 ret = *owner->contents.result;
9488         ret.is_owned = false;
9489         return ret;
9490 }
9491 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_get_ok"))) TS_CResult_OpenChannelV2DecodeErrorZ_get_ok(uint64_t owner) {
9492         LDKCResult_OpenChannelV2DecodeErrorZ* owner_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(owner);
9493         LDKOpenChannelV2 ret_var = CResult_OpenChannelV2DecodeErrorZ_get_ok(owner_conv);
9494         uint64_t ret_ref = 0;
9495         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9496         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9497         return ret_ref;
9498 }
9499
9500 static inline struct LDKDecodeError CResult_OpenChannelV2DecodeErrorZ_get_err(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR owner){
9501 CHECK(!owner->result_ok);
9502         return DecodeError_clone(&*owner->contents.err);
9503 }
9504 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_get_err"))) TS_CResult_OpenChannelV2DecodeErrorZ_get_err(uint64_t owner) {
9505         LDKCResult_OpenChannelV2DecodeErrorZ* owner_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(owner);
9506         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9507         *ret_copy = CResult_OpenChannelV2DecodeErrorZ_get_err(owner_conv);
9508         uint64_t ret_ref = tag_ptr(ret_copy, true);
9509         return ret_ref;
9510 }
9511
9512 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
9513         LDKRevokeAndACK ret = *owner->contents.result;
9514         ret.is_owned = false;
9515         return ret;
9516 }
9517 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_ok(uint64_t owner) {
9518         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
9519         LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
9520         uint64_t ret_ref = 0;
9521         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9522         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9523         return ret_ref;
9524 }
9525
9526 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
9527 CHECK(!owner->result_ok);
9528         return DecodeError_clone(&*owner->contents.err);
9529 }
9530 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_err(uint64_t owner) {
9531         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
9532         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9533         *ret_copy = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
9534         uint64_t ret_ref = tag_ptr(ret_copy, true);
9535         return ret_ref;
9536 }
9537
9538 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
9539         LDKShutdown ret = *owner->contents.result;
9540         ret.is_owned = false;
9541         return ret;
9542 }
9543 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_ok"))) TS_CResult_ShutdownDecodeErrorZ_get_ok(uint64_t owner) {
9544         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
9545         LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
9546         uint64_t ret_ref = 0;
9547         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9548         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9549         return ret_ref;
9550 }
9551
9552 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
9553 CHECK(!owner->result_ok);
9554         return DecodeError_clone(&*owner->contents.err);
9555 }
9556 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_err"))) TS_CResult_ShutdownDecodeErrorZ_get_err(uint64_t owner) {
9557         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
9558         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9559         *ret_copy = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
9560         uint64_t ret_ref = tag_ptr(ret_copy, true);
9561         return ret_ref;
9562 }
9563
9564 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
9565         LDKUpdateFailHTLC ret = *owner->contents.result;
9566         ret.is_owned = false;
9567         return ret;
9568 }
9569 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint64_t owner) {
9570         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
9571         LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
9572         uint64_t ret_ref = 0;
9573         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9574         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9575         return ret_ref;
9576 }
9577
9578 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
9579 CHECK(!owner->result_ok);
9580         return DecodeError_clone(&*owner->contents.err);
9581 }
9582 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err(uint64_t owner) {
9583         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
9584         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9585         *ret_copy = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
9586         uint64_t ret_ref = tag_ptr(ret_copy, true);
9587         return ret_ref;
9588 }
9589
9590 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
9591         LDKUpdateFailMalformedHTLC ret = *owner->contents.result;
9592         ret.is_owned = false;
9593         return ret;
9594 }
9595 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint64_t owner) {
9596         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
9597         LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
9598         uint64_t ret_ref = 0;
9599         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9600         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9601         return ret_ref;
9602 }
9603
9604 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
9605 CHECK(!owner->result_ok);
9606         return DecodeError_clone(&*owner->contents.err);
9607 }
9608 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint64_t owner) {
9609         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
9610         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9611         *ret_copy = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
9612         uint64_t ret_ref = tag_ptr(ret_copy, true);
9613         return ret_ref;
9614 }
9615
9616 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
9617         LDKUpdateFee ret = *owner->contents.result;
9618         ret.is_owned = false;
9619         return ret;
9620 }
9621 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_get_ok(uint64_t owner) {
9622         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
9623         LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
9624         uint64_t ret_ref = 0;
9625         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9626         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9627         return ret_ref;
9628 }
9629
9630 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
9631 CHECK(!owner->result_ok);
9632         return DecodeError_clone(&*owner->contents.err);
9633 }
9634 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_err"))) TS_CResult_UpdateFeeDecodeErrorZ_get_err(uint64_t owner) {
9635         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
9636         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9637         *ret_copy = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
9638         uint64_t ret_ref = tag_ptr(ret_copy, true);
9639         return ret_ref;
9640 }
9641
9642 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
9643         LDKUpdateFulfillHTLC ret = *owner->contents.result;
9644         ret.is_owned = false;
9645         return ret;
9646 }
9647 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint64_t owner) {
9648         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
9649         LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
9650         uint64_t ret_ref = 0;
9651         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9652         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9653         return ret_ref;
9654 }
9655
9656 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
9657 CHECK(!owner->result_ok);
9658         return DecodeError_clone(&*owner->contents.err);
9659 }
9660 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(uint64_t owner) {
9661         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
9662         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9663         *ret_copy = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
9664         uint64_t ret_ref = tag_ptr(ret_copy, true);
9665         return ret_ref;
9666 }
9667
9668 static inline struct LDKOnionPacket CResult_OnionPacketDecodeErrorZ_get_ok(LDKCResult_OnionPacketDecodeErrorZ *NONNULL_PTR owner){
9669         LDKOnionPacket ret = *owner->contents.result;
9670         ret.is_owned = false;
9671         return ret;
9672 }
9673 uint64_t  __attribute__((export_name("TS_CResult_OnionPacketDecodeErrorZ_get_ok"))) TS_CResult_OnionPacketDecodeErrorZ_get_ok(uint64_t owner) {
9674         LDKCResult_OnionPacketDecodeErrorZ* owner_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(owner);
9675         LDKOnionPacket ret_var = CResult_OnionPacketDecodeErrorZ_get_ok(owner_conv);
9676         uint64_t ret_ref = 0;
9677         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9678         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9679         return ret_ref;
9680 }
9681
9682 static inline struct LDKDecodeError CResult_OnionPacketDecodeErrorZ_get_err(LDKCResult_OnionPacketDecodeErrorZ *NONNULL_PTR owner){
9683 CHECK(!owner->result_ok);
9684         return DecodeError_clone(&*owner->contents.err);
9685 }
9686 uint64_t  __attribute__((export_name("TS_CResult_OnionPacketDecodeErrorZ_get_err"))) TS_CResult_OnionPacketDecodeErrorZ_get_err(uint64_t owner) {
9687         LDKCResult_OnionPacketDecodeErrorZ* owner_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(owner);
9688         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9689         *ret_copy = CResult_OnionPacketDecodeErrorZ_get_err(owner_conv);
9690         uint64_t ret_ref = tag_ptr(ret_copy, true);
9691         return ret_ref;
9692 }
9693
9694 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
9695         LDKUpdateAddHTLC ret = *owner->contents.result;
9696         ret.is_owned = false;
9697         return ret;
9698 }
9699 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint64_t owner) {
9700         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
9701         LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
9702         uint64_t ret_ref = 0;
9703         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9704         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9705         return ret_ref;
9706 }
9707
9708 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
9709 CHECK(!owner->result_ok);
9710         return DecodeError_clone(&*owner->contents.err);
9711 }
9712 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err(uint64_t owner) {
9713         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
9714         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9715         *ret_copy = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
9716         uint64_t ret_ref = tag_ptr(ret_copy, true);
9717         return ret_ref;
9718 }
9719
9720 static inline struct LDKOnionMessage CResult_OnionMessageDecodeErrorZ_get_ok(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
9721         LDKOnionMessage ret = *owner->contents.result;
9722         ret.is_owned = false;
9723         return ret;
9724 }
9725 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_get_ok"))) TS_CResult_OnionMessageDecodeErrorZ_get_ok(uint64_t owner) {
9726         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
9727         LDKOnionMessage ret_var = CResult_OnionMessageDecodeErrorZ_get_ok(owner_conv);
9728         uint64_t ret_ref = 0;
9729         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9730         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9731         return ret_ref;
9732 }
9733
9734 static inline struct LDKDecodeError CResult_OnionMessageDecodeErrorZ_get_err(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
9735 CHECK(!owner->result_ok);
9736         return DecodeError_clone(&*owner->contents.err);
9737 }
9738 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_get_err"))) TS_CResult_OnionMessageDecodeErrorZ_get_err(uint64_t owner) {
9739         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
9740         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9741         *ret_copy = CResult_OnionMessageDecodeErrorZ_get_err(owner_conv);
9742         uint64_t ret_ref = tag_ptr(ret_copy, true);
9743         return ret_ref;
9744 }
9745
9746 static inline struct LDKFinalOnionHopData CResult_FinalOnionHopDataDecodeErrorZ_get_ok(LDKCResult_FinalOnionHopDataDecodeErrorZ *NONNULL_PTR owner){
9747         LDKFinalOnionHopData ret = *owner->contents.result;
9748         ret.is_owned = false;
9749         return ret;
9750 }
9751 uint64_t  __attribute__((export_name("TS_CResult_FinalOnionHopDataDecodeErrorZ_get_ok"))) TS_CResult_FinalOnionHopDataDecodeErrorZ_get_ok(uint64_t owner) {
9752         LDKCResult_FinalOnionHopDataDecodeErrorZ* owner_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(owner);
9753         LDKFinalOnionHopData ret_var = CResult_FinalOnionHopDataDecodeErrorZ_get_ok(owner_conv);
9754         uint64_t ret_ref = 0;
9755         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9756         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9757         return ret_ref;
9758 }
9759
9760 static inline struct LDKDecodeError CResult_FinalOnionHopDataDecodeErrorZ_get_err(LDKCResult_FinalOnionHopDataDecodeErrorZ *NONNULL_PTR owner){
9761 CHECK(!owner->result_ok);
9762         return DecodeError_clone(&*owner->contents.err);
9763 }
9764 uint64_t  __attribute__((export_name("TS_CResult_FinalOnionHopDataDecodeErrorZ_get_err"))) TS_CResult_FinalOnionHopDataDecodeErrorZ_get_err(uint64_t owner) {
9765         LDKCResult_FinalOnionHopDataDecodeErrorZ* owner_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(owner);
9766         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9767         *ret_copy = CResult_FinalOnionHopDataDecodeErrorZ_get_err(owner_conv);
9768         uint64_t ret_ref = tag_ptr(ret_copy, true);
9769         return ret_ref;
9770 }
9771
9772 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
9773         LDKPing ret = *owner->contents.result;
9774         ret.is_owned = false;
9775         return ret;
9776 }
9777 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_ok"))) TS_CResult_PingDecodeErrorZ_get_ok(uint64_t owner) {
9778         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
9779         LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
9780         uint64_t ret_ref = 0;
9781         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9782         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9783         return ret_ref;
9784 }
9785
9786 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
9787 CHECK(!owner->result_ok);
9788         return DecodeError_clone(&*owner->contents.err);
9789 }
9790 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_err"))) TS_CResult_PingDecodeErrorZ_get_err(uint64_t owner) {
9791         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
9792         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9793         *ret_copy = CResult_PingDecodeErrorZ_get_err(owner_conv);
9794         uint64_t ret_ref = tag_ptr(ret_copy, true);
9795         return ret_ref;
9796 }
9797
9798 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
9799         LDKPong ret = *owner->contents.result;
9800         ret.is_owned = false;
9801         return ret;
9802 }
9803 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_ok"))) TS_CResult_PongDecodeErrorZ_get_ok(uint64_t owner) {
9804         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
9805         LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
9806         uint64_t ret_ref = 0;
9807         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9808         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9809         return ret_ref;
9810 }
9811
9812 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
9813 CHECK(!owner->result_ok);
9814         return DecodeError_clone(&*owner->contents.err);
9815 }
9816 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_err"))) TS_CResult_PongDecodeErrorZ_get_err(uint64_t owner) {
9817         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
9818         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9819         *ret_copy = CResult_PongDecodeErrorZ_get_err(owner_conv);
9820         uint64_t ret_ref = tag_ptr(ret_copy, true);
9821         return ret_ref;
9822 }
9823
9824 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9825         LDKUnsignedChannelAnnouncement ret = *owner->contents.result;
9826         ret.is_owned = false;
9827         return ret;
9828 }
9829 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
9830         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
9831         LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
9832         uint64_t ret_ref = 0;
9833         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9834         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9835         return ret_ref;
9836 }
9837
9838 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9839 CHECK(!owner->result_ok);
9840         return DecodeError_clone(&*owner->contents.err);
9841 }
9842 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
9843         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
9844         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9845         *ret_copy = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
9846         uint64_t ret_ref = tag_ptr(ret_copy, true);
9847         return ret_ref;
9848 }
9849
9850 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9851         LDKChannelAnnouncement ret = *owner->contents.result;
9852         ret.is_owned = false;
9853         return ret;
9854 }
9855 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
9856         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
9857         LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
9858         uint64_t ret_ref = 0;
9859         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9860         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9861         return ret_ref;
9862 }
9863
9864 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9865 CHECK(!owner->result_ok);
9866         return DecodeError_clone(&*owner->contents.err);
9867 }
9868 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
9869         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
9870         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9871         *ret_copy = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
9872         uint64_t ret_ref = tag_ptr(ret_copy, true);
9873         return ret_ref;
9874 }
9875
9876 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9877         LDKUnsignedChannelUpdate ret = *owner->contents.result;
9878         ret.is_owned = false;
9879         return ret;
9880 }
9881 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint64_t owner) {
9882         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
9883         LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
9884         uint64_t ret_ref = 0;
9885         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9886         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9887         return ret_ref;
9888 }
9889
9890 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9891 CHECK(!owner->result_ok);
9892         return DecodeError_clone(&*owner->contents.err);
9893 }
9894 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint64_t owner) {
9895         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
9896         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9897         *ret_copy = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
9898         uint64_t ret_ref = tag_ptr(ret_copy, true);
9899         return ret_ref;
9900 }
9901
9902 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9903         LDKChannelUpdate ret = *owner->contents.result;
9904         ret.is_owned = false;
9905         return ret;
9906 }
9907 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_ok(uint64_t owner) {
9908         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
9909         LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
9910         uint64_t ret_ref = 0;
9911         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9912         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9913         return ret_ref;
9914 }
9915
9916 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9917 CHECK(!owner->result_ok);
9918         return DecodeError_clone(&*owner->contents.err);
9919 }
9920 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_err(uint64_t owner) {
9921         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
9922         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9923         *ret_copy = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
9924         uint64_t ret_ref = tag_ptr(ret_copy, true);
9925         return ret_ref;
9926 }
9927
9928 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
9929         LDKErrorMessage ret = *owner->contents.result;
9930         ret.is_owned = false;
9931         return ret;
9932 }
9933 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_get_ok(uint64_t owner) {
9934         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
9935         LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
9936         uint64_t ret_ref = 0;
9937         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9938         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9939         return ret_ref;
9940 }
9941
9942 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
9943 CHECK(!owner->result_ok);
9944         return DecodeError_clone(&*owner->contents.err);
9945 }
9946 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_err"))) TS_CResult_ErrorMessageDecodeErrorZ_get_err(uint64_t owner) {
9947         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
9948         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9949         *ret_copy = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
9950         uint64_t ret_ref = tag_ptr(ret_copy, true);
9951         return ret_ref;
9952 }
9953
9954 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
9955         LDKWarningMessage ret = *owner->contents.result;
9956         ret.is_owned = false;
9957         return ret;
9958 }
9959 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_ok"))) TS_CResult_WarningMessageDecodeErrorZ_get_ok(uint64_t owner) {
9960         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
9961         LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
9962         uint64_t ret_ref = 0;
9963         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9964         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9965         return ret_ref;
9966 }
9967
9968 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
9969 CHECK(!owner->result_ok);
9970         return DecodeError_clone(&*owner->contents.err);
9971 }
9972 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_err"))) TS_CResult_WarningMessageDecodeErrorZ_get_err(uint64_t owner) {
9973         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
9974         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9975         *ret_copy = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
9976         uint64_t ret_ref = tag_ptr(ret_copy, true);
9977         return ret_ref;
9978 }
9979
9980 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9981         LDKUnsignedNodeAnnouncement ret = *owner->contents.result;
9982         ret.is_owned = false;
9983         return ret;
9984 }
9985 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
9986         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
9987         LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
9988         uint64_t ret_ref = 0;
9989         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9990         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9991         return ret_ref;
9992 }
9993
9994 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9995 CHECK(!owner->result_ok);
9996         return DecodeError_clone(&*owner->contents.err);
9997 }
9998 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
9999         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
10000         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10001         *ret_copy = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
10002         uint64_t ret_ref = tag_ptr(ret_copy, true);
10003         return ret_ref;
10004 }
10005
10006 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
10007         LDKNodeAnnouncement ret = *owner->contents.result;
10008         ret.is_owned = false;
10009         return ret;
10010 }
10011 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
10012         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
10013         LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
10014         uint64_t ret_ref = 0;
10015         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10016         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10017         return ret_ref;
10018 }
10019
10020 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
10021 CHECK(!owner->result_ok);
10022         return DecodeError_clone(&*owner->contents.err);
10023 }
10024 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
10025         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
10026         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10027         *ret_copy = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
10028         uint64_t ret_ref = tag_ptr(ret_copy, true);
10029         return ret_ref;
10030 }
10031
10032 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
10033         LDKQueryShortChannelIds ret = *owner->contents.result;
10034         ret.is_owned = false;
10035         return ret;
10036 }
10037 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint64_t owner) {
10038         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
10039         LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
10040         uint64_t ret_ref = 0;
10041         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10042         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10043         return ret_ref;
10044 }
10045
10046 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
10047 CHECK(!owner->result_ok);
10048         return DecodeError_clone(&*owner->contents.err);
10049 }
10050 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint64_t owner) {
10051         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
10052         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10053         *ret_copy = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
10054         uint64_t ret_ref = tag_ptr(ret_copy, true);
10055         return ret_ref;
10056 }
10057
10058 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
10059         LDKReplyShortChannelIdsEnd ret = *owner->contents.result;
10060         ret.is_owned = false;
10061         return ret;
10062 }
10063 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint64_t owner) {
10064         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
10065         LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
10066         uint64_t ret_ref = 0;
10067         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10068         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10069         return ret_ref;
10070 }
10071
10072 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
10073 CHECK(!owner->result_ok);
10074         return DecodeError_clone(&*owner->contents.err);
10075 }
10076 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint64_t owner) {
10077         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
10078         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10079         *ret_copy = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
10080         uint64_t ret_ref = tag_ptr(ret_copy, true);
10081         return ret_ref;
10082 }
10083
10084 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
10085         LDKQueryChannelRange ret = *owner->contents.result;
10086         ret.is_owned = false;
10087         return ret;
10088 }
10089 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok(uint64_t owner) {
10090         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
10091         LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
10092         uint64_t ret_ref = 0;
10093         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10094         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10095         return ret_ref;
10096 }
10097
10098 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
10099 CHECK(!owner->result_ok);
10100         return DecodeError_clone(&*owner->contents.err);
10101 }
10102 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_err(uint64_t owner) {
10103         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
10104         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10105         *ret_copy = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
10106         uint64_t ret_ref = tag_ptr(ret_copy, true);
10107         return ret_ref;
10108 }
10109
10110 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
10111         LDKReplyChannelRange ret = *owner->contents.result;
10112         ret.is_owned = false;
10113         return ret;
10114 }
10115 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint64_t owner) {
10116         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
10117         LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
10118         uint64_t ret_ref = 0;
10119         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10120         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10121         return ret_ref;
10122 }
10123
10124 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
10125 CHECK(!owner->result_ok);
10126         return DecodeError_clone(&*owner->contents.err);
10127 }
10128 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err(uint64_t owner) {
10129         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
10130         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10131         *ret_copy = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
10132         uint64_t ret_ref = tag_ptr(ret_copy, true);
10133         return ret_ref;
10134 }
10135
10136 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
10137         LDKGossipTimestampFilter ret = *owner->contents.result;
10138         ret.is_owned = false;
10139         return ret;
10140 }
10141 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint64_t owner) {
10142         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
10143         LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
10144         uint64_t ret_ref = 0;
10145         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10146         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10147         return ret_ref;
10148 }
10149
10150 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
10151 CHECK(!owner->result_ok);
10152         return DecodeError_clone(&*owner->contents.err);
10153 }
10154 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err(uint64_t owner) {
10155         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
10156         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10157         *ret_copy = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
10158         uint64_t ret_ref = tag_ptr(ret_copy, true);
10159         return ret_ref;
10160 }
10161
10162 static inline LDKCVec_PhantomRouteHintsZ CVec_PhantomRouteHintsZ_clone(const LDKCVec_PhantomRouteHintsZ *orig) {
10163         LDKCVec_PhantomRouteHintsZ ret = { .data = MALLOC(sizeof(LDKPhantomRouteHints) * orig->datalen, "LDKCVec_PhantomRouteHintsZ clone bytes"), .datalen = orig->datalen };
10164         for (size_t i = 0; i < ret.datalen; i++) {
10165                 ret.data[i] = PhantomRouteHints_clone(&orig->data[i]);
10166         }
10167         return ret;
10168 }
10169 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_ty_from_ptr"))) TS_LDKSignOrCreationError_ty_from_ptr(uint64_t ptr) {
10170         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
10171         switch(obj->tag) {
10172                 case LDKSignOrCreationError_SignError: return 0;
10173                 case LDKSignOrCreationError_CreationError: return 1;
10174                 default: abort();
10175         }
10176 }
10177 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_CreationError_get_creation_error"))) TS_LDKSignOrCreationError_CreationError_get_creation_error(uint64_t ptr) {
10178         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
10179         assert(obj->tag == LDKSignOrCreationError_CreationError);
10180         uint32_t creation_error_conv = LDKCreationError_to_js(obj->creation_error);
10181         return creation_error_conv;
10182 }
10183 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
10184         LDKBolt11Invoice ret = *owner->contents.result;
10185         ret.is_owned = false;
10186         return ret;
10187 }
10188 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(uint64_t owner) {
10189         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
10190         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
10191         uint64_t ret_ref = 0;
10192         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10193         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10194         return ret_ref;
10195 }
10196
10197 static inline struct LDKSignOrCreationError CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
10198 CHECK(!owner->result_ok);
10199         return SignOrCreationError_clone(&*owner->contents.err);
10200 }
10201 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(uint64_t owner) {
10202         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
10203         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
10204         *ret_copy = CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(owner_conv);
10205         uint64_t ret_ref = tag_ptr(ret_copy, true);
10206         return ret_ref;
10207 }
10208
10209 static inline struct LDKOffersMessage CResult_OffersMessageDecodeErrorZ_get_ok(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR owner){
10210 CHECK(owner->result_ok);
10211         return OffersMessage_clone(&*owner->contents.result);
10212 }
10213 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_get_ok"))) TS_CResult_OffersMessageDecodeErrorZ_get_ok(uint64_t owner) {
10214         LDKCResult_OffersMessageDecodeErrorZ* owner_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(owner);
10215         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
10216         *ret_copy = CResult_OffersMessageDecodeErrorZ_get_ok(owner_conv);
10217         uint64_t ret_ref = tag_ptr(ret_copy, true);
10218         return ret_ref;
10219 }
10220
10221 static inline struct LDKDecodeError CResult_OffersMessageDecodeErrorZ_get_err(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR owner){
10222 CHECK(!owner->result_ok);
10223         return DecodeError_clone(&*owner->contents.err);
10224 }
10225 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_get_err"))) TS_CResult_OffersMessageDecodeErrorZ_get_err(uint64_t owner) {
10226         LDKCResult_OffersMessageDecodeErrorZ* owner_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(owner);
10227         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10228         *ret_copy = CResult_OffersMessageDecodeErrorZ_get_err(owner_conv);
10229         uint64_t ret_ref = tag_ptr(ret_copy, true);
10230         return ret_ref;
10231 }
10232
10233 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCClaimZ_ty_from_ptr"))) TS_LDKCOption_HTLCClaimZ_ty_from_ptr(uint64_t ptr) {
10234         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
10235         switch(obj->tag) {
10236                 case LDKCOption_HTLCClaimZ_Some: return 0;
10237                 case LDKCOption_HTLCClaimZ_None: return 1;
10238                 default: abort();
10239         }
10240 }
10241 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCClaimZ_Some_get_some"))) TS_LDKCOption_HTLCClaimZ_Some_get_some(uint64_t ptr) {
10242         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
10243         assert(obj->tag == LDKCOption_HTLCClaimZ_Some);
10244         uint32_t some_conv = LDKHTLCClaim_to_js(obj->some);
10245         return some_conv;
10246 }
10247 static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
10248         LDKCounterpartyCommitmentSecrets ret = *owner->contents.result;
10249         ret.is_owned = false;
10250         return ret;
10251 }
10252 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(uint64_t owner) {
10253         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
10254         LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(owner_conv);
10255         uint64_t ret_ref = 0;
10256         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10257         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10258         return ret_ref;
10259 }
10260
10261 static inline struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
10262 CHECK(!owner->result_ok);
10263         return DecodeError_clone(&*owner->contents.err);
10264 }
10265 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(uint64_t owner) {
10266         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
10267         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10268         *ret_copy = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv);
10269         uint64_t ret_ref = tag_ptr(ret_copy, true);
10270         return ret_ref;
10271 }
10272
10273 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
10274         LDKTxCreationKeys ret = *owner->contents.result;
10275         ret.is_owned = false;
10276         return ret;
10277 }
10278 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_ok(uint64_t owner) {
10279         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
10280         LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
10281         uint64_t ret_ref = 0;
10282         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10283         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10284         return ret_ref;
10285 }
10286
10287 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
10288 CHECK(!owner->result_ok);
10289         return DecodeError_clone(&*owner->contents.err);
10290 }
10291 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_err(uint64_t owner) {
10292         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
10293         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10294         *ret_copy = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
10295         uint64_t ret_ref = tag_ptr(ret_copy, true);
10296         return ret_ref;
10297 }
10298
10299 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
10300         LDKChannelPublicKeys ret = *owner->contents.result;
10301         ret.is_owned = false;
10302         return ret;
10303 }
10304 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok(uint64_t owner) {
10305         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
10306         LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
10307         uint64_t ret_ref = 0;
10308         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10309         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10310         return ret_ref;
10311 }
10312
10313 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
10314 CHECK(!owner->result_ok);
10315         return DecodeError_clone(&*owner->contents.err);
10316 }
10317 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err(uint64_t owner) {
10318         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
10319         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10320         *ret_copy = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
10321         uint64_t ret_ref = tag_ptr(ret_copy, true);
10322         return ret_ref;
10323 }
10324
10325 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
10326         LDKHTLCOutputInCommitment ret = *owner->contents.result;
10327         ret.is_owned = false;
10328         return ret;
10329 }
10330 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(uint64_t owner) {
10331         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
10332         LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
10333         uint64_t ret_ref = 0;
10334         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10335         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10336         return ret_ref;
10337 }
10338
10339 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
10340 CHECK(!owner->result_ok);
10341         return DecodeError_clone(&*owner->contents.err);
10342 }
10343 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(uint64_t owner) {
10344         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
10345         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10346         *ret_copy = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
10347         uint64_t ret_ref = tag_ptr(ret_copy, true);
10348         return ret_ref;
10349 }
10350
10351 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
10352         LDKCounterpartyChannelTransactionParameters ret = *owner->contents.result;
10353         ret.is_owned = false;
10354         return ret;
10355 }
10356 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(uint64_t owner) {
10357         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
10358         LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
10359         uint64_t ret_ref = 0;
10360         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10361         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10362         return ret_ref;
10363 }
10364
10365 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
10366 CHECK(!owner->result_ok);
10367         return DecodeError_clone(&*owner->contents.err);
10368 }
10369 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(uint64_t owner) {
10370         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
10371         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10372         *ret_copy = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
10373         uint64_t ret_ref = tag_ptr(ret_copy, true);
10374         return ret_ref;
10375 }
10376
10377 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
10378         LDKChannelTransactionParameters ret = *owner->contents.result;
10379         ret.is_owned = false;
10380         return ret;
10381 }
10382 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(uint64_t owner) {
10383         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
10384         LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
10385         uint64_t ret_ref = 0;
10386         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10387         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10388         return ret_ref;
10389 }
10390
10391 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
10392 CHECK(!owner->result_ok);
10393         return DecodeError_clone(&*owner->contents.err);
10394 }
10395 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err(uint64_t owner) {
10396         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
10397         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10398         *ret_copy = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
10399         uint64_t ret_ref = tag_ptr(ret_copy, true);
10400         return ret_ref;
10401 }
10402
10403 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
10404         LDKHolderCommitmentTransaction ret = *owner->contents.result;
10405         ret.is_owned = false;
10406         return ret;
10407 }
10408 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
10409         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
10410         LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
10411         uint64_t ret_ref = 0;
10412         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10413         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10414         return ret_ref;
10415 }
10416
10417 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
10418 CHECK(!owner->result_ok);
10419         return DecodeError_clone(&*owner->contents.err);
10420 }
10421 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
10422         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
10423         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10424         *ret_copy = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
10425         uint64_t ret_ref = tag_ptr(ret_copy, true);
10426         return ret_ref;
10427 }
10428
10429 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
10430         LDKBuiltCommitmentTransaction ret = *owner->contents.result;
10431         ret.is_owned = false;
10432         return ret;
10433 }
10434 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
10435         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
10436         LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
10437         uint64_t ret_ref = 0;
10438         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10439         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10440         return ret_ref;
10441 }
10442
10443 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
10444 CHECK(!owner->result_ok);
10445         return DecodeError_clone(&*owner->contents.err);
10446 }
10447 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
10448         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
10449         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10450         *ret_copy = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
10451         uint64_t ret_ref = tag_ptr(ret_copy, true);
10452         return ret_ref;
10453 }
10454
10455 static inline struct LDKTrustedClosingTransaction CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
10456         LDKTrustedClosingTransaction ret = *owner->contents.result;
10457         ret.is_owned = false;
10458         return ret;
10459 }
10460 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_get_ok(uint64_t owner) {
10461         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
10462         LDKTrustedClosingTransaction ret_var = CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
10463         uint64_t ret_ref = 0;
10464         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10465         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10466         return ret_ref;
10467 }
10468
10469 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
10470 CHECK(!owner->result_ok);
10471         return *owner->contents.err;
10472 }
10473 void  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_err"))) TS_CResult_TrustedClosingTransactionNoneZ_get_err(uint64_t owner) {
10474         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
10475         CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
10476 }
10477
10478 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
10479         LDKCommitmentTransaction ret = *owner->contents.result;
10480         ret.is_owned = false;
10481         return ret;
10482 }
10483 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
10484         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
10485         LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
10486         uint64_t ret_ref = 0;
10487         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10488         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10489         return ret_ref;
10490 }
10491
10492 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
10493 CHECK(!owner->result_ok);
10494         return DecodeError_clone(&*owner->contents.err);
10495 }
10496 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
10497         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
10498         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10499         *ret_copy = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
10500         uint64_t ret_ref = tag_ptr(ret_copy, true);
10501         return ret_ref;
10502 }
10503
10504 static inline struct LDKTrustedCommitmentTransaction CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
10505         LDKTrustedCommitmentTransaction ret = *owner->contents.result;
10506         ret.is_owned = false;
10507         return ret;
10508 }
10509 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok(uint64_t owner) {
10510         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
10511         LDKTrustedCommitmentTransaction ret_var = CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
10512         uint64_t ret_ref = 0;
10513         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10514         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10515         return ret_ref;
10516 }
10517
10518 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
10519 CHECK(!owner->result_ok);
10520         return *owner->contents.err;
10521 }
10522 void  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_err(uint64_t owner) {
10523         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
10524         CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
10525 }
10526
10527 static inline struct LDKCVec_ECDSASignatureZ CResult_CVec_ECDSASignatureZNoneZ_get_ok(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR owner){
10528 CHECK(owner->result_ok);
10529         return *owner->contents.result;
10530 }
10531 ptrArray  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_get_ok"))) TS_CResult_CVec_ECDSASignatureZNoneZ_get_ok(uint64_t owner) {
10532         LDKCResult_CVec_ECDSASignatureZNoneZ* owner_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(owner);
10533         LDKCVec_ECDSASignatureZ ret_var = CResult_CVec_ECDSASignatureZNoneZ_get_ok(owner_conv);
10534         ptrArray ret_arr = NULL;
10535         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
10536         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
10537         for (size_t m = 0; m < ret_var.datalen; m++) {
10538                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
10539                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
10540                 ret_arr_ptr[m] = ret_conv_12_arr;
10541         }
10542         
10543         return ret_arr;
10544 }
10545
10546 static inline void CResult_CVec_ECDSASignatureZNoneZ_get_err(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR owner){
10547 CHECK(!owner->result_ok);
10548         return *owner->contents.err;
10549 }
10550 void  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_get_err"))) TS_CResult_CVec_ECDSASignatureZNoneZ_get_err(uint64_t owner) {
10551         LDKCResult_CVec_ECDSASignatureZNoneZ* owner_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(owner);
10552         CResult_CVec_ECDSASignatureZNoneZ_get_err(owner_conv);
10553 }
10554
10555 uint32_t __attribute__((export_name("TS_LDKCOption_usizeZ_ty_from_ptr"))) TS_LDKCOption_usizeZ_ty_from_ptr(uint64_t ptr) {
10556         LDKCOption_usizeZ *obj = (LDKCOption_usizeZ*)untag_ptr(ptr);
10557         switch(obj->tag) {
10558                 case LDKCOption_usizeZ_Some: return 0;
10559                 case LDKCOption_usizeZ_None: return 1;
10560                 default: abort();
10561         }
10562 }
10563 uint32_t __attribute__((export_name("TS_LDKCOption_usizeZ_Some_get_some"))) TS_LDKCOption_usizeZ_Some_get_some(uint64_t ptr) {
10564         LDKCOption_usizeZ *obj = (LDKCOption_usizeZ*)untag_ptr(ptr);
10565         assert(obj->tag == LDKCOption_usizeZ_Some);
10566         uint32_t some_conv = obj->some;
10567         return some_conv;
10568 }
10569 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
10570         LDKShutdownScript ret = *owner->contents.result;
10571         ret.is_owned = false;
10572         return ret;
10573 }
10574 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_ok(uint64_t owner) {
10575         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
10576         LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
10577         uint64_t ret_ref = 0;
10578         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10579         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10580         return ret_ref;
10581 }
10582
10583 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
10584 CHECK(!owner->result_ok);
10585         return DecodeError_clone(&*owner->contents.err);
10586 }
10587 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_err(uint64_t owner) {
10588         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
10589         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10590         *ret_copy = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
10591         uint64_t ret_ref = tag_ptr(ret_copy, true);
10592         return ret_ref;
10593 }
10594
10595 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
10596         LDKShutdownScript ret = *owner->contents.result;
10597         ret.is_owned = false;
10598         return ret;
10599 }
10600 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(uint64_t owner) {
10601         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
10602         LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
10603         uint64_t ret_ref = 0;
10604         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10605         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10606         return ret_ref;
10607 }
10608
10609 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
10610         LDKInvalidShutdownScript ret = *owner->contents.err;
10611         ret.is_owned = false;
10612         return ret;
10613 }
10614 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(uint64_t owner) {
10615         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
10616         LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(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 uint32_t __attribute__((export_name("TS_LDKPaymentPurpose_ty_from_ptr"))) TS_LDKPaymentPurpose_ty_from_ptr(uint64_t ptr) {
10624         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
10625         switch(obj->tag) {
10626                 case LDKPaymentPurpose_Bolt11InvoicePayment: return 0;
10627                 case LDKPaymentPurpose_Bolt12OfferPayment: return 1;
10628                 case LDKPaymentPurpose_Bolt12RefundPayment: return 2;
10629                 case LDKPaymentPurpose_SpontaneousPayment: return 3;
10630                 default: abort();
10631         }
10632 }
10633 uint64_t __attribute__((export_name("TS_LDKPaymentPurpose_Bolt11InvoicePayment_get_payment_preimage"))) TS_LDKPaymentPurpose_Bolt11InvoicePayment_get_payment_preimage(uint64_t ptr) {
10634         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
10635         assert(obj->tag == LDKPaymentPurpose_Bolt11InvoicePayment);
10636         uint64_t payment_preimage_ref = tag_ptr(&obj->bolt11_invoice_payment.payment_preimage, false);
10637         return payment_preimage_ref;
10638 }
10639 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_Bolt11InvoicePayment_get_payment_secret"))) TS_LDKPaymentPurpose_Bolt11InvoicePayment_get_payment_secret(uint64_t ptr) {
10640         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
10641         assert(obj->tag == LDKPaymentPurpose_Bolt11InvoicePayment);
10642         int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
10643         memcpy(payment_secret_arr->elems, obj->bolt11_invoice_payment.payment_secret.data, 32);
10644         return payment_secret_arr;
10645 }
10646 uint64_t __attribute__((export_name("TS_LDKPaymentPurpose_Bolt12OfferPayment_get_payment_preimage"))) TS_LDKPaymentPurpose_Bolt12OfferPayment_get_payment_preimage(uint64_t ptr) {
10647         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
10648         assert(obj->tag == LDKPaymentPurpose_Bolt12OfferPayment);
10649         uint64_t payment_preimage_ref = tag_ptr(&obj->bolt12_offer_payment.payment_preimage, false);
10650         return payment_preimage_ref;
10651 }
10652 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_Bolt12OfferPayment_get_payment_secret"))) TS_LDKPaymentPurpose_Bolt12OfferPayment_get_payment_secret(uint64_t ptr) {
10653         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
10654         assert(obj->tag == LDKPaymentPurpose_Bolt12OfferPayment);
10655         int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
10656         memcpy(payment_secret_arr->elems, obj->bolt12_offer_payment.payment_secret.data, 32);
10657         return payment_secret_arr;
10658 }
10659 uint64_t __attribute__((export_name("TS_LDKPaymentPurpose_Bolt12OfferPayment_get_payment_context"))) TS_LDKPaymentPurpose_Bolt12OfferPayment_get_payment_context(uint64_t ptr) {
10660         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
10661         assert(obj->tag == LDKPaymentPurpose_Bolt12OfferPayment);
10662         LDKBolt12OfferContext payment_context_var = obj->bolt12_offer_payment.payment_context;
10663                         uint64_t payment_context_ref = 0;
10664                         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_context_var);
10665                         payment_context_ref = tag_ptr(payment_context_var.inner, false);
10666         return payment_context_ref;
10667 }
10668 uint64_t __attribute__((export_name("TS_LDKPaymentPurpose_Bolt12RefundPayment_get_payment_preimage"))) TS_LDKPaymentPurpose_Bolt12RefundPayment_get_payment_preimage(uint64_t ptr) {
10669         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
10670         assert(obj->tag == LDKPaymentPurpose_Bolt12RefundPayment);
10671         uint64_t payment_preimage_ref = tag_ptr(&obj->bolt12_refund_payment.payment_preimage, false);
10672         return payment_preimage_ref;
10673 }
10674 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_Bolt12RefundPayment_get_payment_secret"))) TS_LDKPaymentPurpose_Bolt12RefundPayment_get_payment_secret(uint64_t ptr) {
10675         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
10676         assert(obj->tag == LDKPaymentPurpose_Bolt12RefundPayment);
10677         int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
10678         memcpy(payment_secret_arr->elems, obj->bolt12_refund_payment.payment_secret.data, 32);
10679         return payment_secret_arr;
10680 }
10681 uint64_t __attribute__((export_name("TS_LDKPaymentPurpose_Bolt12RefundPayment_get_payment_context"))) TS_LDKPaymentPurpose_Bolt12RefundPayment_get_payment_context(uint64_t ptr) {
10682         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
10683         assert(obj->tag == LDKPaymentPurpose_Bolt12RefundPayment);
10684         LDKBolt12RefundContext payment_context_var = obj->bolt12_refund_payment.payment_context;
10685                         uint64_t payment_context_ref = 0;
10686                         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_context_var);
10687                         payment_context_ref = tag_ptr(payment_context_var.inner, false);
10688         return payment_context_ref;
10689 }
10690 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment"))) TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment(uint64_t ptr) {
10691         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
10692         assert(obj->tag == LDKPaymentPurpose_SpontaneousPayment);
10693         int8_tArray spontaneous_payment_arr = init_int8_tArray(32, __LINE__);
10694         memcpy(spontaneous_payment_arr->elems, obj->spontaneous_payment.data, 32);
10695         return spontaneous_payment_arr;
10696 }
10697 static inline struct LDKPaymentPurpose CResult_PaymentPurposeDecodeErrorZ_get_ok(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
10698 CHECK(owner->result_ok);
10699         return PaymentPurpose_clone(&*owner->contents.result);
10700 }
10701 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_ok(uint64_t owner) {
10702         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
10703         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
10704         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_ok(owner_conv);
10705         uint64_t ret_ref = tag_ptr(ret_copy, true);
10706         return ret_ref;
10707 }
10708
10709 static inline struct LDKDecodeError CResult_PaymentPurposeDecodeErrorZ_get_err(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
10710 CHECK(!owner->result_ok);
10711         return DecodeError_clone(&*owner->contents.err);
10712 }
10713 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_err(uint64_t owner) {
10714         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
10715         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10716         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_err(owner_conv);
10717         uint64_t ret_ref = tag_ptr(ret_copy, true);
10718         return ret_ref;
10719 }
10720
10721 static inline struct LDKClaimedHTLC CResult_ClaimedHTLCDecodeErrorZ_get_ok(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR owner){
10722         LDKClaimedHTLC ret = *owner->contents.result;
10723         ret.is_owned = false;
10724         return ret;
10725 }
10726 uint64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_get_ok"))) TS_CResult_ClaimedHTLCDecodeErrorZ_get_ok(uint64_t owner) {
10727         LDKCResult_ClaimedHTLCDecodeErrorZ* owner_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(owner);
10728         LDKClaimedHTLC ret_var = CResult_ClaimedHTLCDecodeErrorZ_get_ok(owner_conv);
10729         uint64_t ret_ref = 0;
10730         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10731         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10732         return ret_ref;
10733 }
10734
10735 static inline struct LDKDecodeError CResult_ClaimedHTLCDecodeErrorZ_get_err(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR owner){
10736 CHECK(!owner->result_ok);
10737         return DecodeError_clone(&*owner->contents.err);
10738 }
10739 uint64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_get_err"))) TS_CResult_ClaimedHTLCDecodeErrorZ_get_err(uint64_t owner) {
10740         LDKCResult_ClaimedHTLCDecodeErrorZ* owner_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(owner);
10741         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10742         *ret_copy = CResult_ClaimedHTLCDecodeErrorZ_get_err(owner_conv);
10743         uint64_t ret_ref = tag_ptr(ret_copy, true);
10744         return ret_ref;
10745 }
10746
10747 uint32_t __attribute__((export_name("TS_LDKPathFailure_ty_from_ptr"))) TS_LDKPathFailure_ty_from_ptr(uint64_t ptr) {
10748         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
10749         switch(obj->tag) {
10750                 case LDKPathFailure_InitialSend: return 0;
10751                 case LDKPathFailure_OnPath: return 1;
10752                 default: abort();
10753         }
10754 }
10755 uint64_t __attribute__((export_name("TS_LDKPathFailure_InitialSend_get_err"))) TS_LDKPathFailure_InitialSend_get_err(uint64_t ptr) {
10756         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
10757         assert(obj->tag == LDKPathFailure_InitialSend);
10758         uint64_t err_ref = tag_ptr(&obj->initial_send.err, false);
10759         return err_ref;
10760 }
10761 uint64_t __attribute__((export_name("TS_LDKPathFailure_OnPath_get_network_update"))) TS_LDKPathFailure_OnPath_get_network_update(uint64_t ptr) {
10762         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
10763         assert(obj->tag == LDKPathFailure_OnPath);
10764         uint64_t network_update_ref = tag_ptr(&obj->on_path.network_update, false);
10765         return network_update_ref;
10766 }
10767 uint32_t __attribute__((export_name("TS_LDKCOption_PathFailureZ_ty_from_ptr"))) TS_LDKCOption_PathFailureZ_ty_from_ptr(uint64_t ptr) {
10768         LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr);
10769         switch(obj->tag) {
10770                 case LDKCOption_PathFailureZ_Some: return 0;
10771                 case LDKCOption_PathFailureZ_None: return 1;
10772                 default: abort();
10773         }
10774 }
10775 uint64_t __attribute__((export_name("TS_LDKCOption_PathFailureZ_Some_get_some"))) TS_LDKCOption_PathFailureZ_Some_get_some(uint64_t ptr) {
10776         LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr);
10777         assert(obj->tag == LDKCOption_PathFailureZ_Some);
10778         uint64_t some_ref = tag_ptr(&obj->some, false);
10779         return some_ref;
10780 }
10781 static inline struct LDKCOption_PathFailureZ CResult_COption_PathFailureZDecodeErrorZ_get_ok(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
10782 CHECK(owner->result_ok);
10783         return COption_PathFailureZ_clone(&*owner->contents.result);
10784 }
10785 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_get_ok"))) TS_CResult_COption_PathFailureZDecodeErrorZ_get_ok(uint64_t owner) {
10786         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
10787         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
10788         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_ok(owner_conv);
10789         uint64_t ret_ref = tag_ptr(ret_copy, true);
10790         return ret_ref;
10791 }
10792
10793 static inline struct LDKDecodeError CResult_COption_PathFailureZDecodeErrorZ_get_err(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
10794 CHECK(!owner->result_ok);
10795         return DecodeError_clone(&*owner->contents.err);
10796 }
10797 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_get_err"))) TS_CResult_COption_PathFailureZDecodeErrorZ_get_err(uint64_t owner) {
10798         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
10799         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10800         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_err(owner_conv);
10801         uint64_t ret_ref = tag_ptr(ret_copy, true);
10802         return ret_ref;
10803 }
10804
10805 uint32_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_ty_from_ptr"))) TS_LDKCOption_ClosureReasonZ_ty_from_ptr(uint64_t ptr) {
10806         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
10807         switch(obj->tag) {
10808                 case LDKCOption_ClosureReasonZ_Some: return 0;
10809                 case LDKCOption_ClosureReasonZ_None: return 1;
10810                 default: abort();
10811         }
10812 }
10813 uint64_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_Some_get_some"))) TS_LDKCOption_ClosureReasonZ_Some_get_some(uint64_t ptr) {
10814         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
10815         assert(obj->tag == LDKCOption_ClosureReasonZ_Some);
10816         uint64_t some_ref = tag_ptr(&obj->some, false);
10817         return some_ref;
10818 }
10819 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
10820 CHECK(owner->result_ok);
10821         return COption_ClosureReasonZ_clone(&*owner->contents.result);
10822 }
10823 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(uint64_t owner) {
10824         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
10825         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
10826         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
10827         uint64_t ret_ref = tag_ptr(ret_copy, true);
10828         return ret_ref;
10829 }
10830
10831 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
10832 CHECK(!owner->result_ok);
10833         return DecodeError_clone(&*owner->contents.err);
10834 }
10835 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err(uint64_t owner) {
10836         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
10837         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10838         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
10839         uint64_t ret_ref = tag_ptr(ret_copy, true);
10840         return ret_ref;
10841 }
10842
10843 uint32_t __attribute__((export_name("TS_LDKHTLCDestination_ty_from_ptr"))) TS_LDKHTLCDestination_ty_from_ptr(uint64_t ptr) {
10844         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
10845         switch(obj->tag) {
10846                 case LDKHTLCDestination_NextHopChannel: return 0;
10847                 case LDKHTLCDestination_UnknownNextHop: return 1;
10848                 case LDKHTLCDestination_InvalidForward: return 2;
10849                 case LDKHTLCDestination_InvalidOnion: return 3;
10850                 case LDKHTLCDestination_FailedPayment: return 4;
10851                 default: abort();
10852         }
10853 }
10854 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_NextHopChannel_get_node_id"))) TS_LDKHTLCDestination_NextHopChannel_get_node_id(uint64_t ptr) {
10855         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
10856         assert(obj->tag == LDKHTLCDestination_NextHopChannel);
10857         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
10858         memcpy(node_id_arr->elems, obj->next_hop_channel.node_id.compressed_form, 33);
10859         return node_id_arr;
10860 }
10861 uint64_t __attribute__((export_name("TS_LDKHTLCDestination_NextHopChannel_get_channel_id"))) TS_LDKHTLCDestination_NextHopChannel_get_channel_id(uint64_t ptr) {
10862         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
10863         assert(obj->tag == LDKHTLCDestination_NextHopChannel);
10864         LDKChannelId channel_id_var = obj->next_hop_channel.channel_id;
10865                         uint64_t channel_id_ref = 0;
10866                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
10867                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
10868         return channel_id_ref;
10869 }
10870 int64_t __attribute__((export_name("TS_LDKHTLCDestination_UnknownNextHop_get_requested_forward_scid"))) TS_LDKHTLCDestination_UnknownNextHop_get_requested_forward_scid(uint64_t ptr) {
10871         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
10872         assert(obj->tag == LDKHTLCDestination_UnknownNextHop);
10873         int64_t requested_forward_scid_conv = obj->unknown_next_hop.requested_forward_scid;
10874         return requested_forward_scid_conv;
10875 }
10876 int64_t __attribute__((export_name("TS_LDKHTLCDestination_InvalidForward_get_requested_forward_scid"))) TS_LDKHTLCDestination_InvalidForward_get_requested_forward_scid(uint64_t ptr) {
10877         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
10878         assert(obj->tag == LDKHTLCDestination_InvalidForward);
10879         int64_t requested_forward_scid_conv = obj->invalid_forward.requested_forward_scid;
10880         return requested_forward_scid_conv;
10881 }
10882 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_FailedPayment_get_payment_hash"))) TS_LDKHTLCDestination_FailedPayment_get_payment_hash(uint64_t ptr) {
10883         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
10884         assert(obj->tag == LDKHTLCDestination_FailedPayment);
10885         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
10886         memcpy(payment_hash_arr->elems, obj->failed_payment.payment_hash.data, 32);
10887         return payment_hash_arr;
10888 }
10889 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCDestinationZ_ty_from_ptr"))) TS_LDKCOption_HTLCDestinationZ_ty_from_ptr(uint64_t ptr) {
10890         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
10891         switch(obj->tag) {
10892                 case LDKCOption_HTLCDestinationZ_Some: return 0;
10893                 case LDKCOption_HTLCDestinationZ_None: return 1;
10894                 default: abort();
10895         }
10896 }
10897 uint64_t __attribute__((export_name("TS_LDKCOption_HTLCDestinationZ_Some_get_some"))) TS_LDKCOption_HTLCDestinationZ_Some_get_some(uint64_t ptr) {
10898         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
10899         assert(obj->tag == LDKCOption_HTLCDestinationZ_Some);
10900         uint64_t some_ref = tag_ptr(&obj->some, false);
10901         return some_ref;
10902 }
10903 static inline struct LDKCOption_HTLCDestinationZ CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
10904 CHECK(owner->result_ok);
10905         return COption_HTLCDestinationZ_clone(&*owner->contents.result);
10906 }
10907 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(uint64_t owner) {
10908         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
10909         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
10910         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(owner_conv);
10911         uint64_t ret_ref = tag_ptr(ret_copy, true);
10912         return ret_ref;
10913 }
10914
10915 static inline struct LDKDecodeError CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
10916 CHECK(!owner->result_ok);
10917         return DecodeError_clone(&*owner->contents.err);
10918 }
10919 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_err"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(uint64_t owner) {
10920         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
10921         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10922         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(owner_conv);
10923         uint64_t ret_ref = tag_ptr(ret_copy, true);
10924         return ret_ref;
10925 }
10926
10927 static inline enum LDKPaymentFailureReason CResult_PaymentFailureReasonDecodeErrorZ_get_ok(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
10928 CHECK(owner->result_ok);
10929         return PaymentFailureReason_clone(&*owner->contents.result);
10930 }
10931 uint32_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_get_ok"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_get_ok(uint64_t owner) {
10932         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
10933         uint32_t ret_conv = LDKPaymentFailureReason_to_js(CResult_PaymentFailureReasonDecodeErrorZ_get_ok(owner_conv));
10934         return ret_conv;
10935 }
10936
10937 static inline struct LDKDecodeError CResult_PaymentFailureReasonDecodeErrorZ_get_err(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
10938 CHECK(!owner->result_ok);
10939         return DecodeError_clone(&*owner->contents.err);
10940 }
10941 uint64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_get_err"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_get_err(uint64_t owner) {
10942         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
10943         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10944         *ret_copy = CResult_PaymentFailureReasonDecodeErrorZ_get_err(owner_conv);
10945         uint64_t ret_ref = tag_ptr(ret_copy, true);
10946         return ret_ref;
10947 }
10948
10949 uint32_t __attribute__((export_name("TS_LDKCOption_U128Z_ty_from_ptr"))) TS_LDKCOption_U128Z_ty_from_ptr(uint64_t ptr) {
10950         LDKCOption_U128Z *obj = (LDKCOption_U128Z*)untag_ptr(ptr);
10951         switch(obj->tag) {
10952                 case LDKCOption_U128Z_Some: return 0;
10953                 case LDKCOption_U128Z_None: return 1;
10954                 default: abort();
10955         }
10956 }
10957 int8_tArray __attribute__((export_name("TS_LDKCOption_U128Z_Some_get_some"))) TS_LDKCOption_U128Z_Some_get_some(uint64_t ptr) {
10958         LDKCOption_U128Z *obj = (LDKCOption_U128Z*)untag_ptr(ptr);
10959         assert(obj->tag == LDKCOption_U128Z_Some);
10960         int8_tArray some_arr = init_int8_tArray(16, __LINE__);
10961         memcpy(some_arr->elems, obj->some.le_bytes, 16);
10962         return some_arr;
10963 }
10964 static inline LDKCVec_ClaimedHTLCZ CVec_ClaimedHTLCZ_clone(const LDKCVec_ClaimedHTLCZ *orig) {
10965         LDKCVec_ClaimedHTLCZ ret = { .data = MALLOC(sizeof(LDKClaimedHTLC) * orig->datalen, "LDKCVec_ClaimedHTLCZ clone bytes"), .datalen = orig->datalen };
10966         for (size_t i = 0; i < ret.datalen; i++) {
10967                 ret.data[i] = ClaimedHTLC_clone(&orig->data[i]);
10968         }
10969         return ret;
10970 }
10971 uint32_t __attribute__((export_name("TS_LDKCOption_PaymentFailureReasonZ_ty_from_ptr"))) TS_LDKCOption_PaymentFailureReasonZ_ty_from_ptr(uint64_t ptr) {
10972         LDKCOption_PaymentFailureReasonZ *obj = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(ptr);
10973         switch(obj->tag) {
10974                 case LDKCOption_PaymentFailureReasonZ_Some: return 0;
10975                 case LDKCOption_PaymentFailureReasonZ_None: return 1;
10976                 default: abort();
10977         }
10978 }
10979 uint32_t __attribute__((export_name("TS_LDKCOption_PaymentFailureReasonZ_Some_get_some"))) TS_LDKCOption_PaymentFailureReasonZ_Some_get_some(uint64_t ptr) {
10980         LDKCOption_PaymentFailureReasonZ *obj = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(ptr);
10981         assert(obj->tag == LDKCOption_PaymentFailureReasonZ_Some);
10982         uint32_t some_conv = LDKPaymentFailureReason_to_js(obj->some);
10983         return some_conv;
10984 }
10985 uint32_t __attribute__((export_name("TS_LDKBumpTransactionEvent_ty_from_ptr"))) TS_LDKBumpTransactionEvent_ty_from_ptr(uint64_t ptr) {
10986         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
10987         switch(obj->tag) {
10988                 case LDKBumpTransactionEvent_ChannelClose: return 0;
10989                 case LDKBumpTransactionEvent_HTLCResolution: return 1;
10990                 default: abort();
10991         }
10992 }
10993 uint64_t __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_channel_id"))) TS_LDKBumpTransactionEvent_ChannelClose_get_channel_id(uint64_t ptr) {
10994         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
10995         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
10996         LDKChannelId channel_id_var = obj->channel_close.channel_id;
10997                         uint64_t channel_id_ref = 0;
10998                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
10999                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
11000         return channel_id_ref;
11001 }
11002 int8_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_counterparty_node_id"))) TS_LDKBumpTransactionEvent_ChannelClose_get_counterparty_node_id(uint64_t ptr) {
11003         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11004         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
11005         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
11006         memcpy(counterparty_node_id_arr->elems, obj->channel_close.counterparty_node_id.compressed_form, 33);
11007         return counterparty_node_id_arr;
11008 }
11009 int8_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_claim_id"))) TS_LDKBumpTransactionEvent_ChannelClose_get_claim_id(uint64_t ptr) {
11010         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11011         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
11012         int8_tArray claim_id_arr = init_int8_tArray(32, __LINE__);
11013         memcpy(claim_id_arr->elems, obj->channel_close.claim_id.data, 32);
11014         return claim_id_arr;
11015 }
11016 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) {
11017         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11018         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
11019         int32_t package_target_feerate_sat_per_1000_weight_conv = obj->channel_close.package_target_feerate_sat_per_1000_weight;
11020         return package_target_feerate_sat_per_1000_weight_conv;
11021 }
11022 int8_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_commitment_tx"))) TS_LDKBumpTransactionEvent_ChannelClose_get_commitment_tx(uint64_t ptr) {
11023         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11024         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
11025         LDKTransaction commitment_tx_var = obj->channel_close.commitment_tx;
11026                         int8_tArray commitment_tx_arr = init_int8_tArray(commitment_tx_var.datalen, __LINE__);
11027                         memcpy(commitment_tx_arr->elems, commitment_tx_var.data, commitment_tx_var.datalen);
11028         return commitment_tx_arr;
11029 }
11030 int64_t __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_commitment_tx_fee_satoshis"))) TS_LDKBumpTransactionEvent_ChannelClose_get_commitment_tx_fee_satoshis(uint64_t ptr) {
11031         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11032         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
11033         int64_t commitment_tx_fee_satoshis_conv = obj->channel_close.commitment_tx_fee_satoshis;
11034         return commitment_tx_fee_satoshis_conv;
11035 }
11036 uint64_t __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_anchor_descriptor"))) TS_LDKBumpTransactionEvent_ChannelClose_get_anchor_descriptor(uint64_t ptr) {
11037         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11038         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
11039         LDKAnchorDescriptor anchor_descriptor_var = obj->channel_close.anchor_descriptor;
11040                         uint64_t anchor_descriptor_ref = 0;
11041                         CHECK_INNER_FIELD_ACCESS_OR_NULL(anchor_descriptor_var);
11042                         anchor_descriptor_ref = tag_ptr(anchor_descriptor_var.inner, false);
11043         return anchor_descriptor_ref;
11044 }
11045 uint64_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_pending_htlcs"))) TS_LDKBumpTransactionEvent_ChannelClose_get_pending_htlcs(uint64_t ptr) {
11046         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11047         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
11048         LDKCVec_HTLCOutputInCommitmentZ pending_htlcs_var = obj->channel_close.pending_htlcs;
11049                         uint64_tArray pending_htlcs_arr = NULL;
11050                         pending_htlcs_arr = init_uint64_tArray(pending_htlcs_var.datalen, __LINE__);
11051                         uint64_t *pending_htlcs_arr_ptr = (uint64_t*)(((uint8_t*)pending_htlcs_arr) + 8);
11052                         for (size_t y = 0; y < pending_htlcs_var.datalen; y++) {
11053                                 LDKHTLCOutputInCommitment pending_htlcs_conv_24_var = pending_htlcs_var.data[y];
11054                                 uint64_t pending_htlcs_conv_24_ref = 0;
11055                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_htlcs_conv_24_var);
11056                                 pending_htlcs_conv_24_ref = tag_ptr(pending_htlcs_conv_24_var.inner, false);
11057                                 pending_htlcs_arr_ptr[y] = pending_htlcs_conv_24_ref;
11058                         }
11059                         
11060         return pending_htlcs_arr;
11061 }
11062 uint64_t __attribute__((export_name("TS_LDKBumpTransactionEvent_HTLCResolution_get_channel_id"))) TS_LDKBumpTransactionEvent_HTLCResolution_get_channel_id(uint64_t ptr) {
11063         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11064         assert(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
11065         LDKChannelId channel_id_var = obj->htlc_resolution.channel_id;
11066                         uint64_t channel_id_ref = 0;
11067                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
11068                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
11069         return channel_id_ref;
11070 }
11071 int8_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_HTLCResolution_get_counterparty_node_id"))) TS_LDKBumpTransactionEvent_HTLCResolution_get_counterparty_node_id(uint64_t ptr) {
11072         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11073         assert(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
11074         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
11075         memcpy(counterparty_node_id_arr->elems, obj->htlc_resolution.counterparty_node_id.compressed_form, 33);
11076         return counterparty_node_id_arr;
11077 }
11078 int8_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_HTLCResolution_get_claim_id"))) TS_LDKBumpTransactionEvent_HTLCResolution_get_claim_id(uint64_t ptr) {
11079         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11080         assert(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
11081         int8_tArray claim_id_arr = init_int8_tArray(32, __LINE__);
11082         memcpy(claim_id_arr->elems, obj->htlc_resolution.claim_id.data, 32);
11083         return claim_id_arr;
11084 }
11085 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) {
11086         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11087         assert(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
11088         int32_t target_feerate_sat_per_1000_weight_conv = obj->htlc_resolution.target_feerate_sat_per_1000_weight;
11089         return target_feerate_sat_per_1000_weight_conv;
11090 }
11091 uint64_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_HTLCResolution_get_htlc_descriptors"))) TS_LDKBumpTransactionEvent_HTLCResolution_get_htlc_descriptors(uint64_t ptr) {
11092         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11093         assert(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
11094         LDKCVec_HTLCDescriptorZ htlc_descriptors_var = obj->htlc_resolution.htlc_descriptors;
11095                         uint64_tArray htlc_descriptors_arr = NULL;
11096                         htlc_descriptors_arr = init_uint64_tArray(htlc_descriptors_var.datalen, __LINE__);
11097                         uint64_t *htlc_descriptors_arr_ptr = (uint64_t*)(((uint8_t*)htlc_descriptors_arr) + 8);
11098                         for (size_t q = 0; q < htlc_descriptors_var.datalen; q++) {
11099                                 LDKHTLCDescriptor htlc_descriptors_conv_16_var = htlc_descriptors_var.data[q];
11100                                 uint64_t htlc_descriptors_conv_16_ref = 0;
11101                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptors_conv_16_var);
11102                                 htlc_descriptors_conv_16_ref = tag_ptr(htlc_descriptors_conv_16_var.inner, false);
11103                                 htlc_descriptors_arr_ptr[q] = htlc_descriptors_conv_16_ref;
11104                         }
11105                         
11106         return htlc_descriptors_arr;
11107 }
11108 int32_t __attribute__((export_name("TS_LDKBumpTransactionEvent_HTLCResolution_get_tx_lock_time"))) TS_LDKBumpTransactionEvent_HTLCResolution_get_tx_lock_time(uint64_t ptr) {
11109         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11110         assert(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
11111         int32_t tx_lock_time_conv = obj->htlc_resolution.tx_lock_time;
11112         return tx_lock_time_conv;
11113 }
11114 uint32_t __attribute__((export_name("TS_LDKEvent_ty_from_ptr"))) TS_LDKEvent_ty_from_ptr(uint64_t ptr) {
11115         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11116         switch(obj->tag) {
11117                 case LDKEvent_FundingGenerationReady: return 0;
11118                 case LDKEvent_PaymentClaimable: return 1;
11119                 case LDKEvent_PaymentClaimed: return 2;
11120                 case LDKEvent_ConnectionNeeded: return 3;
11121                 case LDKEvent_InvoiceRequestFailed: return 4;
11122                 case LDKEvent_PaymentSent: return 5;
11123                 case LDKEvent_PaymentFailed: return 6;
11124                 case LDKEvent_PaymentPathSuccessful: return 7;
11125                 case LDKEvent_PaymentPathFailed: return 8;
11126                 case LDKEvent_ProbeSuccessful: return 9;
11127                 case LDKEvent_ProbeFailed: return 10;
11128                 case LDKEvent_PendingHTLCsForwardable: return 11;
11129                 case LDKEvent_HTLCIntercepted: return 12;
11130                 case LDKEvent_SpendableOutputs: return 13;
11131                 case LDKEvent_PaymentForwarded: return 14;
11132                 case LDKEvent_ChannelPending: return 15;
11133                 case LDKEvent_ChannelReady: return 16;
11134                 case LDKEvent_ChannelClosed: return 17;
11135                 case LDKEvent_DiscardFunding: return 18;
11136                 case LDKEvent_OpenChannelRequest: return 19;
11137                 case LDKEvent_HTLCHandlingFailed: return 20;
11138                 case LDKEvent_BumpTransaction: return 21;
11139                 default: abort();
11140         }
11141 }
11142 uint64_t __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id(uint64_t ptr) {
11143         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11144         assert(obj->tag == LDKEvent_FundingGenerationReady);
11145         LDKChannelId temporary_channel_id_var = obj->funding_generation_ready.temporary_channel_id;
11146                         uint64_t temporary_channel_id_ref = 0;
11147                         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_var);
11148                         temporary_channel_id_ref = tag_ptr(temporary_channel_id_var.inner, false);
11149         return temporary_channel_id_ref;
11150 }
11151 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id"))) TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id(uint64_t ptr) {
11152         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11153         assert(obj->tag == LDKEvent_FundingGenerationReady);
11154         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
11155         memcpy(counterparty_node_id_arr->elems, obj->funding_generation_ready.counterparty_node_id.compressed_form, 33);
11156         return counterparty_node_id_arr;
11157 }
11158 int64_t __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis"))) TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis(uint64_t ptr) {
11159         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11160         assert(obj->tag == LDKEvent_FundingGenerationReady);
11161         int64_t channel_value_satoshis_conv = obj->funding_generation_ready.channel_value_satoshis;
11162         return channel_value_satoshis_conv;
11163 }
11164 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_output_script"))) TS_LDKEvent_FundingGenerationReady_get_output_script(uint64_t ptr) {
11165         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11166         assert(obj->tag == LDKEvent_FundingGenerationReady);
11167         LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
11168                         int8_tArray output_script_arr = init_int8_tArray(output_script_var.datalen, __LINE__);
11169                         memcpy(output_script_arr->elems, output_script_var.data, output_script_var.datalen);
11170         return output_script_arr;
11171 }
11172 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_user_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_user_channel_id(uint64_t ptr) {
11173         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11174         assert(obj->tag == LDKEvent_FundingGenerationReady);
11175         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
11176         memcpy(user_channel_id_arr->elems, obj->funding_generation_ready.user_channel_id.le_bytes, 16);
11177         return user_channel_id_arr;
11178 }
11179 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_receiver_node_id"))) TS_LDKEvent_PaymentClaimable_get_receiver_node_id(uint64_t ptr) {
11180         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11181         assert(obj->tag == LDKEvent_PaymentClaimable);
11182         int8_tArray receiver_node_id_arr = init_int8_tArray(33, __LINE__);
11183         memcpy(receiver_node_id_arr->elems, obj->payment_claimable.receiver_node_id.compressed_form, 33);
11184         return receiver_node_id_arr;
11185 }
11186 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_payment_hash"))) TS_LDKEvent_PaymentClaimable_get_payment_hash(uint64_t ptr) {
11187         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11188         assert(obj->tag == LDKEvent_PaymentClaimable);
11189         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
11190         memcpy(payment_hash_arr->elems, obj->payment_claimable.payment_hash.data, 32);
11191         return payment_hash_arr;
11192 }
11193 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_onion_fields"))) TS_LDKEvent_PaymentClaimable_get_onion_fields(uint64_t ptr) {
11194         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11195         assert(obj->tag == LDKEvent_PaymentClaimable);
11196         LDKRecipientOnionFields onion_fields_var = obj->payment_claimable.onion_fields;
11197                         uint64_t onion_fields_ref = 0;
11198                         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_var);
11199                         onion_fields_ref = tag_ptr(onion_fields_var.inner, false);
11200         return onion_fields_ref;
11201 }
11202 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_amount_msat"))) TS_LDKEvent_PaymentClaimable_get_amount_msat(uint64_t ptr) {
11203         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11204         assert(obj->tag == LDKEvent_PaymentClaimable);
11205         int64_t amount_msat_conv = obj->payment_claimable.amount_msat;
11206         return amount_msat_conv;
11207 }
11208 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_counterparty_skimmed_fee_msat"))) TS_LDKEvent_PaymentClaimable_get_counterparty_skimmed_fee_msat(uint64_t ptr) {
11209         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11210         assert(obj->tag == LDKEvent_PaymentClaimable);
11211         int64_t counterparty_skimmed_fee_msat_conv = obj->payment_claimable.counterparty_skimmed_fee_msat;
11212         return counterparty_skimmed_fee_msat_conv;
11213 }
11214 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_purpose"))) TS_LDKEvent_PaymentClaimable_get_purpose(uint64_t ptr) {
11215         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11216         assert(obj->tag == LDKEvent_PaymentClaimable);
11217         uint64_t purpose_ref = tag_ptr(&obj->payment_claimable.purpose, false);
11218         return purpose_ref;
11219 }
11220 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_via_channel_id"))) TS_LDKEvent_PaymentClaimable_get_via_channel_id(uint64_t ptr) {
11221         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11222         assert(obj->tag == LDKEvent_PaymentClaimable);
11223         LDKChannelId via_channel_id_var = obj->payment_claimable.via_channel_id;
11224                         uint64_t via_channel_id_ref = 0;
11225                         CHECK_INNER_FIELD_ACCESS_OR_NULL(via_channel_id_var);
11226                         via_channel_id_ref = tag_ptr(via_channel_id_var.inner, false);
11227         return via_channel_id_ref;
11228 }
11229 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_via_user_channel_id"))) TS_LDKEvent_PaymentClaimable_get_via_user_channel_id(uint64_t ptr) {
11230         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11231         assert(obj->tag == LDKEvent_PaymentClaimable);
11232         uint64_t via_user_channel_id_ref = tag_ptr(&obj->payment_claimable.via_user_channel_id, false);
11233         return via_user_channel_id_ref;
11234 }
11235 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_claim_deadline"))) TS_LDKEvent_PaymentClaimable_get_claim_deadline(uint64_t ptr) {
11236         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11237         assert(obj->tag == LDKEvent_PaymentClaimable);
11238         uint64_t claim_deadline_ref = tag_ptr(&obj->payment_claimable.claim_deadline, false);
11239         return claim_deadline_ref;
11240 }
11241 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_receiver_node_id"))) TS_LDKEvent_PaymentClaimed_get_receiver_node_id(uint64_t ptr) {
11242         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11243         assert(obj->tag == LDKEvent_PaymentClaimed);
11244         int8_tArray receiver_node_id_arr = init_int8_tArray(33, __LINE__);
11245         memcpy(receiver_node_id_arr->elems, obj->payment_claimed.receiver_node_id.compressed_form, 33);
11246         return receiver_node_id_arr;
11247 }
11248 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_payment_hash"))) TS_LDKEvent_PaymentClaimed_get_payment_hash(uint64_t ptr) {
11249         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11250         assert(obj->tag == LDKEvent_PaymentClaimed);
11251         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
11252         memcpy(payment_hash_arr->elems, obj->payment_claimed.payment_hash.data, 32);
11253         return payment_hash_arr;
11254 }
11255 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_amount_msat"))) TS_LDKEvent_PaymentClaimed_get_amount_msat(uint64_t ptr) {
11256         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11257         assert(obj->tag == LDKEvent_PaymentClaimed);
11258         int64_t amount_msat_conv = obj->payment_claimed.amount_msat;
11259         return amount_msat_conv;
11260 }
11261 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_purpose"))) TS_LDKEvent_PaymentClaimed_get_purpose(uint64_t ptr) {
11262         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11263         assert(obj->tag == LDKEvent_PaymentClaimed);
11264         uint64_t purpose_ref = tag_ptr(&obj->payment_claimed.purpose, false);
11265         return purpose_ref;
11266 }
11267 uint64_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_htlcs"))) TS_LDKEvent_PaymentClaimed_get_htlcs(uint64_t ptr) {
11268         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11269         assert(obj->tag == LDKEvent_PaymentClaimed);
11270         LDKCVec_ClaimedHTLCZ htlcs_var = obj->payment_claimed.htlcs;
11271                         uint64_tArray htlcs_arr = NULL;
11272                         htlcs_arr = init_uint64_tArray(htlcs_var.datalen, __LINE__);
11273                         uint64_t *htlcs_arr_ptr = (uint64_t*)(((uint8_t*)htlcs_arr) + 8);
11274                         for (size_t n = 0; n < htlcs_var.datalen; n++) {
11275                                 LDKClaimedHTLC htlcs_conv_13_var = htlcs_var.data[n];
11276                                 uint64_t htlcs_conv_13_ref = 0;
11277                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlcs_conv_13_var);
11278                                 htlcs_conv_13_ref = tag_ptr(htlcs_conv_13_var.inner, false);
11279                                 htlcs_arr_ptr[n] = htlcs_conv_13_ref;
11280                         }
11281                         
11282         return htlcs_arr;
11283 }
11284 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_sender_intended_total_msat"))) TS_LDKEvent_PaymentClaimed_get_sender_intended_total_msat(uint64_t ptr) {
11285         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11286         assert(obj->tag == LDKEvent_PaymentClaimed);
11287         uint64_t sender_intended_total_msat_ref = tag_ptr(&obj->payment_claimed.sender_intended_total_msat, false);
11288         return sender_intended_total_msat_ref;
11289 }
11290 int8_tArray __attribute__((export_name("TS_LDKEvent_ConnectionNeeded_get_node_id"))) TS_LDKEvent_ConnectionNeeded_get_node_id(uint64_t ptr) {
11291         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11292         assert(obj->tag == LDKEvent_ConnectionNeeded);
11293         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
11294         memcpy(node_id_arr->elems, obj->connection_needed.node_id.compressed_form, 33);
11295         return node_id_arr;
11296 }
11297 uint64_tArray __attribute__((export_name("TS_LDKEvent_ConnectionNeeded_get_addresses"))) TS_LDKEvent_ConnectionNeeded_get_addresses(uint64_t ptr) {
11298         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11299         assert(obj->tag == LDKEvent_ConnectionNeeded);
11300         LDKCVec_SocketAddressZ addresses_var = obj->connection_needed.addresses;
11301                         uint64_tArray addresses_arr = NULL;
11302                         addresses_arr = init_uint64_tArray(addresses_var.datalen, __LINE__);
11303                         uint64_t *addresses_arr_ptr = (uint64_t*)(((uint8_t*)addresses_arr) + 8);
11304                         for (size_t p = 0; p < addresses_var.datalen; p++) {
11305                                 uint64_t addresses_conv_15_ref = tag_ptr(&addresses_var.data[p], false);
11306                                 addresses_arr_ptr[p] = addresses_conv_15_ref;
11307                         }
11308                         
11309         return addresses_arr;
11310 }
11311 int8_tArray __attribute__((export_name("TS_LDKEvent_InvoiceRequestFailed_get_payment_id"))) TS_LDKEvent_InvoiceRequestFailed_get_payment_id(uint64_t ptr) {
11312         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11313         assert(obj->tag == LDKEvent_InvoiceRequestFailed);
11314         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
11315         memcpy(payment_id_arr->elems, obj->invoice_request_failed.payment_id.data, 32);
11316         return payment_id_arr;
11317 }
11318 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_id"))) TS_LDKEvent_PaymentSent_get_payment_id(uint64_t ptr) {
11319         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11320         assert(obj->tag == LDKEvent_PaymentSent);
11321         uint64_t payment_id_ref = tag_ptr(&obj->payment_sent.payment_id, false);
11322         return payment_id_ref;
11323 }
11324 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_preimage"))) TS_LDKEvent_PaymentSent_get_payment_preimage(uint64_t ptr) {
11325         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11326         assert(obj->tag == LDKEvent_PaymentSent);
11327         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
11328         memcpy(payment_preimage_arr->elems, obj->payment_sent.payment_preimage.data, 32);
11329         return payment_preimage_arr;
11330 }
11331 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_hash"))) TS_LDKEvent_PaymentSent_get_payment_hash(uint64_t ptr) {
11332         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11333         assert(obj->tag == LDKEvent_PaymentSent);
11334         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
11335         memcpy(payment_hash_arr->elems, obj->payment_sent.payment_hash.data, 32);
11336         return payment_hash_arr;
11337 }
11338 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentSent_get_fee_paid_msat"))) TS_LDKEvent_PaymentSent_get_fee_paid_msat(uint64_t ptr) {
11339         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11340         assert(obj->tag == LDKEvent_PaymentSent);
11341         uint64_t fee_paid_msat_ref = tag_ptr(&obj->payment_sent.fee_paid_msat, false);
11342         return fee_paid_msat_ref;
11343 }
11344 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_id"))) TS_LDKEvent_PaymentFailed_get_payment_id(uint64_t ptr) {
11345         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11346         assert(obj->tag == LDKEvent_PaymentFailed);
11347         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
11348         memcpy(payment_id_arr->elems, obj->payment_failed.payment_id.data, 32);
11349         return payment_id_arr;
11350 }
11351 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_hash"))) TS_LDKEvent_PaymentFailed_get_payment_hash(uint64_t ptr) {
11352         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11353         assert(obj->tag == LDKEvent_PaymentFailed);
11354         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
11355         memcpy(payment_hash_arr->elems, obj->payment_failed.payment_hash.data, 32);
11356         return payment_hash_arr;
11357 }
11358 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_reason"))) TS_LDKEvent_PaymentFailed_get_reason(uint64_t ptr) {
11359         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11360         assert(obj->tag == LDKEvent_PaymentFailed);
11361         uint64_t reason_ref = tag_ptr(&obj->payment_failed.reason, false);
11362         return reason_ref;
11363 }
11364 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_id"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_id(uint64_t ptr) {
11365         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11366         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
11367         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
11368         memcpy(payment_id_arr->elems, obj->payment_path_successful.payment_id.data, 32);
11369         return payment_id_arr;
11370 }
11371 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_hash"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_hash(uint64_t ptr) {
11372         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11373         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
11374         uint64_t payment_hash_ref = tag_ptr(&obj->payment_path_successful.payment_hash, false);
11375         return payment_hash_ref;
11376 }
11377 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_path"))) TS_LDKEvent_PaymentPathSuccessful_get_path(uint64_t ptr) {
11378         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11379         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
11380         LDKPath path_var = obj->payment_path_successful.path;
11381                         uint64_t path_ref = 0;
11382                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
11383                         path_ref = tag_ptr(path_var.inner, false);
11384         return path_ref;
11385 }
11386 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_id"))) TS_LDKEvent_PaymentPathFailed_get_payment_id(uint64_t ptr) {
11387         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11388         assert(obj->tag == LDKEvent_PaymentPathFailed);
11389         uint64_t payment_id_ref = tag_ptr(&obj->payment_path_failed.payment_id, false);
11390         return payment_id_ref;
11391 }
11392 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_hash"))) TS_LDKEvent_PaymentPathFailed_get_payment_hash(uint64_t ptr) {
11393         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11394         assert(obj->tag == LDKEvent_PaymentPathFailed);
11395         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
11396         memcpy(payment_hash_arr->elems, obj->payment_path_failed.payment_hash.data, 32);
11397         return payment_hash_arr;
11398 }
11399 jboolean __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_failed_permanently"))) TS_LDKEvent_PaymentPathFailed_get_payment_failed_permanently(uint64_t ptr) {
11400         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11401         assert(obj->tag == LDKEvent_PaymentPathFailed);
11402         jboolean payment_failed_permanently_conv = obj->payment_path_failed.payment_failed_permanently;
11403         return payment_failed_permanently_conv;
11404 }
11405 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_failure"))) TS_LDKEvent_PaymentPathFailed_get_failure(uint64_t ptr) {
11406         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11407         assert(obj->tag == LDKEvent_PaymentPathFailed);
11408         uint64_t failure_ref = tag_ptr(&obj->payment_path_failed.failure, false);
11409         return failure_ref;
11410 }
11411 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_path"))) TS_LDKEvent_PaymentPathFailed_get_path(uint64_t ptr) {
11412         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11413         assert(obj->tag == LDKEvent_PaymentPathFailed);
11414         LDKPath path_var = obj->payment_path_failed.path;
11415                         uint64_t path_ref = 0;
11416                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
11417                         path_ref = tag_ptr(path_var.inner, false);
11418         return path_ref;
11419 }
11420 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_short_channel_id"))) TS_LDKEvent_PaymentPathFailed_get_short_channel_id(uint64_t ptr) {
11421         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11422         assert(obj->tag == LDKEvent_PaymentPathFailed);
11423         uint64_t short_channel_id_ref = tag_ptr(&obj->payment_path_failed.short_channel_id, false);
11424         return short_channel_id_ref;
11425 }
11426 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_payment_id"))) TS_LDKEvent_ProbeSuccessful_get_payment_id(uint64_t ptr) {
11427         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11428         assert(obj->tag == LDKEvent_ProbeSuccessful);
11429         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
11430         memcpy(payment_id_arr->elems, obj->probe_successful.payment_id.data, 32);
11431         return payment_id_arr;
11432 }
11433 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_payment_hash"))) TS_LDKEvent_ProbeSuccessful_get_payment_hash(uint64_t ptr) {
11434         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11435         assert(obj->tag == LDKEvent_ProbeSuccessful);
11436         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
11437         memcpy(payment_hash_arr->elems, obj->probe_successful.payment_hash.data, 32);
11438         return payment_hash_arr;
11439 }
11440 uint64_t __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_path"))) TS_LDKEvent_ProbeSuccessful_get_path(uint64_t ptr) {
11441         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11442         assert(obj->tag == LDKEvent_ProbeSuccessful);
11443         LDKPath path_var = obj->probe_successful.path;
11444                         uint64_t path_ref = 0;
11445                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
11446                         path_ref = tag_ptr(path_var.inner, false);
11447         return path_ref;
11448 }
11449 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_payment_id"))) TS_LDKEvent_ProbeFailed_get_payment_id(uint64_t ptr) {
11450         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11451         assert(obj->tag == LDKEvent_ProbeFailed);
11452         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
11453         memcpy(payment_id_arr->elems, obj->probe_failed.payment_id.data, 32);
11454         return payment_id_arr;
11455 }
11456 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_payment_hash"))) TS_LDKEvent_ProbeFailed_get_payment_hash(uint64_t ptr) {
11457         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11458         assert(obj->tag == LDKEvent_ProbeFailed);
11459         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
11460         memcpy(payment_hash_arr->elems, obj->probe_failed.payment_hash.data, 32);
11461         return payment_hash_arr;
11462 }
11463 uint64_t __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_path"))) TS_LDKEvent_ProbeFailed_get_path(uint64_t ptr) {
11464         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11465         assert(obj->tag == LDKEvent_ProbeFailed);
11466         LDKPath path_var = obj->probe_failed.path;
11467                         uint64_t path_ref = 0;
11468                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
11469                         path_ref = tag_ptr(path_var.inner, false);
11470         return path_ref;
11471 }
11472 uint64_t __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_short_channel_id"))) TS_LDKEvent_ProbeFailed_get_short_channel_id(uint64_t ptr) {
11473         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11474         assert(obj->tag == LDKEvent_ProbeFailed);
11475         uint64_t short_channel_id_ref = tag_ptr(&obj->probe_failed.short_channel_id, false);
11476         return short_channel_id_ref;
11477 }
11478 int64_t __attribute__((export_name("TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable"))) TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable(uint64_t ptr) {
11479         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11480         assert(obj->tag == LDKEvent_PendingHTLCsForwardable);
11481         int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable;
11482         return time_forwardable_conv;
11483 }
11484 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_intercept_id"))) TS_LDKEvent_HTLCIntercepted_get_intercept_id(uint64_t ptr) {
11485         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11486         assert(obj->tag == LDKEvent_HTLCIntercepted);
11487         int8_tArray intercept_id_arr = init_int8_tArray(32, __LINE__);
11488         memcpy(intercept_id_arr->elems, obj->htlc_intercepted.intercept_id.data, 32);
11489         return intercept_id_arr;
11490 }
11491 int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_requested_next_hop_scid"))) TS_LDKEvent_HTLCIntercepted_get_requested_next_hop_scid(uint64_t ptr) {
11492         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11493         assert(obj->tag == LDKEvent_HTLCIntercepted);
11494         int64_t requested_next_hop_scid_conv = obj->htlc_intercepted.requested_next_hop_scid;
11495         return requested_next_hop_scid_conv;
11496 }
11497 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_payment_hash"))) TS_LDKEvent_HTLCIntercepted_get_payment_hash(uint64_t ptr) {
11498         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11499         assert(obj->tag == LDKEvent_HTLCIntercepted);
11500         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
11501         memcpy(payment_hash_arr->elems, obj->htlc_intercepted.payment_hash.data, 32);
11502         return payment_hash_arr;
11503 }
11504 int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_inbound_amount_msat"))) TS_LDKEvent_HTLCIntercepted_get_inbound_amount_msat(uint64_t ptr) {
11505         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11506         assert(obj->tag == LDKEvent_HTLCIntercepted);
11507         int64_t inbound_amount_msat_conv = obj->htlc_intercepted.inbound_amount_msat;
11508         return inbound_amount_msat_conv;
11509 }
11510 int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_expected_outbound_amount_msat"))) TS_LDKEvent_HTLCIntercepted_get_expected_outbound_amount_msat(uint64_t ptr) {
11511         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11512         assert(obj->tag == LDKEvent_HTLCIntercepted);
11513         int64_t expected_outbound_amount_msat_conv = obj->htlc_intercepted.expected_outbound_amount_msat;
11514         return expected_outbound_amount_msat_conv;
11515 }
11516 uint64_tArray __attribute__((export_name("TS_LDKEvent_SpendableOutputs_get_outputs"))) TS_LDKEvent_SpendableOutputs_get_outputs(uint64_t ptr) {
11517         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11518         assert(obj->tag == LDKEvent_SpendableOutputs);
11519         LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
11520                         uint64_tArray outputs_arr = NULL;
11521                         outputs_arr = init_uint64_tArray(outputs_var.datalen, __LINE__);
11522                         uint64_t *outputs_arr_ptr = (uint64_t*)(((uint8_t*)outputs_arr) + 8);
11523                         for (size_t b = 0; b < outputs_var.datalen; b++) {
11524                                 uint64_t outputs_conv_27_ref = tag_ptr(&outputs_var.data[b], false);
11525                                 outputs_arr_ptr[b] = outputs_conv_27_ref;
11526                         }
11527                         
11528         return outputs_arr;
11529 }
11530 uint64_t __attribute__((export_name("TS_LDKEvent_SpendableOutputs_get_channel_id"))) TS_LDKEvent_SpendableOutputs_get_channel_id(uint64_t ptr) {
11531         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11532         assert(obj->tag == LDKEvent_SpendableOutputs);
11533         LDKChannelId channel_id_var = obj->spendable_outputs.channel_id;
11534                         uint64_t channel_id_ref = 0;
11535                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
11536                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
11537         return channel_id_ref;
11538 }
11539 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_prev_channel_id"))) TS_LDKEvent_PaymentForwarded_get_prev_channel_id(uint64_t ptr) {
11540         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11541         assert(obj->tag == LDKEvent_PaymentForwarded);
11542         LDKChannelId prev_channel_id_var = obj->payment_forwarded.prev_channel_id;
11543                         uint64_t prev_channel_id_ref = 0;
11544                         CHECK_INNER_FIELD_ACCESS_OR_NULL(prev_channel_id_var);
11545                         prev_channel_id_ref = tag_ptr(prev_channel_id_var.inner, false);
11546         return prev_channel_id_ref;
11547 }
11548 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_next_channel_id"))) TS_LDKEvent_PaymentForwarded_get_next_channel_id(uint64_t ptr) {
11549         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11550         assert(obj->tag == LDKEvent_PaymentForwarded);
11551         LDKChannelId next_channel_id_var = obj->payment_forwarded.next_channel_id;
11552                         uint64_t next_channel_id_ref = 0;
11553                         CHECK_INNER_FIELD_ACCESS_OR_NULL(next_channel_id_var);
11554                         next_channel_id_ref = tag_ptr(next_channel_id_var.inner, false);
11555         return next_channel_id_ref;
11556 }
11557 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_prev_user_channel_id"))) TS_LDKEvent_PaymentForwarded_get_prev_user_channel_id(uint64_t ptr) {
11558         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11559         assert(obj->tag == LDKEvent_PaymentForwarded);
11560         uint64_t prev_user_channel_id_ref = tag_ptr(&obj->payment_forwarded.prev_user_channel_id, false);
11561         return prev_user_channel_id_ref;
11562 }
11563 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_next_user_channel_id"))) TS_LDKEvent_PaymentForwarded_get_next_user_channel_id(uint64_t ptr) {
11564         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11565         assert(obj->tag == LDKEvent_PaymentForwarded);
11566         uint64_t next_user_channel_id_ref = tag_ptr(&obj->payment_forwarded.next_user_channel_id, false);
11567         return next_user_channel_id_ref;
11568 }
11569 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_total_fee_earned_msat"))) TS_LDKEvent_PaymentForwarded_get_total_fee_earned_msat(uint64_t ptr) {
11570         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11571         assert(obj->tag == LDKEvent_PaymentForwarded);
11572         uint64_t total_fee_earned_msat_ref = tag_ptr(&obj->payment_forwarded.total_fee_earned_msat, false);
11573         return total_fee_earned_msat_ref;
11574 }
11575 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_skimmed_fee_msat"))) TS_LDKEvent_PaymentForwarded_get_skimmed_fee_msat(uint64_t ptr) {
11576         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11577         assert(obj->tag == LDKEvent_PaymentForwarded);
11578         uint64_t skimmed_fee_msat_ref = tag_ptr(&obj->payment_forwarded.skimmed_fee_msat, false);
11579         return skimmed_fee_msat_ref;
11580 }
11581 jboolean __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx"))) TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx(uint64_t ptr) {
11582         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11583         assert(obj->tag == LDKEvent_PaymentForwarded);
11584         jboolean claim_from_onchain_tx_conv = obj->payment_forwarded.claim_from_onchain_tx;
11585         return claim_from_onchain_tx_conv;
11586 }
11587 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_outbound_amount_forwarded_msat"))) TS_LDKEvent_PaymentForwarded_get_outbound_amount_forwarded_msat(uint64_t ptr) {
11588         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11589         assert(obj->tag == LDKEvent_PaymentForwarded);
11590         uint64_t outbound_amount_forwarded_msat_ref = tag_ptr(&obj->payment_forwarded.outbound_amount_forwarded_msat, false);
11591         return outbound_amount_forwarded_msat_ref;
11592 }
11593 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelPending_get_channel_id"))) TS_LDKEvent_ChannelPending_get_channel_id(uint64_t ptr) {
11594         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11595         assert(obj->tag == LDKEvent_ChannelPending);
11596         LDKChannelId channel_id_var = obj->channel_pending.channel_id;
11597                         uint64_t channel_id_ref = 0;
11598                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
11599                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
11600         return channel_id_ref;
11601 }
11602 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelPending_get_user_channel_id"))) TS_LDKEvent_ChannelPending_get_user_channel_id(uint64_t ptr) {
11603         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11604         assert(obj->tag == LDKEvent_ChannelPending);
11605         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
11606         memcpy(user_channel_id_arr->elems, obj->channel_pending.user_channel_id.le_bytes, 16);
11607         return user_channel_id_arr;
11608 }
11609 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelPending_get_former_temporary_channel_id"))) TS_LDKEvent_ChannelPending_get_former_temporary_channel_id(uint64_t ptr) {
11610         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11611         assert(obj->tag == LDKEvent_ChannelPending);
11612         LDKChannelId former_temporary_channel_id_var = obj->channel_pending.former_temporary_channel_id;
11613                         uint64_t former_temporary_channel_id_ref = 0;
11614                         CHECK_INNER_FIELD_ACCESS_OR_NULL(former_temporary_channel_id_var);
11615                         former_temporary_channel_id_ref = tag_ptr(former_temporary_channel_id_var.inner, false);
11616         return former_temporary_channel_id_ref;
11617 }
11618 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelPending_get_counterparty_node_id"))) TS_LDKEvent_ChannelPending_get_counterparty_node_id(uint64_t ptr) {
11619         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11620         assert(obj->tag == LDKEvent_ChannelPending);
11621         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
11622         memcpy(counterparty_node_id_arr->elems, obj->channel_pending.counterparty_node_id.compressed_form, 33);
11623         return counterparty_node_id_arr;
11624 }
11625 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelPending_get_funding_txo"))) TS_LDKEvent_ChannelPending_get_funding_txo(uint64_t ptr) {
11626         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11627         assert(obj->tag == LDKEvent_ChannelPending);
11628         LDKOutPoint funding_txo_var = obj->channel_pending.funding_txo;
11629                         uint64_t funding_txo_ref = 0;
11630                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
11631                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
11632         return funding_txo_ref;
11633 }
11634 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelPending_get_channel_type"))) TS_LDKEvent_ChannelPending_get_channel_type(uint64_t ptr) {
11635         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11636         assert(obj->tag == LDKEvent_ChannelPending);
11637         LDKChannelTypeFeatures channel_type_var = obj->channel_pending.channel_type;
11638                         uint64_t channel_type_ref = 0;
11639                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
11640                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
11641         return channel_type_ref;
11642 }
11643 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelReady_get_channel_id"))) TS_LDKEvent_ChannelReady_get_channel_id(uint64_t ptr) {
11644         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11645         assert(obj->tag == LDKEvent_ChannelReady);
11646         LDKChannelId channel_id_var = obj->channel_ready.channel_id;
11647                         uint64_t channel_id_ref = 0;
11648                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
11649                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
11650         return channel_id_ref;
11651 }
11652 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelReady_get_user_channel_id"))) TS_LDKEvent_ChannelReady_get_user_channel_id(uint64_t ptr) {
11653         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11654         assert(obj->tag == LDKEvent_ChannelReady);
11655         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
11656         memcpy(user_channel_id_arr->elems, obj->channel_ready.user_channel_id.le_bytes, 16);
11657         return user_channel_id_arr;
11658 }
11659 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelReady_get_counterparty_node_id"))) TS_LDKEvent_ChannelReady_get_counterparty_node_id(uint64_t ptr) {
11660         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11661         assert(obj->tag == LDKEvent_ChannelReady);
11662         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
11663         memcpy(counterparty_node_id_arr->elems, obj->channel_ready.counterparty_node_id.compressed_form, 33);
11664         return counterparty_node_id_arr;
11665 }
11666 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelReady_get_channel_type"))) TS_LDKEvent_ChannelReady_get_channel_type(uint64_t ptr) {
11667         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11668         assert(obj->tag == LDKEvent_ChannelReady);
11669         LDKChannelTypeFeatures channel_type_var = obj->channel_ready.channel_type;
11670                         uint64_t channel_type_ref = 0;
11671                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
11672                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
11673         return channel_type_ref;
11674 }
11675 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_channel_id"))) TS_LDKEvent_ChannelClosed_get_channel_id(uint64_t ptr) {
11676         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11677         assert(obj->tag == LDKEvent_ChannelClosed);
11678         LDKChannelId channel_id_var = obj->channel_closed.channel_id;
11679                         uint64_t channel_id_ref = 0;
11680                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
11681                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
11682         return channel_id_ref;
11683 }
11684 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_user_channel_id"))) TS_LDKEvent_ChannelClosed_get_user_channel_id(uint64_t ptr) {
11685         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11686         assert(obj->tag == LDKEvent_ChannelClosed);
11687         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
11688         memcpy(user_channel_id_arr->elems, obj->channel_closed.user_channel_id.le_bytes, 16);
11689         return user_channel_id_arr;
11690 }
11691 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_reason"))) TS_LDKEvent_ChannelClosed_get_reason(uint64_t ptr) {
11692         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11693         assert(obj->tag == LDKEvent_ChannelClosed);
11694         uint64_t reason_ref = tag_ptr(&obj->channel_closed.reason, false);
11695         return reason_ref;
11696 }
11697 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_counterparty_node_id"))) TS_LDKEvent_ChannelClosed_get_counterparty_node_id(uint64_t ptr) {
11698         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11699         assert(obj->tag == LDKEvent_ChannelClosed);
11700         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
11701         memcpy(counterparty_node_id_arr->elems, obj->channel_closed.counterparty_node_id.compressed_form, 33);
11702         return counterparty_node_id_arr;
11703 }
11704 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_channel_capacity_sats"))) TS_LDKEvent_ChannelClosed_get_channel_capacity_sats(uint64_t ptr) {
11705         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11706         assert(obj->tag == LDKEvent_ChannelClosed);
11707         uint64_t channel_capacity_sats_ref = tag_ptr(&obj->channel_closed.channel_capacity_sats, false);
11708         return channel_capacity_sats_ref;
11709 }
11710 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_channel_funding_txo"))) TS_LDKEvent_ChannelClosed_get_channel_funding_txo(uint64_t ptr) {
11711         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11712         assert(obj->tag == LDKEvent_ChannelClosed);
11713         LDKOutPoint channel_funding_txo_var = obj->channel_closed.channel_funding_txo;
11714                         uint64_t channel_funding_txo_ref = 0;
11715                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_txo_var);
11716                         channel_funding_txo_ref = tag_ptr(channel_funding_txo_var.inner, false);
11717         return channel_funding_txo_ref;
11718 }
11719 uint64_t __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_channel_id"))) TS_LDKEvent_DiscardFunding_get_channel_id(uint64_t ptr) {
11720         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11721         assert(obj->tag == LDKEvent_DiscardFunding);
11722         LDKChannelId channel_id_var = obj->discard_funding.channel_id;
11723                         uint64_t channel_id_ref = 0;
11724                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
11725                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
11726         return channel_id_ref;
11727 }
11728 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_transaction"))) TS_LDKEvent_DiscardFunding_get_transaction(uint64_t ptr) {
11729         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11730         assert(obj->tag == LDKEvent_DiscardFunding);
11731         LDKTransaction transaction_var = obj->discard_funding.transaction;
11732                         int8_tArray transaction_arr = init_int8_tArray(transaction_var.datalen, __LINE__);
11733                         memcpy(transaction_arr->elems, transaction_var.data, transaction_var.datalen);
11734         return transaction_arr;
11735 }
11736 uint64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id"))) TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id(uint64_t ptr) {
11737         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11738         assert(obj->tag == LDKEvent_OpenChannelRequest);
11739         LDKChannelId temporary_channel_id_var = obj->open_channel_request.temporary_channel_id;
11740                         uint64_t temporary_channel_id_ref = 0;
11741                         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_var);
11742                         temporary_channel_id_ref = tag_ptr(temporary_channel_id_var.inner, false);
11743         return temporary_channel_id_ref;
11744 }
11745 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id"))) TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id(uint64_t ptr) {
11746         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11747         assert(obj->tag == LDKEvent_OpenChannelRequest);
11748         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
11749         memcpy(counterparty_node_id_arr->elems, obj->open_channel_request.counterparty_node_id.compressed_form, 33);
11750         return counterparty_node_id_arr;
11751 }
11752 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_funding_satoshis"))) TS_LDKEvent_OpenChannelRequest_get_funding_satoshis(uint64_t ptr) {
11753         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11754         assert(obj->tag == LDKEvent_OpenChannelRequest);
11755         int64_t funding_satoshis_conv = obj->open_channel_request.funding_satoshis;
11756         return funding_satoshis_conv;
11757 }
11758 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_push_msat"))) TS_LDKEvent_OpenChannelRequest_get_push_msat(uint64_t ptr) {
11759         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11760         assert(obj->tag == LDKEvent_OpenChannelRequest);
11761         int64_t push_msat_conv = obj->open_channel_request.push_msat;
11762         return push_msat_conv;
11763 }
11764 uint64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_channel_type"))) TS_LDKEvent_OpenChannelRequest_get_channel_type(uint64_t ptr) {
11765         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11766         assert(obj->tag == LDKEvent_OpenChannelRequest);
11767         LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type;
11768                         uint64_t channel_type_ref = 0;
11769                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
11770                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
11771         return channel_type_ref;
11772 }
11773 uint64_t __attribute__((export_name("TS_LDKEvent_HTLCHandlingFailed_get_prev_channel_id"))) TS_LDKEvent_HTLCHandlingFailed_get_prev_channel_id(uint64_t ptr) {
11774         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11775         assert(obj->tag == LDKEvent_HTLCHandlingFailed);
11776         LDKChannelId prev_channel_id_var = obj->htlc_handling_failed.prev_channel_id;
11777                         uint64_t prev_channel_id_ref = 0;
11778                         CHECK_INNER_FIELD_ACCESS_OR_NULL(prev_channel_id_var);
11779                         prev_channel_id_ref = tag_ptr(prev_channel_id_var.inner, false);
11780         return prev_channel_id_ref;
11781 }
11782 uint64_t __attribute__((export_name("TS_LDKEvent_HTLCHandlingFailed_get_failed_next_destination"))) TS_LDKEvent_HTLCHandlingFailed_get_failed_next_destination(uint64_t ptr) {
11783         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11784         assert(obj->tag == LDKEvent_HTLCHandlingFailed);
11785         uint64_t failed_next_destination_ref = tag_ptr(&obj->htlc_handling_failed.failed_next_destination, false);
11786         return failed_next_destination_ref;
11787 }
11788 uint64_t __attribute__((export_name("TS_LDKEvent_BumpTransaction_get_bump_transaction"))) TS_LDKEvent_BumpTransaction_get_bump_transaction(uint64_t ptr) {
11789         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11790         assert(obj->tag == LDKEvent_BumpTransaction);
11791         uint64_t bump_transaction_ref = tag_ptr(&obj->bump_transaction, false);
11792         return bump_transaction_ref;
11793 }
11794 uint32_t __attribute__((export_name("TS_LDKCOption_EventZ_ty_from_ptr"))) TS_LDKCOption_EventZ_ty_from_ptr(uint64_t ptr) {
11795         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
11796         switch(obj->tag) {
11797                 case LDKCOption_EventZ_Some: return 0;
11798                 case LDKCOption_EventZ_None: return 1;
11799                 default: abort();
11800         }
11801 }
11802 uint64_t __attribute__((export_name("TS_LDKCOption_EventZ_Some_get_some"))) TS_LDKCOption_EventZ_Some_get_some(uint64_t ptr) {
11803         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
11804         assert(obj->tag == LDKCOption_EventZ_Some);
11805         uint64_t some_ref = tag_ptr(&obj->some, false);
11806         return some_ref;
11807 }
11808 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
11809 CHECK(owner->result_ok);
11810         return COption_EventZ_clone(&*owner->contents.result);
11811 }
11812 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_ok"))) TS_CResult_COption_EventZDecodeErrorZ_get_ok(uint64_t owner) {
11813         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
11814         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
11815         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
11816         uint64_t ret_ref = tag_ptr(ret_copy, true);
11817         return ret_ref;
11818 }
11819
11820 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
11821 CHECK(!owner->result_ok);
11822         return DecodeError_clone(&*owner->contents.err);
11823 }
11824 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_err"))) TS_CResult_COption_EventZDecodeErrorZ_get_err(uint64_t owner) {
11825         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
11826         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11827         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
11828         uint64_t ret_ref = tag_ptr(ret_copy, true);
11829         return ret_ref;
11830 }
11831
11832 uint32_t __attribute__((export_name("TS_LDKBolt11ParseError_ty_from_ptr"))) TS_LDKBolt11ParseError_ty_from_ptr(uint64_t ptr) {
11833         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
11834         switch(obj->tag) {
11835                 case LDKBolt11ParseError_Bech32Error: return 0;
11836                 case LDKBolt11ParseError_ParseAmountError: return 1;
11837                 case LDKBolt11ParseError_MalformedSignature: return 2;
11838                 case LDKBolt11ParseError_BadPrefix: return 3;
11839                 case LDKBolt11ParseError_UnknownCurrency: return 4;
11840                 case LDKBolt11ParseError_UnknownSiPrefix: return 5;
11841                 case LDKBolt11ParseError_MalformedHRP: return 6;
11842                 case LDKBolt11ParseError_TooShortDataPart: return 7;
11843                 case LDKBolt11ParseError_UnexpectedEndOfTaggedFields: return 8;
11844                 case LDKBolt11ParseError_DescriptionDecodeError: return 9;
11845                 case LDKBolt11ParseError_PaddingError: return 10;
11846                 case LDKBolt11ParseError_IntegerOverflowError: return 11;
11847                 case LDKBolt11ParseError_InvalidSegWitProgramLength: return 12;
11848                 case LDKBolt11ParseError_InvalidPubKeyHashLength: return 13;
11849                 case LDKBolt11ParseError_InvalidScriptHashLength: return 14;
11850                 case LDKBolt11ParseError_InvalidRecoveryId: return 15;
11851                 case LDKBolt11ParseError_InvalidSliceLength: return 16;
11852                 case LDKBolt11ParseError_Skip: return 17;
11853                 default: abort();
11854         }
11855 }
11856 uint64_t __attribute__((export_name("TS_LDKBolt11ParseError_Bech32Error_get_bech32_error"))) TS_LDKBolt11ParseError_Bech32Error_get_bech32_error(uint64_t ptr) {
11857         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
11858         assert(obj->tag == LDKBolt11ParseError_Bech32Error);
11859         uint64_t bech32_error_ref = tag_ptr(&obj->bech32_error, false);
11860         return bech32_error_ref;
11861 }
11862 int32_t __attribute__((export_name("TS_LDKBolt11ParseError_ParseAmountError_get_parse_amount_error"))) TS_LDKBolt11ParseError_ParseAmountError_get_parse_amount_error(uint64_t ptr) {
11863         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
11864         assert(obj->tag == LDKBolt11ParseError_ParseAmountError);
11865         /*obj->parse_amount_error*/
11866         return 0;
11867 }
11868 uint32_t __attribute__((export_name("TS_LDKBolt11ParseError_MalformedSignature_get_malformed_signature"))) TS_LDKBolt11ParseError_MalformedSignature_get_malformed_signature(uint64_t ptr) {
11869         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
11870         assert(obj->tag == LDKBolt11ParseError_MalformedSignature);
11871         uint32_t malformed_signature_conv = LDKSecp256k1Error_to_js(obj->malformed_signature);
11872         return malformed_signature_conv;
11873 }
11874 int32_t __attribute__((export_name("TS_LDKBolt11ParseError_DescriptionDecodeError_get_description_decode_error"))) TS_LDKBolt11ParseError_DescriptionDecodeError_get_description_decode_error(uint64_t ptr) {
11875         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
11876         assert(obj->tag == LDKBolt11ParseError_DescriptionDecodeError);
11877         /*obj->description_decode_error*/
11878         return 0;
11879 }
11880 jstring __attribute__((export_name("TS_LDKBolt11ParseError_InvalidSliceLength_get_invalid_slice_length"))) TS_LDKBolt11ParseError_InvalidSliceLength_get_invalid_slice_length(uint64_t ptr) {
11881         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
11882         assert(obj->tag == LDKBolt11ParseError_InvalidSliceLength);
11883         LDKStr invalid_slice_length_str = obj->invalid_slice_length;
11884                         jstring invalid_slice_length_conv = str_ref_to_ts(invalid_slice_length_str.chars, invalid_slice_length_str.len);
11885         return invalid_slice_length_conv;
11886 }
11887 static inline enum LDKSiPrefix CResult_SiPrefixBolt11ParseErrorZ_get_ok(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR owner){
11888 CHECK(owner->result_ok);
11889         return SiPrefix_clone(&*owner->contents.result);
11890 }
11891 uint32_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_get_ok"))) TS_CResult_SiPrefixBolt11ParseErrorZ_get_ok(uint64_t owner) {
11892         LDKCResult_SiPrefixBolt11ParseErrorZ* owner_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(owner);
11893         uint32_t ret_conv = LDKSiPrefix_to_js(CResult_SiPrefixBolt11ParseErrorZ_get_ok(owner_conv));
11894         return ret_conv;
11895 }
11896
11897 static inline struct LDKBolt11ParseError CResult_SiPrefixBolt11ParseErrorZ_get_err(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR owner){
11898 CHECK(!owner->result_ok);
11899         return Bolt11ParseError_clone(&*owner->contents.err);
11900 }
11901 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_get_err"))) TS_CResult_SiPrefixBolt11ParseErrorZ_get_err(uint64_t owner) {
11902         LDKCResult_SiPrefixBolt11ParseErrorZ* owner_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(owner);
11903         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
11904         *ret_copy = CResult_SiPrefixBolt11ParseErrorZ_get_err(owner_conv);
11905         uint64_t ret_ref = tag_ptr(ret_copy, true);
11906         return ret_ref;
11907 }
11908
11909 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_ty_from_ptr"))) TS_LDKParseOrSemanticError_ty_from_ptr(uint64_t ptr) {
11910         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
11911         switch(obj->tag) {
11912                 case LDKParseOrSemanticError_ParseError: return 0;
11913                 case LDKParseOrSemanticError_SemanticError: return 1;
11914                 default: abort();
11915         }
11916 }
11917 uint64_t __attribute__((export_name("TS_LDKParseOrSemanticError_ParseError_get_parse_error"))) TS_LDKParseOrSemanticError_ParseError_get_parse_error(uint64_t ptr) {
11918         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
11919         assert(obj->tag == LDKParseOrSemanticError_ParseError);
11920         uint64_t parse_error_ref = tag_ptr(&obj->parse_error, false);
11921         return parse_error_ref;
11922 }
11923 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_SemanticError_get_semantic_error"))) TS_LDKParseOrSemanticError_SemanticError_get_semantic_error(uint64_t ptr) {
11924         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
11925         assert(obj->tag == LDKParseOrSemanticError_SemanticError);
11926         uint32_t semantic_error_conv = LDKBolt11SemanticError_to_js(obj->semantic_error);
11927         return semantic_error_conv;
11928 }
11929 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
11930         LDKBolt11Invoice ret = *owner->contents.result;
11931         ret.is_owned = false;
11932         return ret;
11933 }
11934 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(uint64_t owner) {
11935         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
11936         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(owner_conv);
11937         uint64_t ret_ref = 0;
11938         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11939         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11940         return ret_ref;
11941 }
11942
11943 static inline struct LDKParseOrSemanticError CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
11944 CHECK(!owner->result_ok);
11945         return ParseOrSemanticError_clone(&*owner->contents.err);
11946 }
11947 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(uint64_t owner) {
11948         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
11949         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
11950         *ret_copy = CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
11951         uint64_t ret_ref = tag_ptr(ret_copy, true);
11952         return ret_ref;
11953 }
11954
11955 static inline struct LDKSignedRawBolt11Invoice CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR owner){
11956         LDKSignedRawBolt11Invoice ret = *owner->contents.result;
11957         ret.is_owned = false;
11958         return ret;
11959 }
11960 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(uint64_t owner) {
11961         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* owner_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(owner);
11962         LDKSignedRawBolt11Invoice ret_var = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(owner_conv);
11963         uint64_t ret_ref = 0;
11964         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11965         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11966         return ret_ref;
11967 }
11968
11969 static inline struct LDKBolt11ParseError CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR owner){
11970 CHECK(!owner->result_ok);
11971         return Bolt11ParseError_clone(&*owner->contents.err);
11972 }
11973 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(uint64_t owner) {
11974         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* owner_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(owner);
11975         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
11976         *ret_copy = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(owner_conv);
11977         uint64_t ret_ref = tag_ptr(ret_copy, true);
11978         return ret_ref;
11979 }
11980
11981 static inline struct LDKRawBolt11Invoice C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
11982         LDKRawBolt11Invoice ret = owner->a;
11983         ret.is_owned = false;
11984         return ret;
11985 }
11986 uint64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(uint64_t owner) {
11987         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
11988         LDKRawBolt11Invoice ret_var = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(owner_conv);
11989         uint64_t ret_ref = 0;
11990         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11991         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11992         return ret_ref;
11993 }
11994
11995 static inline struct LDKThirtyTwoBytes C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
11996         return ThirtyTwoBytes_clone(&owner->b);
11997 }
11998 int8_tArray  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(uint64_t owner) {
11999         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
12000         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
12001         memcpy(ret_arr->elems, C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(owner_conv).data, 32);
12002         return ret_arr;
12003 }
12004
12005 static inline struct LDKBolt11InvoiceSignature C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
12006         LDKBolt11InvoiceSignature ret = owner->c;
12007         ret.is_owned = false;
12008         return ret;
12009 }
12010 uint64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(uint64_t owner) {
12011         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
12012         LDKBolt11InvoiceSignature ret_var = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(owner_conv);
12013         uint64_t ret_ref = 0;
12014         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12015         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12016         return ret_ref;
12017 }
12018
12019 static inline struct LDKPayeePubKey CResult_PayeePubKeySecp256k1ErrorZ_get_ok(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR owner){
12020         LDKPayeePubKey ret = *owner->contents.result;
12021         ret.is_owned = false;
12022         return ret;
12023 }
12024 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_get_ok"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_get_ok(uint64_t owner) {
12025         LDKCResult_PayeePubKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(owner);
12026         LDKPayeePubKey ret_var = CResult_PayeePubKeySecp256k1ErrorZ_get_ok(owner_conv);
12027         uint64_t ret_ref = 0;
12028         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12029         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12030         return ret_ref;
12031 }
12032
12033 static inline enum LDKSecp256k1Error CResult_PayeePubKeySecp256k1ErrorZ_get_err(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR owner){
12034 CHECK(!owner->result_ok);
12035         return *owner->contents.err;
12036 }
12037 uint32_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_get_err"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_get_err(uint64_t owner) {
12038         LDKCResult_PayeePubKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(owner);
12039         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PayeePubKeySecp256k1ErrorZ_get_err(owner_conv));
12040         return ret_conv;
12041 }
12042
12043 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
12044         LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
12045         for (size_t i = 0; i < ret.datalen; i++) {
12046                 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
12047         }
12048         return ret;
12049 }
12050 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
12051         LDKPositiveTimestamp ret = *owner->contents.result;
12052         ret.is_owned = false;
12053         return ret;
12054 }
12055 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_get_ok(uint64_t owner) {
12056         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
12057         LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
12058         uint64_t ret_ref = 0;
12059         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12060         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12061         return ret_ref;
12062 }
12063
12064 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
12065 CHECK(!owner->result_ok);
12066         return CreationError_clone(&*owner->contents.err);
12067 }
12068 uint32_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_err"))) TS_CResult_PositiveTimestampCreationErrorZ_get_err(uint64_t owner) {
12069         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
12070         uint32_t ret_conv = LDKCreationError_to_js(CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
12071         return ret_conv;
12072 }
12073
12074 static inline void CResult_NoneBolt11SemanticErrorZ_get_ok(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR owner){
12075 CHECK(owner->result_ok);
12076         return *owner->contents.result;
12077 }
12078 void  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_get_ok"))) TS_CResult_NoneBolt11SemanticErrorZ_get_ok(uint64_t owner) {
12079         LDKCResult_NoneBolt11SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(owner);
12080         CResult_NoneBolt11SemanticErrorZ_get_ok(owner_conv);
12081 }
12082
12083 static inline enum LDKBolt11SemanticError CResult_NoneBolt11SemanticErrorZ_get_err(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR owner){
12084 CHECK(!owner->result_ok);
12085         return Bolt11SemanticError_clone(&*owner->contents.err);
12086 }
12087 uint32_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_get_err"))) TS_CResult_NoneBolt11SemanticErrorZ_get_err(uint64_t owner) {
12088         LDKCResult_NoneBolt11SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(owner);
12089         uint32_t ret_conv = LDKBolt11SemanticError_to_js(CResult_NoneBolt11SemanticErrorZ_get_err(owner_conv));
12090         return ret_conv;
12091 }
12092
12093 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR owner){
12094         LDKBolt11Invoice ret = *owner->contents.result;
12095         ret.is_owned = false;
12096         return ret;
12097 }
12098 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(uint64_t owner) {
12099         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(owner);
12100         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(owner_conv);
12101         uint64_t ret_ref = 0;
12102         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12103         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12104         return ret_ref;
12105 }
12106
12107 static inline enum LDKBolt11SemanticError CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR owner){
12108 CHECK(!owner->result_ok);
12109         return Bolt11SemanticError_clone(&*owner->contents.err);
12110 }
12111 uint32_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(uint64_t owner) {
12112         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(owner);
12113         uint32_t ret_conv = LDKBolt11SemanticError_to_js(CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(owner_conv));
12114         return ret_conv;
12115 }
12116
12117 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
12118         LDKDescription ret = *owner->contents.result;
12119         ret.is_owned = false;
12120         return ret;
12121 }
12122 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_ok"))) TS_CResult_DescriptionCreationErrorZ_get_ok(uint64_t owner) {
12123         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
12124         LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
12125         uint64_t ret_ref = 0;
12126         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12127         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12128         return ret_ref;
12129 }
12130
12131 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
12132 CHECK(!owner->result_ok);
12133         return CreationError_clone(&*owner->contents.err);
12134 }
12135 uint32_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_err"))) TS_CResult_DescriptionCreationErrorZ_get_err(uint64_t owner) {
12136         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
12137         uint32_t ret_conv = LDKCreationError_to_js(CResult_DescriptionCreationErrorZ_get_err(owner_conv));
12138         return ret_conv;
12139 }
12140
12141 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
12142         LDKPrivateRoute ret = *owner->contents.result;
12143         ret.is_owned = false;
12144         return ret;
12145 }
12146 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_ok"))) TS_CResult_PrivateRouteCreationErrorZ_get_ok(uint64_t owner) {
12147         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
12148         LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
12149         uint64_t ret_ref = 0;
12150         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12151         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12152         return ret_ref;
12153 }
12154
12155 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
12156 CHECK(!owner->result_ok);
12157         return CreationError_clone(&*owner->contents.err);
12158 }
12159 uint32_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_err"))) TS_CResult_PrivateRouteCreationErrorZ_get_err(uint64_t owner) {
12160         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
12161         uint32_t ret_conv = LDKCreationError_to_js(CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
12162         return ret_conv;
12163 }
12164
12165 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
12166         LDKOutPoint ret = *owner->contents.result;
12167         ret.is_owned = false;
12168         return ret;
12169 }
12170 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_ok"))) TS_CResult_OutPointDecodeErrorZ_get_ok(uint64_t owner) {
12171         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
12172         LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
12173         uint64_t ret_ref = 0;
12174         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12175         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12176         return ret_ref;
12177 }
12178
12179 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
12180 CHECK(!owner->result_ok);
12181         return DecodeError_clone(&*owner->contents.err);
12182 }
12183 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_err"))) TS_CResult_OutPointDecodeErrorZ_get_err(uint64_t owner) {
12184         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
12185         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12186         *ret_copy = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
12187         uint64_t ret_ref = tag_ptr(ret_copy, true);
12188         return ret_ref;
12189 }
12190
12191 static inline struct LDKBigSize CResult_BigSizeDecodeErrorZ_get_ok(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR owner){
12192         LDKBigSize ret = *owner->contents.result;
12193         ret.is_owned = false;
12194         return ret;
12195 }
12196 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_get_ok"))) TS_CResult_BigSizeDecodeErrorZ_get_ok(uint64_t owner) {
12197         LDKCResult_BigSizeDecodeErrorZ* owner_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(owner);
12198         LDKBigSize ret_var = CResult_BigSizeDecodeErrorZ_get_ok(owner_conv);
12199         uint64_t ret_ref = 0;
12200         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12201         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12202         return ret_ref;
12203 }
12204
12205 static inline struct LDKDecodeError CResult_BigSizeDecodeErrorZ_get_err(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR owner){
12206 CHECK(!owner->result_ok);
12207         return DecodeError_clone(&*owner->contents.err);
12208 }
12209 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_get_err"))) TS_CResult_BigSizeDecodeErrorZ_get_err(uint64_t owner) {
12210         LDKCResult_BigSizeDecodeErrorZ* owner_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(owner);
12211         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12212         *ret_copy = CResult_BigSizeDecodeErrorZ_get_err(owner_conv);
12213         uint64_t ret_ref = tag_ptr(ret_copy, true);
12214         return ret_ref;
12215 }
12216
12217 static inline struct LDKHostname CResult_HostnameDecodeErrorZ_get_ok(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR owner){
12218         LDKHostname ret = *owner->contents.result;
12219         ret.is_owned = false;
12220         return ret;
12221 }
12222 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_get_ok"))) TS_CResult_HostnameDecodeErrorZ_get_ok(uint64_t owner) {
12223         LDKCResult_HostnameDecodeErrorZ* owner_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(owner);
12224         LDKHostname ret_var = CResult_HostnameDecodeErrorZ_get_ok(owner_conv);
12225         uint64_t ret_ref = 0;
12226         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12227         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12228         return ret_ref;
12229 }
12230
12231 static inline struct LDKDecodeError CResult_HostnameDecodeErrorZ_get_err(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR owner){
12232 CHECK(!owner->result_ok);
12233         return DecodeError_clone(&*owner->contents.err);
12234 }
12235 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_get_err"))) TS_CResult_HostnameDecodeErrorZ_get_err(uint64_t owner) {
12236         LDKCResult_HostnameDecodeErrorZ* owner_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(owner);
12237         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12238         *ret_copy = CResult_HostnameDecodeErrorZ_get_err(owner_conv);
12239         uint64_t ret_ref = tag_ptr(ret_copy, true);
12240         return ret_ref;
12241 }
12242
12243 static inline struct LDKTransactionU16LenLimited CResult_TransactionU16LenLimitedNoneZ_get_ok(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR owner){
12244         LDKTransactionU16LenLimited ret = *owner->contents.result;
12245         ret.is_owned = false;
12246         return ret;
12247 }
12248 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_get_ok"))) TS_CResult_TransactionU16LenLimitedNoneZ_get_ok(uint64_t owner) {
12249         LDKCResult_TransactionU16LenLimitedNoneZ* owner_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(owner);
12250         LDKTransactionU16LenLimited ret_var = CResult_TransactionU16LenLimitedNoneZ_get_ok(owner_conv);
12251         uint64_t ret_ref = 0;
12252         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12253         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12254         return ret_ref;
12255 }
12256
12257 static inline void CResult_TransactionU16LenLimitedNoneZ_get_err(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR owner){
12258 CHECK(!owner->result_ok);
12259         return *owner->contents.err;
12260 }
12261 void  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_get_err"))) TS_CResult_TransactionU16LenLimitedNoneZ_get_err(uint64_t owner) {
12262         LDKCResult_TransactionU16LenLimitedNoneZ* owner_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(owner);
12263         CResult_TransactionU16LenLimitedNoneZ_get_err(owner_conv);
12264 }
12265
12266 static inline struct LDKTransactionU16LenLimited CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR owner){
12267         LDKTransactionU16LenLimited ret = *owner->contents.result;
12268         ret.is_owned = false;
12269         return ret;
12270 }
12271 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(uint64_t owner) {
12272         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* owner_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(owner);
12273         LDKTransactionU16LenLimited ret_var = CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(owner_conv);
12274         uint64_t ret_ref = 0;
12275         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12276         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12277         return ret_ref;
12278 }
12279
12280 static inline struct LDKDecodeError CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR owner){
12281 CHECK(!owner->result_ok);
12282         return DecodeError_clone(&*owner->contents.err);
12283 }
12284 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_get_err"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(uint64_t owner) {
12285         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* owner_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(owner);
12286         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12287         *ret_copy = CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(owner_conv);
12288         uint64_t ret_ref = tag_ptr(ret_copy, true);
12289         return ret_ref;
12290 }
12291
12292 static inline struct LDKUntrustedString CResult_UntrustedStringDecodeErrorZ_get_ok(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
12293         LDKUntrustedString ret = *owner->contents.result;
12294         ret.is_owned = false;
12295         return ret;
12296 }
12297 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_get_ok"))) TS_CResult_UntrustedStringDecodeErrorZ_get_ok(uint64_t owner) {
12298         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
12299         LDKUntrustedString ret_var = CResult_UntrustedStringDecodeErrorZ_get_ok(owner_conv);
12300         uint64_t ret_ref = 0;
12301         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12302         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12303         return ret_ref;
12304 }
12305
12306 static inline struct LDKDecodeError CResult_UntrustedStringDecodeErrorZ_get_err(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
12307 CHECK(!owner->result_ok);
12308         return DecodeError_clone(&*owner->contents.err);
12309 }
12310 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_get_err"))) TS_CResult_UntrustedStringDecodeErrorZ_get_err(uint64_t owner) {
12311         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
12312         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12313         *ret_copy = CResult_UntrustedStringDecodeErrorZ_get_err(owner_conv);
12314         uint64_t ret_ref = tag_ptr(ret_copy, true);
12315         return ret_ref;
12316 }
12317
12318 static inline struct LDKChannelId CResult_ChannelIdDecodeErrorZ_get_ok(LDKCResult_ChannelIdDecodeErrorZ *NONNULL_PTR owner){
12319         LDKChannelId ret = *owner->contents.result;
12320         ret.is_owned = false;
12321         return ret;
12322 }
12323 uint64_t  __attribute__((export_name("TS_CResult_ChannelIdDecodeErrorZ_get_ok"))) TS_CResult_ChannelIdDecodeErrorZ_get_ok(uint64_t owner) {
12324         LDKCResult_ChannelIdDecodeErrorZ* owner_conv = (LDKCResult_ChannelIdDecodeErrorZ*)untag_ptr(owner);
12325         LDKChannelId ret_var = CResult_ChannelIdDecodeErrorZ_get_ok(owner_conv);
12326         uint64_t ret_ref = 0;
12327         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12328         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12329         return ret_ref;
12330 }
12331
12332 static inline struct LDKDecodeError CResult_ChannelIdDecodeErrorZ_get_err(LDKCResult_ChannelIdDecodeErrorZ *NONNULL_PTR owner){
12333 CHECK(!owner->result_ok);
12334         return DecodeError_clone(&*owner->contents.err);
12335 }
12336 uint64_t  __attribute__((export_name("TS_CResult_ChannelIdDecodeErrorZ_get_err"))) TS_CResult_ChannelIdDecodeErrorZ_get_err(uint64_t owner) {
12337         LDKCResult_ChannelIdDecodeErrorZ* owner_conv = (LDKCResult_ChannelIdDecodeErrorZ*)untag_ptr(owner);
12338         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12339         *ret_copy = CResult_ChannelIdDecodeErrorZ_get_err(owner_conv);
12340         uint64_t ret_ref = tag_ptr(ret_copy, true);
12341         return ret_ref;
12342 }
12343
12344 static inline struct LDKThirtyTwoBytes C2Tuple__u832u16Z_get_a(LDKC2Tuple__u832u16Z *NONNULL_PTR owner){
12345         return ThirtyTwoBytes_clone(&owner->a);
12346 }
12347 int8_tArray  __attribute__((export_name("TS_C2Tuple__u832u16Z_get_a"))) TS_C2Tuple__u832u16Z_get_a(uint64_t owner) {
12348         LDKC2Tuple__u832u16Z* owner_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(owner);
12349         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
12350         memcpy(ret_arr->elems, C2Tuple__u832u16Z_get_a(owner_conv).data, 32);
12351         return ret_arr;
12352 }
12353
12354 static inline uint16_t C2Tuple__u832u16Z_get_b(LDKC2Tuple__u832u16Z *NONNULL_PTR owner){
12355         return owner->b;
12356 }
12357 int16_t  __attribute__((export_name("TS_C2Tuple__u832u16Z_get_b"))) TS_C2Tuple__u832u16Z_get_b(uint64_t owner) {
12358         LDKC2Tuple__u832u16Z* owner_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(owner);
12359         int16_t ret_conv = C2Tuple__u832u16Z_get_b(owner_conv);
12360         return ret_conv;
12361 }
12362
12363 static inline struct LDKPaymentRelay CResult_PaymentRelayDecodeErrorZ_get_ok(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR owner){
12364         LDKPaymentRelay ret = *owner->contents.result;
12365         ret.is_owned = false;
12366         return ret;
12367 }
12368 uint64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_get_ok"))) TS_CResult_PaymentRelayDecodeErrorZ_get_ok(uint64_t owner) {
12369         LDKCResult_PaymentRelayDecodeErrorZ* owner_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(owner);
12370         LDKPaymentRelay ret_var = CResult_PaymentRelayDecodeErrorZ_get_ok(owner_conv);
12371         uint64_t ret_ref = 0;
12372         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12373         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12374         return ret_ref;
12375 }
12376
12377 static inline struct LDKDecodeError CResult_PaymentRelayDecodeErrorZ_get_err(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR owner){
12378 CHECK(!owner->result_ok);
12379         return DecodeError_clone(&*owner->contents.err);
12380 }
12381 uint64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_get_err"))) TS_CResult_PaymentRelayDecodeErrorZ_get_err(uint64_t owner) {
12382         LDKCResult_PaymentRelayDecodeErrorZ* owner_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(owner);
12383         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12384         *ret_copy = CResult_PaymentRelayDecodeErrorZ_get_err(owner_conv);
12385         uint64_t ret_ref = tag_ptr(ret_copy, true);
12386         return ret_ref;
12387 }
12388
12389 static inline struct LDKPaymentConstraints CResult_PaymentConstraintsDecodeErrorZ_get_ok(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR owner){
12390         LDKPaymentConstraints ret = *owner->contents.result;
12391         ret.is_owned = false;
12392         return ret;
12393 }
12394 uint64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_get_ok"))) TS_CResult_PaymentConstraintsDecodeErrorZ_get_ok(uint64_t owner) {
12395         LDKCResult_PaymentConstraintsDecodeErrorZ* owner_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(owner);
12396         LDKPaymentConstraints ret_var = CResult_PaymentConstraintsDecodeErrorZ_get_ok(owner_conv);
12397         uint64_t ret_ref = 0;
12398         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12399         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12400         return ret_ref;
12401 }
12402
12403 static inline struct LDKDecodeError CResult_PaymentConstraintsDecodeErrorZ_get_err(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR owner){
12404 CHECK(!owner->result_ok);
12405         return DecodeError_clone(&*owner->contents.err);
12406 }
12407 uint64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_get_err"))) TS_CResult_PaymentConstraintsDecodeErrorZ_get_err(uint64_t owner) {
12408         LDKCResult_PaymentConstraintsDecodeErrorZ* owner_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(owner);
12409         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12410         *ret_copy = CResult_PaymentConstraintsDecodeErrorZ_get_err(owner_conv);
12411         uint64_t ret_ref = tag_ptr(ret_copy, true);
12412         return ret_ref;
12413 }
12414
12415 static inline struct LDKPaymentContext CResult_PaymentContextDecodeErrorZ_get_ok(LDKCResult_PaymentContextDecodeErrorZ *NONNULL_PTR owner){
12416 CHECK(owner->result_ok);
12417         return PaymentContext_clone(&*owner->contents.result);
12418 }
12419 uint64_t  __attribute__((export_name("TS_CResult_PaymentContextDecodeErrorZ_get_ok"))) TS_CResult_PaymentContextDecodeErrorZ_get_ok(uint64_t owner) {
12420         LDKCResult_PaymentContextDecodeErrorZ* owner_conv = (LDKCResult_PaymentContextDecodeErrorZ*)untag_ptr(owner);
12421         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
12422         *ret_copy = CResult_PaymentContextDecodeErrorZ_get_ok(owner_conv);
12423         uint64_t ret_ref = tag_ptr(ret_copy, true);
12424         return ret_ref;
12425 }
12426
12427 static inline struct LDKDecodeError CResult_PaymentContextDecodeErrorZ_get_err(LDKCResult_PaymentContextDecodeErrorZ *NONNULL_PTR owner){
12428 CHECK(!owner->result_ok);
12429         return DecodeError_clone(&*owner->contents.err);
12430 }
12431 uint64_t  __attribute__((export_name("TS_CResult_PaymentContextDecodeErrorZ_get_err"))) TS_CResult_PaymentContextDecodeErrorZ_get_err(uint64_t owner) {
12432         LDKCResult_PaymentContextDecodeErrorZ* owner_conv = (LDKCResult_PaymentContextDecodeErrorZ*)untag_ptr(owner);
12433         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12434         *ret_copy = CResult_PaymentContextDecodeErrorZ_get_err(owner_conv);
12435         uint64_t ret_ref = tag_ptr(ret_copy, true);
12436         return ret_ref;
12437 }
12438
12439 static inline struct LDKUnknownPaymentContext CResult_UnknownPaymentContextDecodeErrorZ_get_ok(LDKCResult_UnknownPaymentContextDecodeErrorZ *NONNULL_PTR owner){
12440         LDKUnknownPaymentContext ret = *owner->contents.result;
12441         ret.is_owned = false;
12442         return ret;
12443 }
12444 uint64_t  __attribute__((export_name("TS_CResult_UnknownPaymentContextDecodeErrorZ_get_ok"))) TS_CResult_UnknownPaymentContextDecodeErrorZ_get_ok(uint64_t owner) {
12445         LDKCResult_UnknownPaymentContextDecodeErrorZ* owner_conv = (LDKCResult_UnknownPaymentContextDecodeErrorZ*)untag_ptr(owner);
12446         LDKUnknownPaymentContext ret_var = CResult_UnknownPaymentContextDecodeErrorZ_get_ok(owner_conv);
12447         uint64_t ret_ref = 0;
12448         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12449         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12450         return ret_ref;
12451 }
12452
12453 static inline struct LDKDecodeError CResult_UnknownPaymentContextDecodeErrorZ_get_err(LDKCResult_UnknownPaymentContextDecodeErrorZ *NONNULL_PTR owner){
12454 CHECK(!owner->result_ok);
12455         return DecodeError_clone(&*owner->contents.err);
12456 }
12457 uint64_t  __attribute__((export_name("TS_CResult_UnknownPaymentContextDecodeErrorZ_get_err"))) TS_CResult_UnknownPaymentContextDecodeErrorZ_get_err(uint64_t owner) {
12458         LDKCResult_UnknownPaymentContextDecodeErrorZ* owner_conv = (LDKCResult_UnknownPaymentContextDecodeErrorZ*)untag_ptr(owner);
12459         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12460         *ret_copy = CResult_UnknownPaymentContextDecodeErrorZ_get_err(owner_conv);
12461         uint64_t ret_ref = tag_ptr(ret_copy, true);
12462         return ret_ref;
12463 }
12464
12465 static inline struct LDKBolt12OfferContext CResult_Bolt12OfferContextDecodeErrorZ_get_ok(LDKCResult_Bolt12OfferContextDecodeErrorZ *NONNULL_PTR owner){
12466         LDKBolt12OfferContext ret = *owner->contents.result;
12467         ret.is_owned = false;
12468         return ret;
12469 }
12470 uint64_t  __attribute__((export_name("TS_CResult_Bolt12OfferContextDecodeErrorZ_get_ok"))) TS_CResult_Bolt12OfferContextDecodeErrorZ_get_ok(uint64_t owner) {
12471         LDKCResult_Bolt12OfferContextDecodeErrorZ* owner_conv = (LDKCResult_Bolt12OfferContextDecodeErrorZ*)untag_ptr(owner);
12472         LDKBolt12OfferContext ret_var = CResult_Bolt12OfferContextDecodeErrorZ_get_ok(owner_conv);
12473         uint64_t ret_ref = 0;
12474         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12475         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12476         return ret_ref;
12477 }
12478
12479 static inline struct LDKDecodeError CResult_Bolt12OfferContextDecodeErrorZ_get_err(LDKCResult_Bolt12OfferContextDecodeErrorZ *NONNULL_PTR owner){
12480 CHECK(!owner->result_ok);
12481         return DecodeError_clone(&*owner->contents.err);
12482 }
12483 uint64_t  __attribute__((export_name("TS_CResult_Bolt12OfferContextDecodeErrorZ_get_err"))) TS_CResult_Bolt12OfferContextDecodeErrorZ_get_err(uint64_t owner) {
12484         LDKCResult_Bolt12OfferContextDecodeErrorZ* owner_conv = (LDKCResult_Bolt12OfferContextDecodeErrorZ*)untag_ptr(owner);
12485         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12486         *ret_copy = CResult_Bolt12OfferContextDecodeErrorZ_get_err(owner_conv);
12487         uint64_t ret_ref = tag_ptr(ret_copy, true);
12488         return ret_ref;
12489 }
12490
12491 static inline struct LDKBolt12RefundContext CResult_Bolt12RefundContextDecodeErrorZ_get_ok(LDKCResult_Bolt12RefundContextDecodeErrorZ *NONNULL_PTR owner){
12492         LDKBolt12RefundContext ret = *owner->contents.result;
12493         ret.is_owned = false;
12494         return ret;
12495 }
12496 uint64_t  __attribute__((export_name("TS_CResult_Bolt12RefundContextDecodeErrorZ_get_ok"))) TS_CResult_Bolt12RefundContextDecodeErrorZ_get_ok(uint64_t owner) {
12497         LDKCResult_Bolt12RefundContextDecodeErrorZ* owner_conv = (LDKCResult_Bolt12RefundContextDecodeErrorZ*)untag_ptr(owner);
12498         LDKBolt12RefundContext ret_var = CResult_Bolt12RefundContextDecodeErrorZ_get_ok(owner_conv);
12499         uint64_t ret_ref = 0;
12500         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12501         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12502         return ret_ref;
12503 }
12504
12505 static inline struct LDKDecodeError CResult_Bolt12RefundContextDecodeErrorZ_get_err(LDKCResult_Bolt12RefundContextDecodeErrorZ *NONNULL_PTR owner){
12506 CHECK(!owner->result_ok);
12507         return DecodeError_clone(&*owner->contents.err);
12508 }
12509 uint64_t  __attribute__((export_name("TS_CResult_Bolt12RefundContextDecodeErrorZ_get_err"))) TS_CResult_Bolt12RefundContextDecodeErrorZ_get_err(uint64_t owner) {
12510         LDKCResult_Bolt12RefundContextDecodeErrorZ* owner_conv = (LDKCResult_Bolt12RefundContextDecodeErrorZ*)untag_ptr(owner);
12511         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12512         *ret_copy = CResult_Bolt12RefundContextDecodeErrorZ_get_err(owner_conv);
12513         uint64_t ret_ref = tag_ptr(ret_copy, true);
12514         return ret_ref;
12515 }
12516
12517 static inline struct LDKStr CResult_StrSecp256k1ErrorZ_get_ok(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR owner){
12518 CHECK(owner->result_ok);
12519         return *owner->contents.result;
12520 }
12521 jstring  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_get_ok"))) TS_CResult_StrSecp256k1ErrorZ_get_ok(uint64_t owner) {
12522         LDKCResult_StrSecp256k1ErrorZ* owner_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(owner);
12523         LDKStr ret_str = CResult_StrSecp256k1ErrorZ_get_ok(owner_conv);
12524         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
12525         return ret_conv;
12526 }
12527
12528 static inline enum LDKSecp256k1Error CResult_StrSecp256k1ErrorZ_get_err(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR owner){
12529 CHECK(!owner->result_ok);
12530         return *owner->contents.err;
12531 }
12532 uint32_t  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_get_err"))) TS_CResult_StrSecp256k1ErrorZ_get_err(uint64_t owner) {
12533         LDKCResult_StrSecp256k1ErrorZ* owner_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(owner);
12534         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_StrSecp256k1ErrorZ_get_err(owner_conv));
12535         return ret_conv;
12536 }
12537
12538 static inline struct LDKThirtyTwoBytes C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_a(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR owner){
12539         return ThirtyTwoBytes_clone(&owner->a);
12540 }
12541 int8_tArray  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_a"))) TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_a(uint64_t owner) {
12542         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(owner);
12543         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
12544         memcpy(ret_arr->elems, C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_a(owner_conv).data, 32);
12545         return ret_arr;
12546 }
12547
12548 static inline struct LDKRecipientOnionFields C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_b(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR owner){
12549         LDKRecipientOnionFields ret = owner->b;
12550         ret.is_owned = false;
12551         return ret;
12552 }
12553 uint64_t  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_b"))) TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_b(uint64_t owner) {
12554         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(owner);
12555         LDKRecipientOnionFields ret_var = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_b(owner_conv);
12556         uint64_t ret_ref = 0;
12557         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12558         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12559         return ret_ref;
12560 }
12561
12562 static inline struct LDKRouteParameters C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_c(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR owner){
12563         LDKRouteParameters ret = owner->c;
12564         ret.is_owned = false;
12565         return ret;
12566 }
12567 uint64_t  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_c"))) TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_c(uint64_t owner) {
12568         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(owner);
12569         LDKRouteParameters ret_var = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_c(owner_conv);
12570         uint64_t ret_ref = 0;
12571         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12572         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12573         return ret_ref;
12574 }
12575
12576 static inline struct LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_ok(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ *NONNULL_PTR owner){
12577 CHECK(owner->result_ok);
12578         return C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(&*owner->contents.result);
12579 }
12580 uint64_t  __attribute__((export_name("TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_ok"))) TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_ok(uint64_t owner) {
12581         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* owner_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(owner);
12582         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
12583         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_ok(owner_conv);
12584         return tag_ptr(ret_conv, true);
12585 }
12586
12587 static inline void CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_err(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ *NONNULL_PTR owner){
12588 CHECK(!owner->result_ok);
12589         return *owner->contents.err;
12590 }
12591 void  __attribute__((export_name("TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_err"))) TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_err(uint64_t owner) {
12592         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* owner_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(owner);
12593         CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_err(owner_conv);
12594 }
12595
12596 static inline struct LDKPublicKey C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_a(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR owner){
12597         return owner->a;
12598 }
12599 int8_tArray  __attribute__((export_name("TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_a"))) TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_a(uint64_t owner) {
12600         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* owner_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(owner);
12601         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
12602         memcpy(ret_arr->elems, C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_a(owner_conv).compressed_form, 33);
12603         return ret_arr;
12604 }
12605
12606 static inline struct LDKOnionMessage C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_b(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR owner){
12607         LDKOnionMessage ret = owner->b;
12608         ret.is_owned = false;
12609         return ret;
12610 }
12611 uint64_t  __attribute__((export_name("TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_b"))) TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_b(uint64_t owner) {
12612         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* owner_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(owner);
12613         LDKOnionMessage ret_var = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_b(owner_conv);
12614         uint64_t ret_ref = 0;
12615         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12616         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12617         return ret_ref;
12618 }
12619
12620 static inline struct LDKCOption_CVec_SocketAddressZZ C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_c(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR owner){
12621         return COption_CVec_SocketAddressZZ_clone(&owner->c);
12622 }
12623 uint64_t  __attribute__((export_name("TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_c"))) TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_c(uint64_t owner) {
12624         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* owner_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(owner);
12625         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
12626         *ret_copy = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_c(owner_conv);
12627         uint64_t ret_ref = tag_ptr(ret_copy, true);
12628         return ret_ref;
12629 }
12630
12631 uint32_t __attribute__((export_name("TS_LDKSendError_ty_from_ptr"))) TS_LDKSendError_ty_from_ptr(uint64_t ptr) {
12632         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
12633         switch(obj->tag) {
12634                 case LDKSendError_Secp256k1: return 0;
12635                 case LDKSendError_TooBigPacket: return 1;
12636                 case LDKSendError_TooFewBlindedHops: return 2;
12637                 case LDKSendError_InvalidFirstHop: return 3;
12638                 case LDKSendError_PathNotFound: return 4;
12639                 case LDKSendError_InvalidMessage: return 5;
12640                 case LDKSendError_BufferFull: return 6;
12641                 case LDKSendError_GetNodeIdFailed: return 7;
12642                 case LDKSendError_UnresolvedIntroductionNode: return 8;
12643                 case LDKSendError_BlindedPathAdvanceFailed: return 9;
12644                 default: abort();
12645         }
12646 }
12647 uint32_t __attribute__((export_name("TS_LDKSendError_Secp256k1_get_secp256k1"))) TS_LDKSendError_Secp256k1_get_secp256k1(uint64_t ptr) {
12648         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
12649         assert(obj->tag == LDKSendError_Secp256k1);
12650         uint32_t secp256k1_conv = LDKSecp256k1Error_to_js(obj->secp256k1);
12651         return secp256k1_conv;
12652 }
12653 int8_tArray __attribute__((export_name("TS_LDKSendError_InvalidFirstHop_get_invalid_first_hop"))) TS_LDKSendError_InvalidFirstHop_get_invalid_first_hop(uint64_t ptr) {
12654         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
12655         assert(obj->tag == LDKSendError_InvalidFirstHop);
12656         int8_tArray invalid_first_hop_arr = init_int8_tArray(33, __LINE__);
12657         memcpy(invalid_first_hop_arr->elems, obj->invalid_first_hop.compressed_form, 33);
12658         return invalid_first_hop_arr;
12659 }
12660 static inline struct LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_ok(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ *NONNULL_PTR owner){
12661 CHECK(owner->result_ok);
12662         return C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(&*owner->contents.result);
12663 }
12664 uint64_t  __attribute__((export_name("TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_ok"))) TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_ok(uint64_t owner) {
12665         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* owner_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(owner);
12666         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
12667         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_ok(owner_conv);
12668         return tag_ptr(ret_conv, true);
12669 }
12670
12671 static inline struct LDKSendError CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_err(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ *NONNULL_PTR owner){
12672 CHECK(!owner->result_ok);
12673         return SendError_clone(&*owner->contents.err);
12674 }
12675 uint64_t  __attribute__((export_name("TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_err"))) TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_err(uint64_t owner) {
12676         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* owner_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(owner);
12677         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
12678         *ret_copy = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_err(owner_conv);
12679         uint64_t ret_ref = tag_ptr(ret_copy, true);
12680         return ret_ref;
12681 }
12682
12683 uint32_t __attribute__((export_name("TS_LDKNextMessageHop_ty_from_ptr"))) TS_LDKNextMessageHop_ty_from_ptr(uint64_t ptr) {
12684         LDKNextMessageHop *obj = (LDKNextMessageHop*)untag_ptr(ptr);
12685         switch(obj->tag) {
12686                 case LDKNextMessageHop_NodeId: return 0;
12687                 case LDKNextMessageHop_ShortChannelId: return 1;
12688                 default: abort();
12689         }
12690 }
12691 int8_tArray __attribute__((export_name("TS_LDKNextMessageHop_NodeId_get_node_id"))) TS_LDKNextMessageHop_NodeId_get_node_id(uint64_t ptr) {
12692         LDKNextMessageHop *obj = (LDKNextMessageHop*)untag_ptr(ptr);
12693         assert(obj->tag == LDKNextMessageHop_NodeId);
12694         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
12695         memcpy(node_id_arr->elems, obj->node_id.compressed_form, 33);
12696         return node_id_arr;
12697 }
12698 int64_t __attribute__((export_name("TS_LDKNextMessageHop_ShortChannelId_get_short_channel_id"))) TS_LDKNextMessageHop_ShortChannelId_get_short_channel_id(uint64_t ptr) {
12699         LDKNextMessageHop *obj = (LDKNextMessageHop*)untag_ptr(ptr);
12700         assert(obj->tag == LDKNextMessageHop_ShortChannelId);
12701         int64_t short_channel_id_conv = obj->short_channel_id;
12702         return short_channel_id_conv;
12703 }
12704 uint32_t __attribute__((export_name("TS_LDKParsedOnionMessageContents_ty_from_ptr"))) TS_LDKParsedOnionMessageContents_ty_from_ptr(uint64_t ptr) {
12705         LDKParsedOnionMessageContents *obj = (LDKParsedOnionMessageContents*)untag_ptr(ptr);
12706         switch(obj->tag) {
12707                 case LDKParsedOnionMessageContents_Offers: return 0;
12708                 case LDKParsedOnionMessageContents_Custom: return 1;
12709                 default: abort();
12710         }
12711 }
12712 uint64_t __attribute__((export_name("TS_LDKParsedOnionMessageContents_Offers_get_offers"))) TS_LDKParsedOnionMessageContents_Offers_get_offers(uint64_t ptr) {
12713         LDKParsedOnionMessageContents *obj = (LDKParsedOnionMessageContents*)untag_ptr(ptr);
12714         assert(obj->tag == LDKParsedOnionMessageContents_Offers);
12715         uint64_t offers_ref = tag_ptr(&obj->offers, false);
12716         return offers_ref;
12717 }
12718 uint64_t __attribute__((export_name("TS_LDKParsedOnionMessageContents_Custom_get_custom"))) TS_LDKParsedOnionMessageContents_Custom_get_custom(uint64_t ptr) {
12719         LDKParsedOnionMessageContents *obj = (LDKParsedOnionMessageContents*)untag_ptr(ptr);
12720         assert(obj->tag == LDKParsedOnionMessageContents_Custom);
12721         LDKOnionMessageContents* custom_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
12722         *custom_ret = OnionMessageContents_clone(&obj->custom);
12723         return tag_ptr(custom_ret, true);
12724 }
12725 uint32_t __attribute__((export_name("TS_LDKPeeledOnion_ty_from_ptr"))) TS_LDKPeeledOnion_ty_from_ptr(uint64_t ptr) {
12726         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
12727         switch(obj->tag) {
12728                 case LDKPeeledOnion_Forward: return 0;
12729                 case LDKPeeledOnion_Receive: return 1;
12730                 default: abort();
12731         }
12732 }
12733 uint64_t __attribute__((export_name("TS_LDKPeeledOnion_Forward_get__0"))) TS_LDKPeeledOnion_Forward_get__0(uint64_t ptr) {
12734         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
12735         assert(obj->tag == LDKPeeledOnion_Forward);
12736         uint64_t _0_ref = tag_ptr(&obj->forward._0, false);
12737         return _0_ref;
12738 }
12739 uint64_t __attribute__((export_name("TS_LDKPeeledOnion_Forward_get__1"))) TS_LDKPeeledOnion_Forward_get__1(uint64_t ptr) {
12740         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
12741         assert(obj->tag == LDKPeeledOnion_Forward);
12742         LDKOnionMessage _1_var = obj->forward._1;
12743                         uint64_t _1_ref = 0;
12744                         CHECK_INNER_FIELD_ACCESS_OR_NULL(_1_var);
12745                         _1_ref = tag_ptr(_1_var.inner, false);
12746         return _1_ref;
12747 }
12748 uint64_t __attribute__((export_name("TS_LDKPeeledOnion_Receive_get__0"))) TS_LDKPeeledOnion_Receive_get__0(uint64_t ptr) {
12749         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
12750         assert(obj->tag == LDKPeeledOnion_Receive);
12751         uint64_t _0_ref = tag_ptr(&obj->receive._0, false);
12752         return _0_ref;
12753 }
12754 int8_tArray __attribute__((export_name("TS_LDKPeeledOnion_Receive_get__1"))) TS_LDKPeeledOnion_Receive_get__1(uint64_t ptr) {
12755         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
12756         assert(obj->tag == LDKPeeledOnion_Receive);
12757         int8_tArray _1_arr = init_int8_tArray(32, __LINE__);
12758         memcpy(_1_arr->elems, obj->receive._1.data, 32);
12759         return _1_arr;
12760 }
12761 uint64_t __attribute__((export_name("TS_LDKPeeledOnion_Receive_get__2"))) TS_LDKPeeledOnion_Receive_get__2(uint64_t ptr) {
12762         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
12763         assert(obj->tag == LDKPeeledOnion_Receive);
12764         LDKBlindedPath _2_var = obj->receive._2;
12765                         uint64_t _2_ref = 0;
12766                         CHECK_INNER_FIELD_ACCESS_OR_NULL(_2_var);
12767                         _2_ref = tag_ptr(_2_var.inner, false);
12768         return _2_ref;
12769 }
12770 static inline struct LDKPeeledOnion CResult_PeeledOnionNoneZ_get_ok(LDKCResult_PeeledOnionNoneZ *NONNULL_PTR owner){
12771 CHECK(owner->result_ok);
12772         return PeeledOnion_clone(&*owner->contents.result);
12773 }
12774 uint64_t  __attribute__((export_name("TS_CResult_PeeledOnionNoneZ_get_ok"))) TS_CResult_PeeledOnionNoneZ_get_ok(uint64_t owner) {
12775         LDKCResult_PeeledOnionNoneZ* owner_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(owner);
12776         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
12777         *ret_copy = CResult_PeeledOnionNoneZ_get_ok(owner_conv);
12778         uint64_t ret_ref = tag_ptr(ret_copy, true);
12779         return ret_ref;
12780 }
12781
12782 static inline void CResult_PeeledOnionNoneZ_get_err(LDKCResult_PeeledOnionNoneZ *NONNULL_PTR owner){
12783 CHECK(!owner->result_ok);
12784         return *owner->contents.err;
12785 }
12786 void  __attribute__((export_name("TS_CResult_PeeledOnionNoneZ_get_err"))) TS_CResult_PeeledOnionNoneZ_get_err(uint64_t owner) {
12787         LDKCResult_PeeledOnionNoneZ* owner_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(owner);
12788         CResult_PeeledOnionNoneZ_get_err(owner_conv);
12789 }
12790
12791 uint32_t __attribute__((export_name("TS_LDKSendSuccess_ty_from_ptr"))) TS_LDKSendSuccess_ty_from_ptr(uint64_t ptr) {
12792         LDKSendSuccess *obj = (LDKSendSuccess*)untag_ptr(ptr);
12793         switch(obj->tag) {
12794                 case LDKSendSuccess_Buffered: return 0;
12795                 case LDKSendSuccess_BufferedAwaitingConnection: return 1;
12796                 default: abort();
12797         }
12798 }
12799 int8_tArray __attribute__((export_name("TS_LDKSendSuccess_BufferedAwaitingConnection_get_buffered_awaiting_connection"))) TS_LDKSendSuccess_BufferedAwaitingConnection_get_buffered_awaiting_connection(uint64_t ptr) {
12800         LDKSendSuccess *obj = (LDKSendSuccess*)untag_ptr(ptr);
12801         assert(obj->tag == LDKSendSuccess_BufferedAwaitingConnection);
12802         int8_tArray buffered_awaiting_connection_arr = init_int8_tArray(33, __LINE__);
12803         memcpy(buffered_awaiting_connection_arr->elems, obj->buffered_awaiting_connection.compressed_form, 33);
12804         return buffered_awaiting_connection_arr;
12805 }
12806 static inline struct LDKSendSuccess CResult_SendSuccessSendErrorZ_get_ok(LDKCResult_SendSuccessSendErrorZ *NONNULL_PTR owner){
12807 CHECK(owner->result_ok);
12808         return SendSuccess_clone(&*owner->contents.result);
12809 }
12810 uint64_t  __attribute__((export_name("TS_CResult_SendSuccessSendErrorZ_get_ok"))) TS_CResult_SendSuccessSendErrorZ_get_ok(uint64_t owner) {
12811         LDKCResult_SendSuccessSendErrorZ* owner_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(owner);
12812         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
12813         *ret_copy = CResult_SendSuccessSendErrorZ_get_ok(owner_conv);
12814         uint64_t ret_ref = tag_ptr(ret_copy, true);
12815         return ret_ref;
12816 }
12817
12818 static inline struct LDKSendError CResult_SendSuccessSendErrorZ_get_err(LDKCResult_SendSuccessSendErrorZ *NONNULL_PTR owner){
12819 CHECK(!owner->result_ok);
12820         return SendError_clone(&*owner->contents.err);
12821 }
12822 uint64_t  __attribute__((export_name("TS_CResult_SendSuccessSendErrorZ_get_err"))) TS_CResult_SendSuccessSendErrorZ_get_err(uint64_t owner) {
12823         LDKCResult_SendSuccessSendErrorZ* owner_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(owner);
12824         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
12825         *ret_copy = CResult_SendSuccessSendErrorZ_get_err(owner_conv);
12826         uint64_t ret_ref = tag_ptr(ret_copy, true);
12827         return ret_ref;
12828 }
12829
12830 static inline struct LDKBlindedPath CResult_BlindedPathNoneZ_get_ok(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
12831         LDKBlindedPath ret = *owner->contents.result;
12832         ret.is_owned = false;
12833         return ret;
12834 }
12835 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_get_ok"))) TS_CResult_BlindedPathNoneZ_get_ok(uint64_t owner) {
12836         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
12837         LDKBlindedPath ret_var = CResult_BlindedPathNoneZ_get_ok(owner_conv);
12838         uint64_t ret_ref = 0;
12839         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12840         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12841         return ret_ref;
12842 }
12843
12844 static inline void CResult_BlindedPathNoneZ_get_err(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
12845 CHECK(!owner->result_ok);
12846         return *owner->contents.err;
12847 }
12848 void  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_get_err"))) TS_CResult_BlindedPathNoneZ_get_err(uint64_t owner) {
12849         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
12850         CResult_BlindedPathNoneZ_get_err(owner_conv);
12851 }
12852
12853 static inline struct LDKC2Tuple_BlindedPayInfoBlindedPathZ CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR owner){
12854 CHECK(owner->result_ok);
12855         return C2Tuple_BlindedPayInfoBlindedPathZ_clone(&*owner->contents.result);
12856 }
12857 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(uint64_t owner) {
12858         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* owner_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(owner);
12859         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
12860         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(owner_conv);
12861         return tag_ptr(ret_conv, true);
12862 }
12863
12864 static inline void CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR owner){
12865 CHECK(!owner->result_ok);
12866         return *owner->contents.err;
12867 }
12868 void  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(uint64_t owner) {
12869         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* owner_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(owner);
12870         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(owner_conv);
12871 }
12872
12873 static inline LDKCVec_ForwardNodeZ CVec_ForwardNodeZ_clone(const LDKCVec_ForwardNodeZ *orig) {
12874         LDKCVec_ForwardNodeZ ret = { .data = MALLOC(sizeof(LDKForwardNode) * orig->datalen, "LDKCVec_ForwardNodeZ clone bytes"), .datalen = orig->datalen };
12875         for (size_t i = 0; i < ret.datalen; i++) {
12876                 ret.data[i] = ForwardNode_clone(&orig->data[i]);
12877         }
12878         return ret;
12879 }
12880 static inline struct LDKBlindedPath CResult_BlindedPathDecodeErrorZ_get_ok(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
12881         LDKBlindedPath ret = *owner->contents.result;
12882         ret.is_owned = false;
12883         return ret;
12884 }
12885 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_get_ok"))) TS_CResult_BlindedPathDecodeErrorZ_get_ok(uint64_t owner) {
12886         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
12887         LDKBlindedPath ret_var = CResult_BlindedPathDecodeErrorZ_get_ok(owner_conv);
12888         uint64_t ret_ref = 0;
12889         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12890         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12891         return ret_ref;
12892 }
12893
12894 static inline struct LDKDecodeError CResult_BlindedPathDecodeErrorZ_get_err(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
12895 CHECK(!owner->result_ok);
12896         return DecodeError_clone(&*owner->contents.err);
12897 }
12898 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_get_err"))) TS_CResult_BlindedPathDecodeErrorZ_get_err(uint64_t owner) {
12899         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
12900         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12901         *ret_copy = CResult_BlindedPathDecodeErrorZ_get_err(owner_conv);
12902         uint64_t ret_ref = tag_ptr(ret_copy, true);
12903         return ret_ref;
12904 }
12905
12906 static inline struct LDKBlindedHop CResult_BlindedHopDecodeErrorZ_get_ok(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
12907         LDKBlindedHop ret = *owner->contents.result;
12908         ret.is_owned = false;
12909         return ret;
12910 }
12911 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_get_ok"))) TS_CResult_BlindedHopDecodeErrorZ_get_ok(uint64_t owner) {
12912         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
12913         LDKBlindedHop ret_var = CResult_BlindedHopDecodeErrorZ_get_ok(owner_conv);
12914         uint64_t ret_ref = 0;
12915         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12916         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12917         return ret_ref;
12918 }
12919
12920 static inline struct LDKDecodeError CResult_BlindedHopDecodeErrorZ_get_err(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
12921 CHECK(!owner->result_ok);
12922         return DecodeError_clone(&*owner->contents.err);
12923 }
12924 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_get_err"))) TS_CResult_BlindedHopDecodeErrorZ_get_err(uint64_t owner) {
12925         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
12926         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12927         *ret_copy = CResult_BlindedHopDecodeErrorZ_get_err(owner_conv);
12928         uint64_t ret_ref = tag_ptr(ret_copy, true);
12929         return ret_ref;
12930 }
12931
12932 static inline struct LDKInvoiceError CResult_InvoiceErrorDecodeErrorZ_get_ok(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR owner){
12933         LDKInvoiceError ret = *owner->contents.result;
12934         ret.is_owned = false;
12935         return ret;
12936 }
12937 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_get_ok"))) TS_CResult_InvoiceErrorDecodeErrorZ_get_ok(uint64_t owner) {
12938         LDKCResult_InvoiceErrorDecodeErrorZ* owner_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(owner);
12939         LDKInvoiceError ret_var = CResult_InvoiceErrorDecodeErrorZ_get_ok(owner_conv);
12940         uint64_t ret_ref = 0;
12941         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12942         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12943         return ret_ref;
12944 }
12945
12946 static inline struct LDKDecodeError CResult_InvoiceErrorDecodeErrorZ_get_err(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR owner){
12947 CHECK(!owner->result_ok);
12948         return DecodeError_clone(&*owner->contents.err);
12949 }
12950 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_get_err"))) TS_CResult_InvoiceErrorDecodeErrorZ_get_err(uint64_t owner) {
12951         LDKCResult_InvoiceErrorDecodeErrorZ* owner_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(owner);
12952         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12953         *ret_copy = CResult_InvoiceErrorDecodeErrorZ_get_err(owner_conv);
12954         uint64_t ret_ref = tag_ptr(ret_copy, true);
12955         return ret_ref;
12956 }
12957
12958 static inline struct LDKTrackedSpendableOutput CResult_TrackedSpendableOutputDecodeErrorZ_get_ok(LDKCResult_TrackedSpendableOutputDecodeErrorZ *NONNULL_PTR owner){
12959         LDKTrackedSpendableOutput ret = *owner->contents.result;
12960         ret.is_owned = false;
12961         return ret;
12962 }
12963 uint64_t  __attribute__((export_name("TS_CResult_TrackedSpendableOutputDecodeErrorZ_get_ok"))) TS_CResult_TrackedSpendableOutputDecodeErrorZ_get_ok(uint64_t owner) {
12964         LDKCResult_TrackedSpendableOutputDecodeErrorZ* owner_conv = (LDKCResult_TrackedSpendableOutputDecodeErrorZ*)untag_ptr(owner);
12965         LDKTrackedSpendableOutput ret_var = CResult_TrackedSpendableOutputDecodeErrorZ_get_ok(owner_conv);
12966         uint64_t ret_ref = 0;
12967         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12968         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12969         return ret_ref;
12970 }
12971
12972 static inline struct LDKDecodeError CResult_TrackedSpendableOutputDecodeErrorZ_get_err(LDKCResult_TrackedSpendableOutputDecodeErrorZ *NONNULL_PTR owner){
12973 CHECK(!owner->result_ok);
12974         return DecodeError_clone(&*owner->contents.err);
12975 }
12976 uint64_t  __attribute__((export_name("TS_CResult_TrackedSpendableOutputDecodeErrorZ_get_err"))) TS_CResult_TrackedSpendableOutputDecodeErrorZ_get_err(uint64_t owner) {
12977         LDKCResult_TrackedSpendableOutputDecodeErrorZ* owner_conv = (LDKCResult_TrackedSpendableOutputDecodeErrorZ*)untag_ptr(owner);
12978         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12979         *ret_copy = CResult_TrackedSpendableOutputDecodeErrorZ_get_err(owner_conv);
12980         uint64_t ret_ref = tag_ptr(ret_copy, true);
12981         return ret_ref;
12982 }
12983
12984 uint32_t __attribute__((export_name("TS_LDKOutputSpendStatus_ty_from_ptr"))) TS_LDKOutputSpendStatus_ty_from_ptr(uint64_t ptr) {
12985         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
12986         switch(obj->tag) {
12987                 case LDKOutputSpendStatus_PendingInitialBroadcast: return 0;
12988                 case LDKOutputSpendStatus_PendingFirstConfirmation: return 1;
12989                 case LDKOutputSpendStatus_PendingThresholdConfirmations: return 2;
12990                 default: abort();
12991         }
12992 }
12993 uint64_t __attribute__((export_name("TS_LDKOutputSpendStatus_PendingInitialBroadcast_get_delayed_until_height"))) TS_LDKOutputSpendStatus_PendingInitialBroadcast_get_delayed_until_height(uint64_t ptr) {
12994         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
12995         assert(obj->tag == LDKOutputSpendStatus_PendingInitialBroadcast);
12996         uint64_t delayed_until_height_ref = tag_ptr(&obj->pending_initial_broadcast.delayed_until_height, false);
12997         return delayed_until_height_ref;
12998 }
12999 int8_tArray __attribute__((export_name("TS_LDKOutputSpendStatus_PendingFirstConfirmation_get_first_broadcast_hash"))) TS_LDKOutputSpendStatus_PendingFirstConfirmation_get_first_broadcast_hash(uint64_t ptr) {
13000         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
13001         assert(obj->tag == LDKOutputSpendStatus_PendingFirstConfirmation);
13002         int8_tArray first_broadcast_hash_arr = init_int8_tArray(32, __LINE__);
13003         memcpy(first_broadcast_hash_arr->elems, obj->pending_first_confirmation.first_broadcast_hash.data, 32);
13004         return first_broadcast_hash_arr;
13005 }
13006 int32_t __attribute__((export_name("TS_LDKOutputSpendStatus_PendingFirstConfirmation_get_latest_broadcast_height"))) TS_LDKOutputSpendStatus_PendingFirstConfirmation_get_latest_broadcast_height(uint64_t ptr) {
13007         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
13008         assert(obj->tag == LDKOutputSpendStatus_PendingFirstConfirmation);
13009         int32_t latest_broadcast_height_conv = obj->pending_first_confirmation.latest_broadcast_height;
13010         return latest_broadcast_height_conv;
13011 }
13012 int8_tArray __attribute__((export_name("TS_LDKOutputSpendStatus_PendingFirstConfirmation_get_latest_spending_tx"))) TS_LDKOutputSpendStatus_PendingFirstConfirmation_get_latest_spending_tx(uint64_t ptr) {
13013         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
13014         assert(obj->tag == LDKOutputSpendStatus_PendingFirstConfirmation);
13015         LDKTransaction latest_spending_tx_var = obj->pending_first_confirmation.latest_spending_tx;
13016                         int8_tArray latest_spending_tx_arr = init_int8_tArray(latest_spending_tx_var.datalen, __LINE__);
13017                         memcpy(latest_spending_tx_arr->elems, latest_spending_tx_var.data, latest_spending_tx_var.datalen);
13018         return latest_spending_tx_arr;
13019 }
13020 int8_tArray __attribute__((export_name("TS_LDKOutputSpendStatus_PendingThresholdConfirmations_get_first_broadcast_hash"))) TS_LDKOutputSpendStatus_PendingThresholdConfirmations_get_first_broadcast_hash(uint64_t ptr) {
13021         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
13022         assert(obj->tag == LDKOutputSpendStatus_PendingThresholdConfirmations);
13023         int8_tArray first_broadcast_hash_arr = init_int8_tArray(32, __LINE__);
13024         memcpy(first_broadcast_hash_arr->elems, obj->pending_threshold_confirmations.first_broadcast_hash.data, 32);
13025         return first_broadcast_hash_arr;
13026 }
13027 int32_t __attribute__((export_name("TS_LDKOutputSpendStatus_PendingThresholdConfirmations_get_latest_broadcast_height"))) TS_LDKOutputSpendStatus_PendingThresholdConfirmations_get_latest_broadcast_height(uint64_t ptr) {
13028         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
13029         assert(obj->tag == LDKOutputSpendStatus_PendingThresholdConfirmations);
13030         int32_t latest_broadcast_height_conv = obj->pending_threshold_confirmations.latest_broadcast_height;
13031         return latest_broadcast_height_conv;
13032 }
13033 int8_tArray __attribute__((export_name("TS_LDKOutputSpendStatus_PendingThresholdConfirmations_get_latest_spending_tx"))) TS_LDKOutputSpendStatus_PendingThresholdConfirmations_get_latest_spending_tx(uint64_t ptr) {
13034         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
13035         assert(obj->tag == LDKOutputSpendStatus_PendingThresholdConfirmations);
13036         LDKTransaction latest_spending_tx_var = obj->pending_threshold_confirmations.latest_spending_tx;
13037                         int8_tArray latest_spending_tx_arr = init_int8_tArray(latest_spending_tx_var.datalen, __LINE__);
13038                         memcpy(latest_spending_tx_arr->elems, latest_spending_tx_var.data, latest_spending_tx_var.datalen);
13039         return latest_spending_tx_arr;
13040 }
13041 int32_t __attribute__((export_name("TS_LDKOutputSpendStatus_PendingThresholdConfirmations_get_confirmation_height"))) TS_LDKOutputSpendStatus_PendingThresholdConfirmations_get_confirmation_height(uint64_t ptr) {
13042         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
13043         assert(obj->tag == LDKOutputSpendStatus_PendingThresholdConfirmations);
13044         int32_t confirmation_height_conv = obj->pending_threshold_confirmations.confirmation_height;
13045         return confirmation_height_conv;
13046 }
13047 int8_tArray __attribute__((export_name("TS_LDKOutputSpendStatus_PendingThresholdConfirmations_get_confirmation_hash"))) TS_LDKOutputSpendStatus_PendingThresholdConfirmations_get_confirmation_hash(uint64_t ptr) {
13048         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
13049         assert(obj->tag == LDKOutputSpendStatus_PendingThresholdConfirmations);
13050         int8_tArray confirmation_hash_arr = init_int8_tArray(32, __LINE__);
13051         memcpy(confirmation_hash_arr->elems, obj->pending_threshold_confirmations.confirmation_hash.data, 32);
13052         return confirmation_hash_arr;
13053 }
13054 static inline struct LDKOutputSpendStatus CResult_OutputSpendStatusDecodeErrorZ_get_ok(LDKCResult_OutputSpendStatusDecodeErrorZ *NONNULL_PTR owner){
13055 CHECK(owner->result_ok);
13056         return OutputSpendStatus_clone(&*owner->contents.result);
13057 }
13058 uint64_t  __attribute__((export_name("TS_CResult_OutputSpendStatusDecodeErrorZ_get_ok"))) TS_CResult_OutputSpendStatusDecodeErrorZ_get_ok(uint64_t owner) {
13059         LDKCResult_OutputSpendStatusDecodeErrorZ* owner_conv = (LDKCResult_OutputSpendStatusDecodeErrorZ*)untag_ptr(owner);
13060         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
13061         *ret_copy = CResult_OutputSpendStatusDecodeErrorZ_get_ok(owner_conv);
13062         uint64_t ret_ref = tag_ptr(ret_copy, true);
13063         return ret_ref;
13064 }
13065
13066 static inline struct LDKDecodeError CResult_OutputSpendStatusDecodeErrorZ_get_err(LDKCResult_OutputSpendStatusDecodeErrorZ *NONNULL_PTR owner){
13067 CHECK(!owner->result_ok);
13068         return DecodeError_clone(&*owner->contents.err);
13069 }
13070 uint64_t  __attribute__((export_name("TS_CResult_OutputSpendStatusDecodeErrorZ_get_err"))) TS_CResult_OutputSpendStatusDecodeErrorZ_get_err(uint64_t owner) {
13071         LDKCResult_OutputSpendStatusDecodeErrorZ* owner_conv = (LDKCResult_OutputSpendStatusDecodeErrorZ*)untag_ptr(owner);
13072         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13073         *ret_copy = CResult_OutputSpendStatusDecodeErrorZ_get_err(owner_conv);
13074         uint64_t ret_ref = tag_ptr(ret_copy, true);
13075         return ret_ref;
13076 }
13077
13078 typedef struct LDKFilter_JCalls {
13079         atomic_size_t refcnt;
13080         uint32_t instance_ptr;
13081 } LDKFilter_JCalls;
13082 static void LDKFilter_JCalls_free(void* this_arg) {
13083         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
13084         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13085                 FREE(j_calls);
13086         }
13087 }
13088 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
13089         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
13090         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
13091         memcpy(txid_arr->elems, *txid, 32);
13092         LDKu8slice script_pubkey_var = script_pubkey;
13093         int8_tArray script_pubkey_arr = init_int8_tArray(script_pubkey_var.datalen, __LINE__);
13094         memcpy(script_pubkey_arr->elems, script_pubkey_var.data, script_pubkey_var.datalen);
13095         js_invoke_function_uuuuuu(j_calls->instance_ptr, 47, (uint32_t)txid_arr, (uint32_t)script_pubkey_arr, 0, 0, 0, 0);
13096 }
13097 void register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
13098         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
13099         LDKWatchedOutput output_var = output;
13100         uint64_t output_ref = 0;
13101         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
13102         output_ref = tag_ptr(output_var.inner, output_var.is_owned);
13103         js_invoke_function_buuuuu(j_calls->instance_ptr, 48, output_ref, 0, 0, 0, 0, 0);
13104 }
13105 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
13106         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
13107         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13108 }
13109 static inline LDKFilter LDKFilter_init (JSValue o) {
13110         LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
13111         atomic_init(&calls->refcnt, 1);
13112         calls->instance_ptr = o;
13113
13114         LDKFilter ret = {
13115                 .this_arg = (void*) calls,
13116                 .register_tx = register_tx_LDKFilter_jcall,
13117                 .register_output = register_output_LDKFilter_jcall,
13118                 .free = LDKFilter_JCalls_free,
13119         };
13120         return ret;
13121 }
13122 uint64_t  __attribute__((export_name("TS_LDKFilter_new"))) TS_LDKFilter_new(JSValue o) {
13123         LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
13124         *res_ptr = LDKFilter_init(o);
13125         return tag_ptr(res_ptr, true);
13126 }
13127 void  __attribute__((export_name("TS_Filter_register_tx"))) TS_Filter_register_tx(uint64_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
13128         void* this_arg_ptr = untag_ptr(this_arg);
13129         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13130         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
13131         uint8_t txid_arr[32];
13132         CHECK(txid->arr_len == 32);
13133         memcpy(txid_arr, txid->elems, 32); FREE(txid);
13134         uint8_t (*txid_ref)[32] = &txid_arr;
13135         LDKu8slice script_pubkey_ref;
13136         script_pubkey_ref.datalen = script_pubkey->arr_len;
13137         script_pubkey_ref.data = script_pubkey->elems;
13138         (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
13139         FREE(script_pubkey);
13140 }
13141
13142 void  __attribute__((export_name("TS_Filter_register_output"))) TS_Filter_register_output(uint64_t this_arg, uint64_t output) {
13143         void* this_arg_ptr = untag_ptr(this_arg);
13144         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13145         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
13146         LDKWatchedOutput output_conv;
13147         output_conv.inner = untag_ptr(output);
13148         output_conv.is_owned = ptr_is_owned(output);
13149         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
13150         output_conv = WatchedOutput_clone(&output_conv);
13151         (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
13152 }
13153
13154 uint32_t __attribute__((export_name("TS_LDKCOption_FilterZ_ty_from_ptr"))) TS_LDKCOption_FilterZ_ty_from_ptr(uint64_t ptr) {
13155         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
13156         switch(obj->tag) {
13157                 case LDKCOption_FilterZ_Some: return 0;
13158                 case LDKCOption_FilterZ_None: return 1;
13159                 default: abort();
13160         }
13161 }
13162 uint64_t __attribute__((export_name("TS_LDKCOption_FilterZ_Some_get_some"))) TS_LDKCOption_FilterZ_Some_get_some(uint64_t ptr) {
13163         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
13164         assert(obj->tag == LDKCOption_FilterZ_Some);
13165         LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
13166         *some_ret = obj->some;
13167                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
13168                         if ((*some_ret).free == LDKFilter_JCalls_free) {
13169                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13170                                 LDKFilter_JCalls_cloned(&(*some_ret));
13171                         }
13172         return tag_ptr(some_ret, true);
13173 }
13174 static inline LDKCVec_TrackedSpendableOutputZ CVec_TrackedSpendableOutputZ_clone(const LDKCVec_TrackedSpendableOutputZ *orig) {
13175         LDKCVec_TrackedSpendableOutputZ ret = { .data = MALLOC(sizeof(LDKTrackedSpendableOutput) * orig->datalen, "LDKCVec_TrackedSpendableOutputZ clone bytes"), .datalen = orig->datalen };
13176         for (size_t i = 0; i < ret.datalen; i++) {
13177                 ret.data[i] = TrackedSpendableOutput_clone(&orig->data[i]);
13178         }
13179         return ret;
13180 }
13181 typedef struct LDKChangeDestinationSource_JCalls {
13182         atomic_size_t refcnt;
13183         uint32_t instance_ptr;
13184 } LDKChangeDestinationSource_JCalls;
13185 static void LDKChangeDestinationSource_JCalls_free(void* this_arg) {
13186         LDKChangeDestinationSource_JCalls *j_calls = (LDKChangeDestinationSource_JCalls*) this_arg;
13187         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13188                 FREE(j_calls);
13189         }
13190 }
13191 LDKCResult_CVec_u8ZNoneZ get_change_destination_script_LDKChangeDestinationSource_jcall(const void* this_arg) {
13192         LDKChangeDestinationSource_JCalls *j_calls = (LDKChangeDestinationSource_JCalls*) this_arg;
13193         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 49, 0, 0, 0, 0, 0, 0);
13194         void* ret_ptr = untag_ptr(ret);
13195         CHECK_ACCESS(ret_ptr);
13196         LDKCResult_CVec_u8ZNoneZ ret_conv = *(LDKCResult_CVec_u8ZNoneZ*)(ret_ptr);
13197         FREE(untag_ptr(ret));
13198         return ret_conv;
13199 }
13200 static void LDKChangeDestinationSource_JCalls_cloned(LDKChangeDestinationSource* new_obj) {
13201         LDKChangeDestinationSource_JCalls *j_calls = (LDKChangeDestinationSource_JCalls*) new_obj->this_arg;
13202         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13203 }
13204 static inline LDKChangeDestinationSource LDKChangeDestinationSource_init (JSValue o) {
13205         LDKChangeDestinationSource_JCalls *calls = MALLOC(sizeof(LDKChangeDestinationSource_JCalls), "LDKChangeDestinationSource_JCalls");
13206         atomic_init(&calls->refcnt, 1);
13207         calls->instance_ptr = o;
13208
13209         LDKChangeDestinationSource ret = {
13210                 .this_arg = (void*) calls,
13211                 .get_change_destination_script = get_change_destination_script_LDKChangeDestinationSource_jcall,
13212                 .free = LDKChangeDestinationSource_JCalls_free,
13213         };
13214         return ret;
13215 }
13216 uint64_t  __attribute__((export_name("TS_LDKChangeDestinationSource_new"))) TS_LDKChangeDestinationSource_new(JSValue o) {
13217         LDKChangeDestinationSource *res_ptr = MALLOC(sizeof(LDKChangeDestinationSource), "LDKChangeDestinationSource");
13218         *res_ptr = LDKChangeDestinationSource_init(o);
13219         return tag_ptr(res_ptr, true);
13220 }
13221 uint64_t  __attribute__((export_name("TS_ChangeDestinationSource_get_change_destination_script"))) TS_ChangeDestinationSource_get_change_destination_script(uint64_t this_arg) {
13222         void* this_arg_ptr = untag_ptr(this_arg);
13223         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13224         LDKChangeDestinationSource* this_arg_conv = (LDKChangeDestinationSource*)this_arg_ptr;
13225         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
13226         *ret_conv = (this_arg_conv->get_change_destination_script)(this_arg_conv->this_arg);
13227         return tag_ptr(ret_conv, true);
13228 }
13229
13230 typedef struct LDKKVStore_JCalls {
13231         atomic_size_t refcnt;
13232         uint32_t instance_ptr;
13233 } LDKKVStore_JCalls;
13234 static void LDKKVStore_JCalls_free(void* this_arg) {
13235         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
13236         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13237                 FREE(j_calls);
13238         }
13239 }
13240 LDKCResult_CVec_u8ZIOErrorZ read_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key) {
13241         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
13242         LDKStr primary_namespace_str = primary_namespace;
13243         jstring primary_namespace_conv = str_ref_to_ts(primary_namespace_str.chars, primary_namespace_str.len);
13244         Str_free(primary_namespace_str);
13245         LDKStr secondary_namespace_str = secondary_namespace;
13246         jstring secondary_namespace_conv = str_ref_to_ts(secondary_namespace_str.chars, secondary_namespace_str.len);
13247         Str_free(secondary_namespace_str);
13248         LDKStr key_str = key;
13249         jstring key_conv = str_ref_to_ts(key_str.chars, key_str.len);
13250         Str_free(key_str);
13251         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 50, primary_namespace_conv, secondary_namespace_conv, key_conv, 0, 0, 0);
13252         void* ret_ptr = untag_ptr(ret);
13253         CHECK_ACCESS(ret_ptr);
13254         LDKCResult_CVec_u8ZIOErrorZ ret_conv = *(LDKCResult_CVec_u8ZIOErrorZ*)(ret_ptr);
13255         FREE(untag_ptr(ret));
13256         return ret_conv;
13257 }
13258 LDKCResult_NoneIOErrorZ write_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key, LDKu8slice buf) {
13259         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
13260         LDKStr primary_namespace_str = primary_namespace;
13261         jstring primary_namespace_conv = str_ref_to_ts(primary_namespace_str.chars, primary_namespace_str.len);
13262         Str_free(primary_namespace_str);
13263         LDKStr secondary_namespace_str = secondary_namespace;
13264         jstring secondary_namespace_conv = str_ref_to_ts(secondary_namespace_str.chars, secondary_namespace_str.len);
13265         Str_free(secondary_namespace_str);
13266         LDKStr key_str = key;
13267         jstring key_conv = str_ref_to_ts(key_str.chars, key_str.len);
13268         Str_free(key_str);
13269         LDKu8slice buf_var = buf;
13270         int8_tArray buf_arr = init_int8_tArray(buf_var.datalen, __LINE__);
13271         memcpy(buf_arr->elems, buf_var.data, buf_var.datalen);
13272         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);
13273         void* ret_ptr = untag_ptr(ret);
13274         CHECK_ACCESS(ret_ptr);
13275         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
13276         FREE(untag_ptr(ret));
13277         return ret_conv;
13278 }
13279 LDKCResult_NoneIOErrorZ remove_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key, bool lazy) {
13280         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
13281         LDKStr primary_namespace_str = primary_namespace;
13282         jstring primary_namespace_conv = str_ref_to_ts(primary_namespace_str.chars, primary_namespace_str.len);
13283         Str_free(primary_namespace_str);
13284         LDKStr secondary_namespace_str = secondary_namespace;
13285         jstring secondary_namespace_conv = str_ref_to_ts(secondary_namespace_str.chars, secondary_namespace_str.len);
13286         Str_free(secondary_namespace_str);
13287         LDKStr key_str = key;
13288         jstring key_conv = str_ref_to_ts(key_str.chars, key_str.len);
13289         Str_free(key_str);
13290         jboolean lazy_conv = lazy;
13291         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 52, primary_namespace_conv, secondary_namespace_conv, key_conv, lazy_conv, 0, 0);
13292         void* ret_ptr = untag_ptr(ret);
13293         CHECK_ACCESS(ret_ptr);
13294         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
13295         FREE(untag_ptr(ret));
13296         return ret_conv;
13297 }
13298 LDKCResult_CVec_StrZIOErrorZ list_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace) {
13299         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
13300         LDKStr primary_namespace_str = primary_namespace;
13301         jstring primary_namespace_conv = str_ref_to_ts(primary_namespace_str.chars, primary_namespace_str.len);
13302         Str_free(primary_namespace_str);
13303         LDKStr secondary_namespace_str = secondary_namespace;
13304         jstring secondary_namespace_conv = str_ref_to_ts(secondary_namespace_str.chars, secondary_namespace_str.len);
13305         Str_free(secondary_namespace_str);
13306         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 53, primary_namespace_conv, secondary_namespace_conv, 0, 0, 0, 0);
13307         void* ret_ptr = untag_ptr(ret);
13308         CHECK_ACCESS(ret_ptr);
13309         LDKCResult_CVec_StrZIOErrorZ ret_conv = *(LDKCResult_CVec_StrZIOErrorZ*)(ret_ptr);
13310         FREE(untag_ptr(ret));
13311         return ret_conv;
13312 }
13313 static void LDKKVStore_JCalls_cloned(LDKKVStore* new_obj) {
13314         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) new_obj->this_arg;
13315         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13316 }
13317 static inline LDKKVStore LDKKVStore_init (JSValue o) {
13318         LDKKVStore_JCalls *calls = MALLOC(sizeof(LDKKVStore_JCalls), "LDKKVStore_JCalls");
13319         atomic_init(&calls->refcnt, 1);
13320         calls->instance_ptr = o;
13321
13322         LDKKVStore ret = {
13323                 .this_arg = (void*) calls,
13324                 .read = read_LDKKVStore_jcall,
13325                 .write = write_LDKKVStore_jcall,
13326                 .remove = remove_LDKKVStore_jcall,
13327                 .list = list_LDKKVStore_jcall,
13328                 .free = LDKKVStore_JCalls_free,
13329         };
13330         return ret;
13331 }
13332 uint64_t  __attribute__((export_name("TS_LDKKVStore_new"))) TS_LDKKVStore_new(JSValue o) {
13333         LDKKVStore *res_ptr = MALLOC(sizeof(LDKKVStore), "LDKKVStore");
13334         *res_ptr = LDKKVStore_init(o);
13335         return tag_ptr(res_ptr, true);
13336 }
13337 uint64_t  __attribute__((export_name("TS_KVStore_read"))) TS_KVStore_read(uint64_t this_arg, jstring primary_namespace, jstring secondary_namespace, jstring key) {
13338         void* this_arg_ptr = untag_ptr(this_arg);
13339         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13340         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
13341         LDKStr primary_namespace_conv = str_ref_to_owned_c(primary_namespace);
13342         LDKStr secondary_namespace_conv = str_ref_to_owned_c(secondary_namespace);
13343         LDKStr key_conv = str_ref_to_owned_c(key);
13344         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
13345         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv);
13346         return tag_ptr(ret_conv, true);
13347 }
13348
13349 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) {
13350         void* this_arg_ptr = untag_ptr(this_arg);
13351         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13352         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
13353         LDKStr primary_namespace_conv = str_ref_to_owned_c(primary_namespace);
13354         LDKStr secondary_namespace_conv = str_ref_to_owned_c(secondary_namespace);
13355         LDKStr key_conv = str_ref_to_owned_c(key);
13356         LDKu8slice buf_ref;
13357         buf_ref.datalen = buf->arr_len;
13358         buf_ref.data = buf->elems;
13359         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
13360         *ret_conv = (this_arg_conv->write)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv, buf_ref);
13361         FREE(buf);
13362         return tag_ptr(ret_conv, true);
13363 }
13364
13365 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) {
13366         void* this_arg_ptr = untag_ptr(this_arg);
13367         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13368         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
13369         LDKStr primary_namespace_conv = str_ref_to_owned_c(primary_namespace);
13370         LDKStr secondary_namespace_conv = str_ref_to_owned_c(secondary_namespace);
13371         LDKStr key_conv = str_ref_to_owned_c(key);
13372         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
13373         *ret_conv = (this_arg_conv->remove)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv, lazy);
13374         return tag_ptr(ret_conv, true);
13375 }
13376
13377 uint64_t  __attribute__((export_name("TS_KVStore_list"))) TS_KVStore_list(uint64_t this_arg, jstring primary_namespace, jstring secondary_namespace) {
13378         void* this_arg_ptr = untag_ptr(this_arg);
13379         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13380         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
13381         LDKStr primary_namespace_conv = str_ref_to_owned_c(primary_namespace);
13382         LDKStr secondary_namespace_conv = str_ref_to_owned_c(secondary_namespace);
13383         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
13384         *ret_conv = (this_arg_conv->list)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv);
13385         return tag_ptr(ret_conv, true);
13386 }
13387
13388 typedef struct LDKOutputSpender_JCalls {
13389         atomic_size_t refcnt;
13390         uint32_t instance_ptr;
13391 } LDKOutputSpender_JCalls;
13392 static void LDKOutputSpender_JCalls_free(void* this_arg) {
13393         LDKOutputSpender_JCalls *j_calls = (LDKOutputSpender_JCalls*) this_arg;
13394         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13395                 FREE(j_calls);
13396         }
13397 }
13398 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) {
13399         LDKOutputSpender_JCalls *j_calls = (LDKOutputSpender_JCalls*) this_arg;
13400         LDKCVec_SpendableOutputDescriptorZ descriptors_var = descriptors;
13401         uint64_tArray descriptors_arr = NULL;
13402         descriptors_arr = init_uint64_tArray(descriptors_var.datalen, __LINE__);
13403         uint64_t *descriptors_arr_ptr = (uint64_t*)(((uint8_t*)descriptors_arr) + 8);
13404         for (size_t b = 0; b < descriptors_var.datalen; b++) {
13405                 LDKSpendableOutputDescriptor *descriptors_conv_27_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
13406                 *descriptors_conv_27_copy = descriptors_var.data[b];
13407                 uint64_t descriptors_conv_27_ref = tag_ptr(descriptors_conv_27_copy, true);
13408                 descriptors_arr_ptr[b] = descriptors_conv_27_ref;
13409         }
13410         
13411         FREE(descriptors_var.data);
13412         LDKCVec_TxOutZ outputs_var = outputs;
13413         uint64_tArray outputs_arr = NULL;
13414         outputs_arr = init_uint64_tArray(outputs_var.datalen, __LINE__);
13415         uint64_t *outputs_arr_ptr = (uint64_t*)(((uint8_t*)outputs_arr) + 8);
13416         for (size_t h = 0; h < outputs_var.datalen; h++) {
13417                 LDKTxOut* outputs_conv_7_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
13418                 *outputs_conv_7_ref = outputs_var.data[h];
13419                 outputs_arr_ptr[h] = tag_ptr(outputs_conv_7_ref, true);
13420         }
13421         
13422         FREE(outputs_var.data);
13423         LDKCVec_u8Z change_destination_script_var = change_destination_script;
13424         int8_tArray change_destination_script_arr = init_int8_tArray(change_destination_script_var.datalen, __LINE__);
13425         memcpy(change_destination_script_arr->elems, change_destination_script_var.data, change_destination_script_var.datalen);
13426         CVec_u8Z_free(change_destination_script_var);
13427         int32_t feerate_sat_per_1000_weight_conv = feerate_sat_per_1000_weight;
13428         LDKCOption_u32Z *locktime_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
13429         *locktime_copy = locktime;
13430         uint64_t locktime_ref = tag_ptr(locktime_copy, true);
13431         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);
13432         void* ret_ptr = untag_ptr(ret);
13433         CHECK_ACCESS(ret_ptr);
13434         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
13435         FREE(untag_ptr(ret));
13436         return ret_conv;
13437 }
13438 static void LDKOutputSpender_JCalls_cloned(LDKOutputSpender* new_obj) {
13439         LDKOutputSpender_JCalls *j_calls = (LDKOutputSpender_JCalls*) new_obj->this_arg;
13440         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13441 }
13442 static inline LDKOutputSpender LDKOutputSpender_init (JSValue o) {
13443         LDKOutputSpender_JCalls *calls = MALLOC(sizeof(LDKOutputSpender_JCalls), "LDKOutputSpender_JCalls");
13444         atomic_init(&calls->refcnt, 1);
13445         calls->instance_ptr = o;
13446
13447         LDKOutputSpender ret = {
13448                 .this_arg = (void*) calls,
13449                 .spend_spendable_outputs = spend_spendable_outputs_LDKOutputSpender_jcall,
13450                 .free = LDKOutputSpender_JCalls_free,
13451         };
13452         return ret;
13453 }
13454 uint64_t  __attribute__((export_name("TS_LDKOutputSpender_new"))) TS_LDKOutputSpender_new(JSValue o) {
13455         LDKOutputSpender *res_ptr = MALLOC(sizeof(LDKOutputSpender), "LDKOutputSpender");
13456         *res_ptr = LDKOutputSpender_init(o);
13457         return tag_ptr(res_ptr, true);
13458 }
13459 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) {
13460         void* this_arg_ptr = untag_ptr(this_arg);
13461         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13462         LDKOutputSpender* this_arg_conv = (LDKOutputSpender*)this_arg_ptr;
13463         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
13464         descriptors_constr.datalen = descriptors->arr_len;
13465         if (descriptors_constr.datalen > 0)
13466                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
13467         else
13468                 descriptors_constr.data = NULL;
13469         uint64_t* descriptors_vals = descriptors->elems;
13470         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
13471                 uint64_t descriptors_conv_27 = descriptors_vals[b];
13472                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
13473                 CHECK_ACCESS(descriptors_conv_27_ptr);
13474                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
13475                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
13476                 descriptors_constr.data[b] = descriptors_conv_27_conv;
13477         }
13478         FREE(descriptors);
13479         LDKCVec_TxOutZ outputs_constr;
13480         outputs_constr.datalen = outputs->arr_len;
13481         if (outputs_constr.datalen > 0)
13482                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
13483         else
13484                 outputs_constr.data = NULL;
13485         uint64_t* outputs_vals = outputs->elems;
13486         for (size_t h = 0; h < outputs_constr.datalen; h++) {
13487                 uint64_t outputs_conv_7 = outputs_vals[h];
13488                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
13489                 CHECK_ACCESS(outputs_conv_7_ptr);
13490                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
13491                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
13492                 outputs_constr.data[h] = outputs_conv_7_conv;
13493         }
13494         FREE(outputs);
13495         LDKCVec_u8Z change_destination_script_ref;
13496         change_destination_script_ref.datalen = change_destination_script->arr_len;
13497         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
13498         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
13499         void* locktime_ptr = untag_ptr(locktime);
13500         CHECK_ACCESS(locktime_ptr);
13501         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
13502         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
13503         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
13504         *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);
13505         return tag_ptr(ret_conv, true);
13506 }
13507
13508 static inline struct LDKOutputSweeper CResult_OutputSweeperDecodeErrorZ_get_ok(LDKCResult_OutputSweeperDecodeErrorZ *NONNULL_PTR owner){
13509         LDKOutputSweeper ret = *owner->contents.result;
13510         ret.is_owned = false;
13511         return ret;
13512 }
13513 uint64_t  __attribute__((export_name("TS_CResult_OutputSweeperDecodeErrorZ_get_ok"))) TS_CResult_OutputSweeperDecodeErrorZ_get_ok(uint64_t owner) {
13514         LDKCResult_OutputSweeperDecodeErrorZ* owner_conv = (LDKCResult_OutputSweeperDecodeErrorZ*)untag_ptr(owner);
13515         LDKOutputSweeper ret_var = CResult_OutputSweeperDecodeErrorZ_get_ok(owner_conv);
13516         uint64_t ret_ref = 0;
13517         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13518         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13519         return ret_ref;
13520 }
13521
13522 static inline struct LDKDecodeError CResult_OutputSweeperDecodeErrorZ_get_err(LDKCResult_OutputSweeperDecodeErrorZ *NONNULL_PTR owner){
13523 CHECK(!owner->result_ok);
13524         return DecodeError_clone(&*owner->contents.err);
13525 }
13526 uint64_t  __attribute__((export_name("TS_CResult_OutputSweeperDecodeErrorZ_get_err"))) TS_CResult_OutputSweeperDecodeErrorZ_get_err(uint64_t owner) {
13527         LDKCResult_OutputSweeperDecodeErrorZ* owner_conv = (LDKCResult_OutputSweeperDecodeErrorZ*)untag_ptr(owner);
13528         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13529         *ret_copy = CResult_OutputSweeperDecodeErrorZ_get_err(owner_conv);
13530         uint64_t ret_ref = tag_ptr(ret_copy, true);
13531         return ret_ref;
13532 }
13533
13534 static inline struct LDKBestBlock C2Tuple_BestBlockOutputSweeperZ_get_a(LDKC2Tuple_BestBlockOutputSweeperZ *NONNULL_PTR owner){
13535         LDKBestBlock ret = owner->a;
13536         ret.is_owned = false;
13537         return ret;
13538 }
13539 uint64_t  __attribute__((export_name("TS_C2Tuple_BestBlockOutputSweeperZ_get_a"))) TS_C2Tuple_BestBlockOutputSweeperZ_get_a(uint64_t owner) {
13540         LDKC2Tuple_BestBlockOutputSweeperZ* owner_conv = (LDKC2Tuple_BestBlockOutputSweeperZ*)untag_ptr(owner);
13541         LDKBestBlock ret_var = C2Tuple_BestBlockOutputSweeperZ_get_a(owner_conv);
13542         uint64_t ret_ref = 0;
13543         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13544         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13545         return ret_ref;
13546 }
13547
13548 static inline struct LDKOutputSweeper C2Tuple_BestBlockOutputSweeperZ_get_b(LDKC2Tuple_BestBlockOutputSweeperZ *NONNULL_PTR owner){
13549         LDKOutputSweeper ret = owner->b;
13550         ret.is_owned = false;
13551         return ret;
13552 }
13553 uint64_t  __attribute__((export_name("TS_C2Tuple_BestBlockOutputSweeperZ_get_b"))) TS_C2Tuple_BestBlockOutputSweeperZ_get_b(uint64_t owner) {
13554         LDKC2Tuple_BestBlockOutputSweeperZ* owner_conv = (LDKC2Tuple_BestBlockOutputSweeperZ*)untag_ptr(owner);
13555         LDKOutputSweeper ret_var = C2Tuple_BestBlockOutputSweeperZ_get_b(owner_conv);
13556         uint64_t ret_ref = 0;
13557         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13558         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13559         return ret_ref;
13560 }
13561
13562 static inline struct LDKC2Tuple_BestBlockOutputSweeperZ *CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ *NONNULL_PTR owner){
13563 CHECK(owner->result_ok);
13564         return &*owner->contents.result;
13565 }
13566 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_get_ok(uint64_t owner) {
13567         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ*)untag_ptr(owner);
13568         uint64_t ret_ret = tag_ptr(CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_get_ok(owner_conv), false);
13569         return ret_ret;
13570 }
13571
13572 static inline struct LDKDecodeError CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ *NONNULL_PTR owner){
13573 CHECK(!owner->result_ok);
13574         return DecodeError_clone(&*owner->contents.err);
13575 }
13576 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_get_err(uint64_t owner) {
13577         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ*)untag_ptr(owner);
13578         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13579         *ret_copy = CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_get_err(owner_conv);
13580         uint64_t ret_ref = tag_ptr(ret_copy, true);
13581         return ret_ref;
13582 }
13583
13584 static inline struct LDKDelayedPaymentBasepoint CResult_DelayedPaymentBasepointDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentBasepointDecodeErrorZ *NONNULL_PTR owner){
13585         LDKDelayedPaymentBasepoint ret = *owner->contents.result;
13586         ret.is_owned = false;
13587         return ret;
13588 }
13589 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentBasepointDecodeErrorZ_get_ok"))) TS_CResult_DelayedPaymentBasepointDecodeErrorZ_get_ok(uint64_t owner) {
13590         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(owner);
13591         LDKDelayedPaymentBasepoint ret_var = CResult_DelayedPaymentBasepointDecodeErrorZ_get_ok(owner_conv);
13592         uint64_t ret_ref = 0;
13593         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13594         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13595         return ret_ref;
13596 }
13597
13598 static inline struct LDKDecodeError CResult_DelayedPaymentBasepointDecodeErrorZ_get_err(LDKCResult_DelayedPaymentBasepointDecodeErrorZ *NONNULL_PTR owner){
13599 CHECK(!owner->result_ok);
13600         return DecodeError_clone(&*owner->contents.err);
13601 }
13602 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentBasepointDecodeErrorZ_get_err"))) TS_CResult_DelayedPaymentBasepointDecodeErrorZ_get_err(uint64_t owner) {
13603         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(owner);
13604         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13605         *ret_copy = CResult_DelayedPaymentBasepointDecodeErrorZ_get_err(owner_conv);
13606         uint64_t ret_ref = tag_ptr(ret_copy, true);
13607         return ret_ref;
13608 }
13609
13610 static inline struct LDKDelayedPaymentKey CResult_DelayedPaymentKeyDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentKeyDecodeErrorZ *NONNULL_PTR owner){
13611         LDKDelayedPaymentKey ret = *owner->contents.result;
13612         ret.is_owned = false;
13613         return ret;
13614 }
13615 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentKeyDecodeErrorZ_get_ok"))) TS_CResult_DelayedPaymentKeyDecodeErrorZ_get_ok(uint64_t owner) {
13616         LDKCResult_DelayedPaymentKeyDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(owner);
13617         LDKDelayedPaymentKey ret_var = CResult_DelayedPaymentKeyDecodeErrorZ_get_ok(owner_conv);
13618         uint64_t ret_ref = 0;
13619         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13620         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13621         return ret_ref;
13622 }
13623
13624 static inline struct LDKDecodeError CResult_DelayedPaymentKeyDecodeErrorZ_get_err(LDKCResult_DelayedPaymentKeyDecodeErrorZ *NONNULL_PTR owner){
13625 CHECK(!owner->result_ok);
13626         return DecodeError_clone(&*owner->contents.err);
13627 }
13628 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentKeyDecodeErrorZ_get_err"))) TS_CResult_DelayedPaymentKeyDecodeErrorZ_get_err(uint64_t owner) {
13629         LDKCResult_DelayedPaymentKeyDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(owner);
13630         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13631         *ret_copy = CResult_DelayedPaymentKeyDecodeErrorZ_get_err(owner_conv);
13632         uint64_t ret_ref = tag_ptr(ret_copy, true);
13633         return ret_ref;
13634 }
13635
13636 static inline struct LDKHtlcBasepoint CResult_HtlcBasepointDecodeErrorZ_get_ok(LDKCResult_HtlcBasepointDecodeErrorZ *NONNULL_PTR owner){
13637         LDKHtlcBasepoint ret = *owner->contents.result;
13638         ret.is_owned = false;
13639         return ret;
13640 }
13641 uint64_t  __attribute__((export_name("TS_CResult_HtlcBasepointDecodeErrorZ_get_ok"))) TS_CResult_HtlcBasepointDecodeErrorZ_get_ok(uint64_t owner) {
13642         LDKCResult_HtlcBasepointDecodeErrorZ* owner_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(owner);
13643         LDKHtlcBasepoint ret_var = CResult_HtlcBasepointDecodeErrorZ_get_ok(owner_conv);
13644         uint64_t ret_ref = 0;
13645         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13646         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13647         return ret_ref;
13648 }
13649
13650 static inline struct LDKDecodeError CResult_HtlcBasepointDecodeErrorZ_get_err(LDKCResult_HtlcBasepointDecodeErrorZ *NONNULL_PTR owner){
13651 CHECK(!owner->result_ok);
13652         return DecodeError_clone(&*owner->contents.err);
13653 }
13654 uint64_t  __attribute__((export_name("TS_CResult_HtlcBasepointDecodeErrorZ_get_err"))) TS_CResult_HtlcBasepointDecodeErrorZ_get_err(uint64_t owner) {
13655         LDKCResult_HtlcBasepointDecodeErrorZ* owner_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(owner);
13656         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13657         *ret_copy = CResult_HtlcBasepointDecodeErrorZ_get_err(owner_conv);
13658         uint64_t ret_ref = tag_ptr(ret_copy, true);
13659         return ret_ref;
13660 }
13661
13662 static inline struct LDKHtlcKey CResult_HtlcKeyDecodeErrorZ_get_ok(LDKCResult_HtlcKeyDecodeErrorZ *NONNULL_PTR owner){
13663         LDKHtlcKey ret = *owner->contents.result;
13664         ret.is_owned = false;
13665         return ret;
13666 }
13667 uint64_t  __attribute__((export_name("TS_CResult_HtlcKeyDecodeErrorZ_get_ok"))) TS_CResult_HtlcKeyDecodeErrorZ_get_ok(uint64_t owner) {
13668         LDKCResult_HtlcKeyDecodeErrorZ* owner_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(owner);
13669         LDKHtlcKey ret_var = CResult_HtlcKeyDecodeErrorZ_get_ok(owner_conv);
13670         uint64_t ret_ref = 0;
13671         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13672         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13673         return ret_ref;
13674 }
13675
13676 static inline struct LDKDecodeError CResult_HtlcKeyDecodeErrorZ_get_err(LDKCResult_HtlcKeyDecodeErrorZ *NONNULL_PTR owner){
13677 CHECK(!owner->result_ok);
13678         return DecodeError_clone(&*owner->contents.err);
13679 }
13680 uint64_t  __attribute__((export_name("TS_CResult_HtlcKeyDecodeErrorZ_get_err"))) TS_CResult_HtlcKeyDecodeErrorZ_get_err(uint64_t owner) {
13681         LDKCResult_HtlcKeyDecodeErrorZ* owner_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(owner);
13682         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13683         *ret_copy = CResult_HtlcKeyDecodeErrorZ_get_err(owner_conv);
13684         uint64_t ret_ref = tag_ptr(ret_copy, true);
13685         return ret_ref;
13686 }
13687
13688 static inline struct LDKRevocationBasepoint CResult_RevocationBasepointDecodeErrorZ_get_ok(LDKCResult_RevocationBasepointDecodeErrorZ *NONNULL_PTR owner){
13689         LDKRevocationBasepoint ret = *owner->contents.result;
13690         ret.is_owned = false;
13691         return ret;
13692 }
13693 uint64_t  __attribute__((export_name("TS_CResult_RevocationBasepointDecodeErrorZ_get_ok"))) TS_CResult_RevocationBasepointDecodeErrorZ_get_ok(uint64_t owner) {
13694         LDKCResult_RevocationBasepointDecodeErrorZ* owner_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(owner);
13695         LDKRevocationBasepoint ret_var = CResult_RevocationBasepointDecodeErrorZ_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_RevocationBasepointDecodeErrorZ_get_err(LDKCResult_RevocationBasepointDecodeErrorZ *NONNULL_PTR owner){
13703 CHECK(!owner->result_ok);
13704         return DecodeError_clone(&*owner->contents.err);
13705 }
13706 uint64_t  __attribute__((export_name("TS_CResult_RevocationBasepointDecodeErrorZ_get_err"))) TS_CResult_RevocationBasepointDecodeErrorZ_get_err(uint64_t owner) {
13707         LDKCResult_RevocationBasepointDecodeErrorZ* owner_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(owner);
13708         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13709         *ret_copy = CResult_RevocationBasepointDecodeErrorZ_get_err(owner_conv);
13710         uint64_t ret_ref = tag_ptr(ret_copy, true);
13711         return ret_ref;
13712 }
13713
13714 static inline struct LDKRevocationKey CResult_RevocationKeyDecodeErrorZ_get_ok(LDKCResult_RevocationKeyDecodeErrorZ *NONNULL_PTR owner){
13715         LDKRevocationKey ret = *owner->contents.result;
13716         ret.is_owned = false;
13717         return ret;
13718 }
13719 uint64_t  __attribute__((export_name("TS_CResult_RevocationKeyDecodeErrorZ_get_ok"))) TS_CResult_RevocationKeyDecodeErrorZ_get_ok(uint64_t owner) {
13720         LDKCResult_RevocationKeyDecodeErrorZ* owner_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(owner);
13721         LDKRevocationKey ret_var = CResult_RevocationKeyDecodeErrorZ_get_ok(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 LDKDecodeError CResult_RevocationKeyDecodeErrorZ_get_err(LDKCResult_RevocationKeyDecodeErrorZ *NONNULL_PTR owner){
13729 CHECK(!owner->result_ok);
13730         return DecodeError_clone(&*owner->contents.err);
13731 }
13732 uint64_t  __attribute__((export_name("TS_CResult_RevocationKeyDecodeErrorZ_get_err"))) TS_CResult_RevocationKeyDecodeErrorZ_get_err(uint64_t owner) {
13733         LDKCResult_RevocationKeyDecodeErrorZ* owner_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(owner);
13734         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13735         *ret_copy = CResult_RevocationKeyDecodeErrorZ_get_err(owner_conv);
13736         uint64_t ret_ref = tag_ptr(ret_copy, true);
13737         return ret_ref;
13738 }
13739
13740 static inline struct LDKLockedChannelMonitor CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
13741         LDKLockedChannelMonitor ret = *owner->contents.result;
13742         ret.is_owned = false;
13743         return ret;
13744 }
13745 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_ok"))) TS_CResult_LockedChannelMonitorNoneZ_get_ok(uint64_t owner) {
13746         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
13747         LDKLockedChannelMonitor ret_var = CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
13748         uint64_t ret_ref = 0;
13749         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13750         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13751         return ret_ref;
13752 }
13753
13754 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
13755 CHECK(!owner->result_ok);
13756         return *owner->contents.err;
13757 }
13758 void  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_err"))) TS_CResult_LockedChannelMonitorNoneZ_get_err(uint64_t owner) {
13759         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
13760         CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
13761 }
13762
13763 static inline struct LDKOutPoint C2Tuple_OutPointChannelIdZ_get_a(LDKC2Tuple_OutPointChannelIdZ *NONNULL_PTR owner){
13764         LDKOutPoint ret = owner->a;
13765         ret.is_owned = false;
13766         return ret;
13767 }
13768 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointChannelIdZ_get_a"))) TS_C2Tuple_OutPointChannelIdZ_get_a(uint64_t owner) {
13769         LDKC2Tuple_OutPointChannelIdZ* owner_conv = (LDKC2Tuple_OutPointChannelIdZ*)untag_ptr(owner);
13770         LDKOutPoint ret_var = C2Tuple_OutPointChannelIdZ_get_a(owner_conv);
13771         uint64_t ret_ref = 0;
13772         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13773         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13774         return ret_ref;
13775 }
13776
13777 static inline struct LDKChannelId C2Tuple_OutPointChannelIdZ_get_b(LDKC2Tuple_OutPointChannelIdZ *NONNULL_PTR owner){
13778         LDKChannelId ret = owner->b;
13779         ret.is_owned = false;
13780         return ret;
13781 }
13782 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointChannelIdZ_get_b"))) TS_C2Tuple_OutPointChannelIdZ_get_b(uint64_t owner) {
13783         LDKC2Tuple_OutPointChannelIdZ* owner_conv = (LDKC2Tuple_OutPointChannelIdZ*)untag_ptr(owner);
13784         LDKChannelId ret_var = C2Tuple_OutPointChannelIdZ_get_b(owner_conv);
13785         uint64_t ret_ref = 0;
13786         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13787         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13788         return ret_ref;
13789 }
13790
13791 static inline LDKCVec_C2Tuple_OutPointChannelIdZZ CVec_C2Tuple_OutPointChannelIdZZ_clone(const LDKCVec_C2Tuple_OutPointChannelIdZZ *orig) {
13792         LDKCVec_C2Tuple_OutPointChannelIdZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_OutPointChannelIdZ) * orig->datalen, "LDKCVec_C2Tuple_OutPointChannelIdZZ clone bytes"), .datalen = orig->datalen };
13793         for (size_t i = 0; i < ret.datalen; i++) {
13794                 ret.data[i] = C2Tuple_OutPointChannelIdZ_clone(&orig->data[i]);
13795         }
13796         return ret;
13797 }
13798 static inline LDKCVec_MonitorUpdateIdZ CVec_MonitorUpdateIdZ_clone(const LDKCVec_MonitorUpdateIdZ *orig) {
13799         LDKCVec_MonitorUpdateIdZ ret = { .data = MALLOC(sizeof(LDKMonitorUpdateId) * orig->datalen, "LDKCVec_MonitorUpdateIdZ clone bytes"), .datalen = orig->datalen };
13800         for (size_t i = 0; i < ret.datalen; i++) {
13801                 ret.data[i] = MonitorUpdateId_clone(&orig->data[i]);
13802         }
13803         return ret;
13804 }
13805 static inline struct LDKOutPoint C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
13806         LDKOutPoint ret = owner->a;
13807         ret.is_owned = false;
13808         return ret;
13809 }
13810 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(uint64_t owner) {
13811         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
13812         LDKOutPoint ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(owner_conv);
13813         uint64_t ret_ref = 0;
13814         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13815         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13816         return ret_ref;
13817 }
13818
13819 static inline struct LDKCVec_MonitorUpdateIdZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
13820         return CVec_MonitorUpdateIdZ_clone(&owner->b);
13821 }
13822 uint64_tArray  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(uint64_t owner) {
13823         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
13824         LDKCVec_MonitorUpdateIdZ ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(owner_conv);
13825         uint64_tArray ret_arr = NULL;
13826         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
13827         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
13828         for (size_t r = 0; r < ret_var.datalen; r++) {
13829                 LDKMonitorUpdateId ret_conv_17_var = ret_var.data[r];
13830                 uint64_t ret_conv_17_ref = 0;
13831                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_17_var);
13832                 ret_conv_17_ref = tag_ptr(ret_conv_17_var.inner, ret_conv_17_var.is_owned);
13833                 ret_arr_ptr[r] = ret_conv_17_ref;
13834         }
13835         
13836         FREE(ret_var.data);
13837         return ret_arr;
13838 }
13839
13840 static inline LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_clone(const LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ *orig) {
13841         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ) * orig->datalen, "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ clone bytes"), .datalen = orig->datalen };
13842         for (size_t i = 0; i < ret.datalen; i++) {
13843                 ret.data[i] = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(&orig->data[i]);
13844         }
13845         return ret;
13846 }
13847 uint32_t __attribute__((export_name("TS_LDKCandidateRouteHop_ty_from_ptr"))) TS_LDKCandidateRouteHop_ty_from_ptr(uint64_t ptr) {
13848         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
13849         switch(obj->tag) {
13850                 case LDKCandidateRouteHop_FirstHop: return 0;
13851                 case LDKCandidateRouteHop_PublicHop: return 1;
13852                 case LDKCandidateRouteHop_PrivateHop: return 2;
13853                 case LDKCandidateRouteHop_Blinded: return 3;
13854                 case LDKCandidateRouteHop_OneHopBlinded: return 4;
13855                 default: abort();
13856         }
13857 }
13858 uint64_t __attribute__((export_name("TS_LDKCandidateRouteHop_FirstHop_get_first_hop"))) TS_LDKCandidateRouteHop_FirstHop_get_first_hop(uint64_t ptr) {
13859         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
13860         assert(obj->tag == LDKCandidateRouteHop_FirstHop);
13861         LDKFirstHopCandidate first_hop_var = obj->first_hop;
13862                         uint64_t first_hop_ref = 0;
13863                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hop_var);
13864                         first_hop_ref = tag_ptr(first_hop_var.inner, false);
13865         return first_hop_ref;
13866 }
13867 uint64_t __attribute__((export_name("TS_LDKCandidateRouteHop_PublicHop_get_public_hop"))) TS_LDKCandidateRouteHop_PublicHop_get_public_hop(uint64_t ptr) {
13868         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
13869         assert(obj->tag == LDKCandidateRouteHop_PublicHop);
13870         LDKPublicHopCandidate public_hop_var = obj->public_hop;
13871                         uint64_t public_hop_ref = 0;
13872                         CHECK_INNER_FIELD_ACCESS_OR_NULL(public_hop_var);
13873                         public_hop_ref = tag_ptr(public_hop_var.inner, false);
13874         return public_hop_ref;
13875 }
13876 uint64_t __attribute__((export_name("TS_LDKCandidateRouteHop_PrivateHop_get_private_hop"))) TS_LDKCandidateRouteHop_PrivateHop_get_private_hop(uint64_t ptr) {
13877         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
13878         assert(obj->tag == LDKCandidateRouteHop_PrivateHop);
13879         LDKPrivateHopCandidate private_hop_var = obj->private_hop;
13880                         uint64_t private_hop_ref = 0;
13881                         CHECK_INNER_FIELD_ACCESS_OR_NULL(private_hop_var);
13882                         private_hop_ref = tag_ptr(private_hop_var.inner, false);
13883         return private_hop_ref;
13884 }
13885 uint64_t __attribute__((export_name("TS_LDKCandidateRouteHop_Blinded_get_blinded"))) TS_LDKCandidateRouteHop_Blinded_get_blinded(uint64_t ptr) {
13886         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
13887         assert(obj->tag == LDKCandidateRouteHop_Blinded);
13888         LDKBlindedPathCandidate blinded_var = obj->blinded;
13889                         uint64_t blinded_ref = 0;
13890                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_var);
13891                         blinded_ref = tag_ptr(blinded_var.inner, false);
13892         return blinded_ref;
13893 }
13894 uint64_t __attribute__((export_name("TS_LDKCandidateRouteHop_OneHopBlinded_get_one_hop_blinded"))) TS_LDKCandidateRouteHop_OneHopBlinded_get_one_hop_blinded(uint64_t ptr) {
13895         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
13896         assert(obj->tag == LDKCandidateRouteHop_OneHopBlinded);
13897         LDKOneHopBlindedPathCandidate one_hop_blinded_var = obj->one_hop_blinded;
13898                         uint64_t one_hop_blinded_ref = 0;
13899                         CHECK_INNER_FIELD_ACCESS_OR_NULL(one_hop_blinded_var);
13900                         one_hop_blinded_ref = tag_ptr(one_hop_blinded_var.inner, false);
13901         return one_hop_blinded_ref;
13902 }
13903 typedef struct LDKScoreLookUp_JCalls {
13904         atomic_size_t refcnt;
13905         uint32_t instance_ptr;
13906 } LDKScoreLookUp_JCalls;
13907 static void LDKScoreLookUp_JCalls_free(void* this_arg) {
13908         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) this_arg;
13909         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13910                 FREE(j_calls);
13911         }
13912 }
13913 uint64_t channel_penalty_msat_LDKScoreLookUp_jcall(const void* this_arg, const LDKCandidateRouteHop * candidate, LDKChannelUsage usage, const LDKProbabilisticScoringFeeParameters * score_params) {
13914         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) this_arg;
13915         LDKCandidateRouteHop *ret_candidate = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop ret conversion");
13916         *ret_candidate = CandidateRouteHop_clone(candidate);
13917         uint64_t ref_candidate = tag_ptr(ret_candidate, true);
13918         LDKChannelUsage usage_var = usage;
13919         uint64_t usage_ref = 0;
13920         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_var);
13921         usage_ref = tag_ptr(usage_var.inner, usage_var.is_owned);
13922         LDKProbabilisticScoringFeeParameters score_params_var = *score_params;
13923         uint64_t score_params_ref = 0;
13924         score_params_var = ProbabilisticScoringFeeParameters_clone(&score_params_var);
13925         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_var);
13926         score_params_ref = tag_ptr(score_params_var.inner, score_params_var.is_owned);
13927         return js_invoke_function_bbbuuu(j_calls->instance_ptr, 55, ref_candidate, usage_ref, score_params_ref, 0, 0, 0);
13928 }
13929 static void LDKScoreLookUp_JCalls_cloned(LDKScoreLookUp* new_obj) {
13930         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) new_obj->this_arg;
13931         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13932 }
13933 static inline LDKScoreLookUp LDKScoreLookUp_init (JSValue o) {
13934         LDKScoreLookUp_JCalls *calls = MALLOC(sizeof(LDKScoreLookUp_JCalls), "LDKScoreLookUp_JCalls");
13935         atomic_init(&calls->refcnt, 1);
13936         calls->instance_ptr = o;
13937
13938         LDKScoreLookUp ret = {
13939                 .this_arg = (void*) calls,
13940                 .channel_penalty_msat = channel_penalty_msat_LDKScoreLookUp_jcall,
13941                 .free = LDKScoreLookUp_JCalls_free,
13942         };
13943         return ret;
13944 }
13945 uint64_t  __attribute__((export_name("TS_LDKScoreLookUp_new"))) TS_LDKScoreLookUp_new(JSValue o) {
13946         LDKScoreLookUp *res_ptr = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
13947         *res_ptr = LDKScoreLookUp_init(o);
13948         return tag_ptr(res_ptr, true);
13949 }
13950 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) {
13951         void* this_arg_ptr = untag_ptr(this_arg);
13952         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13953         LDKScoreLookUp* this_arg_conv = (LDKScoreLookUp*)this_arg_ptr;
13954         LDKCandidateRouteHop* candidate_conv = (LDKCandidateRouteHop*)untag_ptr(candidate);
13955         LDKChannelUsage usage_conv;
13956         usage_conv.inner = untag_ptr(usage);
13957         usage_conv.is_owned = ptr_is_owned(usage);
13958         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_conv);
13959         usage_conv = ChannelUsage_clone(&usage_conv);
13960         LDKProbabilisticScoringFeeParameters score_params_conv;
13961         score_params_conv.inner = untag_ptr(score_params);
13962         score_params_conv.is_owned = ptr_is_owned(score_params);
13963         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
13964         score_params_conv.is_owned = false;
13965         int64_t ret_conv = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, candidate_conv, usage_conv, &score_params_conv);
13966         return ret_conv;
13967 }
13968
13969 typedef struct LDKScoreUpdate_JCalls {
13970         atomic_size_t refcnt;
13971         uint32_t instance_ptr;
13972 } LDKScoreUpdate_JCalls;
13973 static void LDKScoreUpdate_JCalls_free(void* this_arg) {
13974         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
13975         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13976                 FREE(j_calls);
13977         }
13978 }
13979 void payment_path_failed_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id, uint64_t duration_since_epoch) {
13980         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
13981         LDKPath path_var = *path;
13982         uint64_t path_ref = 0;
13983         path_var = Path_clone(&path_var);
13984         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
13985         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
13986         int64_t short_channel_id_conv = short_channel_id;
13987         int64_t duration_since_epoch_conv = duration_since_epoch;
13988         js_invoke_function_bbbuuu(j_calls->instance_ptr, 56, path_ref, short_channel_id_conv, duration_since_epoch_conv, 0, 0, 0);
13989 }
13990 void payment_path_successful_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t duration_since_epoch) {
13991         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
13992         LDKPath path_var = *path;
13993         uint64_t path_ref = 0;
13994         path_var = Path_clone(&path_var);
13995         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
13996         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
13997         int64_t duration_since_epoch_conv = duration_since_epoch;
13998         js_invoke_function_bbuuuu(j_calls->instance_ptr, 57, path_ref, duration_since_epoch_conv, 0, 0, 0, 0);
13999 }
14000 void probe_failed_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id, uint64_t duration_since_epoch) {
14001         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
14002         LDKPath path_var = *path;
14003         uint64_t path_ref = 0;
14004         path_var = Path_clone(&path_var);
14005         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
14006         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
14007         int64_t short_channel_id_conv = short_channel_id;
14008         int64_t duration_since_epoch_conv = duration_since_epoch;
14009         js_invoke_function_bbbuuu(j_calls->instance_ptr, 58, path_ref, short_channel_id_conv, duration_since_epoch_conv, 0, 0, 0);
14010 }
14011 void probe_successful_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t duration_since_epoch) {
14012         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
14013         LDKPath path_var = *path;
14014         uint64_t path_ref = 0;
14015         path_var = Path_clone(&path_var);
14016         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
14017         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
14018         int64_t duration_since_epoch_conv = duration_since_epoch;
14019         js_invoke_function_bbuuuu(j_calls->instance_ptr, 59, path_ref, duration_since_epoch_conv, 0, 0, 0, 0);
14020 }
14021 void time_passed_LDKScoreUpdate_jcall(void* this_arg, uint64_t duration_since_epoch) {
14022         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
14023         int64_t duration_since_epoch_conv = duration_since_epoch;
14024         js_invoke_function_buuuuu(j_calls->instance_ptr, 60, duration_since_epoch_conv, 0, 0, 0, 0, 0);
14025 }
14026 static void LDKScoreUpdate_JCalls_cloned(LDKScoreUpdate* new_obj) {
14027         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) new_obj->this_arg;
14028         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14029 }
14030 static inline LDKScoreUpdate LDKScoreUpdate_init (JSValue o) {
14031         LDKScoreUpdate_JCalls *calls = MALLOC(sizeof(LDKScoreUpdate_JCalls), "LDKScoreUpdate_JCalls");
14032         atomic_init(&calls->refcnt, 1);
14033         calls->instance_ptr = o;
14034
14035         LDKScoreUpdate ret = {
14036                 .this_arg = (void*) calls,
14037                 .payment_path_failed = payment_path_failed_LDKScoreUpdate_jcall,
14038                 .payment_path_successful = payment_path_successful_LDKScoreUpdate_jcall,
14039                 .probe_failed = probe_failed_LDKScoreUpdate_jcall,
14040                 .probe_successful = probe_successful_LDKScoreUpdate_jcall,
14041                 .time_passed = time_passed_LDKScoreUpdate_jcall,
14042                 .free = LDKScoreUpdate_JCalls_free,
14043         };
14044         return ret;
14045 }
14046 uint64_t  __attribute__((export_name("TS_LDKScoreUpdate_new"))) TS_LDKScoreUpdate_new(JSValue o) {
14047         LDKScoreUpdate *res_ptr = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
14048         *res_ptr = LDKScoreUpdate_init(o);
14049         return tag_ptr(res_ptr, true);
14050 }
14051 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) {
14052         void* this_arg_ptr = untag_ptr(this_arg);
14053         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14054         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
14055         LDKPath path_conv;
14056         path_conv.inner = untag_ptr(path);
14057         path_conv.is_owned = ptr_is_owned(path);
14058         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
14059         path_conv.is_owned = false;
14060         (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id, duration_since_epoch);
14061 }
14062
14063 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) {
14064         void* this_arg_ptr = untag_ptr(this_arg);
14065         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14066         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
14067         LDKPath path_conv;
14068         path_conv.inner = untag_ptr(path);
14069         path_conv.is_owned = ptr_is_owned(path);
14070         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
14071         path_conv.is_owned = false;
14072         (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, &path_conv, duration_since_epoch);
14073 }
14074
14075 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) {
14076         void* this_arg_ptr = untag_ptr(this_arg);
14077         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14078         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
14079         LDKPath path_conv;
14080         path_conv.inner = untag_ptr(path);
14081         path_conv.is_owned = ptr_is_owned(path);
14082         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
14083         path_conv.is_owned = false;
14084         (this_arg_conv->probe_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id, duration_since_epoch);
14085 }
14086
14087 void  __attribute__((export_name("TS_ScoreUpdate_probe_successful"))) TS_ScoreUpdate_probe_successful(uint64_t this_arg, uint64_t path, int64_t duration_since_epoch) {
14088         void* this_arg_ptr = untag_ptr(this_arg);
14089         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14090         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
14091         LDKPath path_conv;
14092         path_conv.inner = untag_ptr(path);
14093         path_conv.is_owned = ptr_is_owned(path);
14094         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
14095         path_conv.is_owned = false;
14096         (this_arg_conv->probe_successful)(this_arg_conv->this_arg, &path_conv, duration_since_epoch);
14097 }
14098
14099 void  __attribute__((export_name("TS_ScoreUpdate_time_passed"))) TS_ScoreUpdate_time_passed(uint64_t this_arg, int64_t duration_since_epoch) {
14100         void* this_arg_ptr = untag_ptr(this_arg);
14101         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14102         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
14103         (this_arg_conv->time_passed)(this_arg_conv->this_arg, duration_since_epoch);
14104 }
14105
14106 typedef struct LDKLockableScore_JCalls {
14107         atomic_size_t refcnt;
14108         uint32_t instance_ptr;
14109 } LDKLockableScore_JCalls;
14110 static void LDKLockableScore_JCalls_free(void* this_arg) {
14111         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
14112         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14113                 FREE(j_calls);
14114         }
14115 }
14116 LDKScoreLookUp read_lock_LDKLockableScore_jcall(const void* this_arg) {
14117         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
14118         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 61, 0, 0, 0, 0, 0, 0);
14119         void* ret_ptr = untag_ptr(ret);
14120         CHECK_ACCESS(ret_ptr);
14121         LDKScoreLookUp ret_conv = *(LDKScoreLookUp*)(ret_ptr);
14122         if (ret_conv.free == LDKScoreLookUp_JCalls_free) {
14123                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14124                 LDKScoreLookUp_JCalls_cloned(&ret_conv);
14125         }// WARNING: we may need a move here but no clone is available for LDKScoreLookUp
14126         
14127         return ret_conv;
14128 }
14129 LDKScoreUpdate write_lock_LDKLockableScore_jcall(const void* this_arg) {
14130         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
14131         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 62, 0, 0, 0, 0, 0, 0);
14132         void* ret_ptr = untag_ptr(ret);
14133         CHECK_ACCESS(ret_ptr);
14134         LDKScoreUpdate ret_conv = *(LDKScoreUpdate*)(ret_ptr);
14135         if (ret_conv.free == LDKScoreUpdate_JCalls_free) {
14136                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14137                 LDKScoreUpdate_JCalls_cloned(&ret_conv);
14138         }// WARNING: we may need a move here but no clone is available for LDKScoreUpdate
14139         
14140         return ret_conv;
14141 }
14142 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
14143         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
14144         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14145 }
14146 static inline LDKLockableScore LDKLockableScore_init (JSValue o) {
14147         LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
14148         atomic_init(&calls->refcnt, 1);
14149         calls->instance_ptr = o;
14150
14151         LDKLockableScore ret = {
14152                 .this_arg = (void*) calls,
14153                 .read_lock = read_lock_LDKLockableScore_jcall,
14154                 .write_lock = write_lock_LDKLockableScore_jcall,
14155                 .free = LDKLockableScore_JCalls_free,
14156         };
14157         return ret;
14158 }
14159 uint64_t  __attribute__((export_name("TS_LDKLockableScore_new"))) TS_LDKLockableScore_new(JSValue o) {
14160         LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
14161         *res_ptr = LDKLockableScore_init(o);
14162         return tag_ptr(res_ptr, true);
14163 }
14164 uint64_t  __attribute__((export_name("TS_LockableScore_read_lock"))) TS_LockableScore_read_lock(uint64_t this_arg) {
14165         void* this_arg_ptr = untag_ptr(this_arg);
14166         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14167         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
14168         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
14169         *ret_ret = (this_arg_conv->read_lock)(this_arg_conv->this_arg);
14170         return tag_ptr(ret_ret, true);
14171 }
14172
14173 uint64_t  __attribute__((export_name("TS_LockableScore_write_lock"))) TS_LockableScore_write_lock(uint64_t this_arg) {
14174         void* this_arg_ptr = untag_ptr(this_arg);
14175         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14176         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
14177         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
14178         *ret_ret = (this_arg_conv->write_lock)(this_arg_conv->this_arg);
14179         return tag_ptr(ret_ret, true);
14180 }
14181
14182 typedef struct LDKWriteableScore_JCalls {
14183         atomic_size_t refcnt;
14184         uint32_t instance_ptr;
14185         LDKLockableScore_JCalls* LockableScore;
14186 } LDKWriteableScore_JCalls;
14187 static void LDKWriteableScore_JCalls_free(void* this_arg) {
14188         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
14189         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14190                 FREE(j_calls);
14191         }
14192 }
14193 LDKCVec_u8Z write_LDKWriteableScore_jcall(const void* this_arg) {
14194         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
14195         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 63, 0, 0, 0, 0, 0, 0);
14196         LDKCVec_u8Z ret_ref;
14197         ret_ref.datalen = ret->arr_len;
14198         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
14199         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
14200         return ret_ref;
14201 }
14202 static void LDKWriteableScore_JCalls_cloned(LDKWriteableScore* new_obj) {
14203         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) new_obj->this_arg;
14204         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14205         atomic_fetch_add_explicit(&j_calls->LockableScore->refcnt, 1, memory_order_release);
14206 }
14207 static inline LDKWriteableScore LDKWriteableScore_init (JSValue o, JSValue LockableScore) {
14208         LDKWriteableScore_JCalls *calls = MALLOC(sizeof(LDKWriteableScore_JCalls), "LDKWriteableScore_JCalls");
14209         atomic_init(&calls->refcnt, 1);
14210         calls->instance_ptr = o;
14211
14212         LDKWriteableScore ret = {
14213                 .this_arg = (void*) calls,
14214                 .write = write_LDKWriteableScore_jcall,
14215                 .free = LDKWriteableScore_JCalls_free,
14216                 .LockableScore = LDKLockableScore_init(LockableScore),
14217         };
14218         calls->LockableScore = ret.LockableScore.this_arg;
14219         return ret;
14220 }
14221 uint64_t  __attribute__((export_name("TS_LDKWriteableScore_new"))) TS_LDKWriteableScore_new(JSValue o, JSValue LockableScore) {
14222         LDKWriteableScore *res_ptr = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
14223         *res_ptr = LDKWriteableScore_init(o, LockableScore);
14224         return tag_ptr(res_ptr, true);
14225 }
14226 int8_tArray  __attribute__((export_name("TS_WriteableScore_write"))) TS_WriteableScore_write(uint64_t this_arg) {
14227         void* this_arg_ptr = untag_ptr(this_arg);
14228         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14229         LDKWriteableScore* this_arg_conv = (LDKWriteableScore*)this_arg_ptr;
14230         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
14231         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
14232         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
14233         CVec_u8Z_free(ret_var);
14234         return ret_arr;
14235 }
14236
14237 typedef struct LDKPersister_JCalls {
14238         atomic_size_t refcnt;
14239         uint32_t instance_ptr;
14240 } LDKPersister_JCalls;
14241 static void LDKPersister_JCalls_free(void* this_arg) {
14242         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
14243         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14244                 FREE(j_calls);
14245         }
14246 }
14247 LDKCResult_NoneIOErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
14248         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
14249         LDKChannelManager channel_manager_var = *channel_manager;
14250         uint64_t channel_manager_ref = 0;
14251         // WARNING: we may need a move here but no clone is available for LDKChannelManager
14252         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
14253         channel_manager_ref = tag_ptr(channel_manager_var.inner, channel_manager_var.is_owned);
14254         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 64, channel_manager_ref, 0, 0, 0, 0, 0);
14255         void* ret_ptr = untag_ptr(ret);
14256         CHECK_ACCESS(ret_ptr);
14257         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
14258         FREE(untag_ptr(ret));
14259         return ret_conv;
14260 }
14261 LDKCResult_NoneIOErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
14262         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
14263         LDKNetworkGraph network_graph_var = *network_graph;
14264         uint64_t network_graph_ref = 0;
14265         // WARNING: we may need a move here but no clone is available for LDKNetworkGraph
14266         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
14267         network_graph_ref = tag_ptr(network_graph_var.inner, network_graph_var.is_owned);
14268         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 65, network_graph_ref, 0, 0, 0, 0, 0);
14269         void* ret_ptr = untag_ptr(ret);
14270         CHECK_ACCESS(ret_ptr);
14271         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
14272         FREE(untag_ptr(ret));
14273         return ret_conv;
14274 }
14275 LDKCResult_NoneIOErrorZ persist_scorer_LDKPersister_jcall(const void* this_arg, const LDKWriteableScore * scorer) {
14276         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
14277         // WARNING: This object doesn't live past this scope, needs clone!
14278         uint64_t ret_scorer = tag_ptr(scorer, false);
14279         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 66, ret_scorer, 0, 0, 0, 0, 0);
14280         void* ret_ptr = untag_ptr(ret);
14281         CHECK_ACCESS(ret_ptr);
14282         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
14283         FREE(untag_ptr(ret));
14284         return ret_conv;
14285 }
14286 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
14287         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
14288         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14289 }
14290 static inline LDKPersister LDKPersister_init (JSValue o) {
14291         LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
14292         atomic_init(&calls->refcnt, 1);
14293         calls->instance_ptr = o;
14294
14295         LDKPersister ret = {
14296                 .this_arg = (void*) calls,
14297                 .persist_manager = persist_manager_LDKPersister_jcall,
14298                 .persist_graph = persist_graph_LDKPersister_jcall,
14299                 .persist_scorer = persist_scorer_LDKPersister_jcall,
14300                 .free = LDKPersister_JCalls_free,
14301         };
14302         return ret;
14303 }
14304 uint64_t  __attribute__((export_name("TS_LDKPersister_new"))) TS_LDKPersister_new(JSValue o) {
14305         LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
14306         *res_ptr = LDKPersister_init(o);
14307         return tag_ptr(res_ptr, true);
14308 }
14309 uint64_t  __attribute__((export_name("TS_Persister_persist_manager"))) TS_Persister_persist_manager(uint64_t this_arg, uint64_t channel_manager) {
14310         void* this_arg_ptr = untag_ptr(this_arg);
14311         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14312         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
14313         LDKChannelManager channel_manager_conv;
14314         channel_manager_conv.inner = untag_ptr(channel_manager);
14315         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
14316         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
14317         channel_manager_conv.is_owned = false;
14318         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
14319         *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
14320         return tag_ptr(ret_conv, true);
14321 }
14322
14323 uint64_t  __attribute__((export_name("TS_Persister_persist_graph"))) TS_Persister_persist_graph(uint64_t this_arg, uint64_t network_graph) {
14324         void* this_arg_ptr = untag_ptr(this_arg);
14325         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14326         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
14327         LDKNetworkGraph network_graph_conv;
14328         network_graph_conv.inner = untag_ptr(network_graph);
14329         network_graph_conv.is_owned = ptr_is_owned(network_graph);
14330         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
14331         network_graph_conv.is_owned = false;
14332         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
14333         *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
14334         return tag_ptr(ret_conv, true);
14335 }
14336
14337 uint64_t  __attribute__((export_name("TS_Persister_persist_scorer"))) TS_Persister_persist_scorer(uint64_t this_arg, uint64_t scorer) {
14338         void* this_arg_ptr = untag_ptr(this_arg);
14339         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14340         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
14341         void* scorer_ptr = untag_ptr(scorer);
14342         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
14343         LDKWriteableScore* scorer_conv = (LDKWriteableScore*)scorer_ptr;
14344         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
14345         *ret_conv = (this_arg_conv->persist_scorer)(this_arg_conv->this_arg, scorer_conv);
14346         return tag_ptr(ret_conv, true);
14347 }
14348
14349 typedef struct LDKPersist_JCalls {
14350         atomic_size_t refcnt;
14351         uint32_t instance_ptr;
14352 } LDKPersist_JCalls;
14353 static void LDKPersist_JCalls_free(void* this_arg) {
14354         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
14355         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14356                 FREE(j_calls);
14357         }
14358 }
14359 LDKChannelMonitorUpdateStatus persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_funding_outpoint, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
14360         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
14361         LDKOutPoint channel_funding_outpoint_var = channel_funding_outpoint;
14362         uint64_t channel_funding_outpoint_ref = 0;
14363         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_outpoint_var);
14364         channel_funding_outpoint_ref = tag_ptr(channel_funding_outpoint_var.inner, channel_funding_outpoint_var.is_owned);
14365         LDKChannelMonitor data_var = *data;
14366         uint64_t data_ref = 0;
14367         data_var = ChannelMonitor_clone(&data_var);
14368         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
14369         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
14370         LDKMonitorUpdateId update_id_var = update_id;
14371         uint64_t update_id_ref = 0;
14372         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
14373         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
14374         uint64_t ret = js_invoke_function_bbbuuu(j_calls->instance_ptr, 67, channel_funding_outpoint_ref, data_ref, update_id_ref, 0, 0, 0);
14375         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
14376         return ret_conv;
14377 }
14378 LDKChannelMonitorUpdateStatus update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_funding_outpoint, LDKChannelMonitorUpdate update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
14379         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
14380         LDKOutPoint channel_funding_outpoint_var = channel_funding_outpoint;
14381         uint64_t channel_funding_outpoint_ref = 0;
14382         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_outpoint_var);
14383         channel_funding_outpoint_ref = tag_ptr(channel_funding_outpoint_var.inner, channel_funding_outpoint_var.is_owned);
14384         LDKChannelMonitorUpdate update_var = update;
14385         uint64_t update_ref = 0;
14386         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
14387         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
14388         LDKChannelMonitor data_var = *data;
14389         uint64_t data_ref = 0;
14390         data_var = ChannelMonitor_clone(&data_var);
14391         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
14392         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
14393         LDKMonitorUpdateId update_id_var = update_id;
14394         uint64_t update_id_ref = 0;
14395         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
14396         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
14397         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);
14398         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
14399         return ret_conv;
14400 }
14401 void archive_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_funding_outpoint) {
14402         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
14403         LDKOutPoint channel_funding_outpoint_var = channel_funding_outpoint;
14404         uint64_t channel_funding_outpoint_ref = 0;
14405         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_outpoint_var);
14406         channel_funding_outpoint_ref = tag_ptr(channel_funding_outpoint_var.inner, channel_funding_outpoint_var.is_owned);
14407         js_invoke_function_buuuuu(j_calls->instance_ptr, 69, channel_funding_outpoint_ref, 0, 0, 0, 0, 0);
14408 }
14409 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
14410         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
14411         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14412 }
14413 static inline LDKPersist LDKPersist_init (JSValue o) {
14414         LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
14415         atomic_init(&calls->refcnt, 1);
14416         calls->instance_ptr = o;
14417
14418         LDKPersist ret = {
14419                 .this_arg = (void*) calls,
14420                 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
14421                 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
14422                 .archive_persisted_channel = archive_persisted_channel_LDKPersist_jcall,
14423                 .free = LDKPersist_JCalls_free,
14424         };
14425         return ret;
14426 }
14427 uint64_t  __attribute__((export_name("TS_LDKPersist_new"))) TS_LDKPersist_new(JSValue o) {
14428         LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
14429         *res_ptr = LDKPersist_init(o);
14430         return tag_ptr(res_ptr, true);
14431 }
14432 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) {
14433         void* this_arg_ptr = untag_ptr(this_arg);
14434         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14435         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
14436         LDKOutPoint channel_funding_outpoint_conv;
14437         channel_funding_outpoint_conv.inner = untag_ptr(channel_funding_outpoint);
14438         channel_funding_outpoint_conv.is_owned = ptr_is_owned(channel_funding_outpoint);
14439         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_outpoint_conv);
14440         channel_funding_outpoint_conv = OutPoint_clone(&channel_funding_outpoint_conv);
14441         LDKChannelMonitor data_conv;
14442         data_conv.inner = untag_ptr(data);
14443         data_conv.is_owned = ptr_is_owned(data);
14444         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
14445         data_conv.is_owned = false;
14446         LDKMonitorUpdateId update_id_conv;
14447         update_id_conv.inner = untag_ptr(update_id);
14448         update_id_conv.is_owned = ptr_is_owned(update_id);
14449         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
14450         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
14451         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));
14452         return ret_conv;
14453 }
14454
14455 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) {
14456         void* this_arg_ptr = untag_ptr(this_arg);
14457         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14458         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
14459         LDKOutPoint channel_funding_outpoint_conv;
14460         channel_funding_outpoint_conv.inner = untag_ptr(channel_funding_outpoint);
14461         channel_funding_outpoint_conv.is_owned = ptr_is_owned(channel_funding_outpoint);
14462         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_outpoint_conv);
14463         channel_funding_outpoint_conv = OutPoint_clone(&channel_funding_outpoint_conv);
14464         LDKChannelMonitorUpdate update_conv;
14465         update_conv.inner = untag_ptr(update);
14466         update_conv.is_owned = ptr_is_owned(update);
14467         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
14468         update_conv = ChannelMonitorUpdate_clone(&update_conv);
14469         LDKChannelMonitor data_conv;
14470         data_conv.inner = untag_ptr(data);
14471         data_conv.is_owned = ptr_is_owned(data);
14472         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
14473         data_conv.is_owned = false;
14474         LDKMonitorUpdateId update_id_conv;
14475         update_id_conv.inner = untag_ptr(update_id);
14476         update_id_conv.is_owned = ptr_is_owned(update_id);
14477         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
14478         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
14479         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));
14480         return ret_conv;
14481 }
14482
14483 void  __attribute__((export_name("TS_Persist_archive_persisted_channel"))) TS_Persist_archive_persisted_channel(uint64_t this_arg, uint64_t channel_funding_outpoint) {
14484         void* this_arg_ptr = untag_ptr(this_arg);
14485         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14486         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
14487         LDKOutPoint channel_funding_outpoint_conv;
14488         channel_funding_outpoint_conv.inner = untag_ptr(channel_funding_outpoint);
14489         channel_funding_outpoint_conv.is_owned = ptr_is_owned(channel_funding_outpoint);
14490         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_outpoint_conv);
14491         channel_funding_outpoint_conv = OutPoint_clone(&channel_funding_outpoint_conv);
14492         (this_arg_conv->archive_persisted_channel)(this_arg_conv->this_arg, channel_funding_outpoint_conv);
14493 }
14494
14495 typedef struct LDKListen_JCalls {
14496         atomic_size_t refcnt;
14497         uint32_t instance_ptr;
14498 } LDKListen_JCalls;
14499 static void LDKListen_JCalls_free(void* this_arg) {
14500         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
14501         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14502                 FREE(j_calls);
14503         }
14504 }
14505 void filtered_block_connected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
14506         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
14507         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
14508         memcpy(header_arr->elems, *header, 80);
14509         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
14510         uint64_tArray txdata_arr = NULL;
14511         txdata_arr = init_uint64_tArray(txdata_var.datalen, __LINE__);
14512         uint64_t *txdata_arr_ptr = (uint64_t*)(((uint8_t*)txdata_arr) + 8);
14513         for (size_t c = 0; c < txdata_var.datalen; c++) {
14514                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
14515                 *txdata_conv_28_conv = txdata_var.data[c];
14516                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
14517         }
14518         
14519         FREE(txdata_var.data);
14520         int32_t height_conv = height;
14521         js_invoke_function_uuuuuu(j_calls->instance_ptr, 70, (uint32_t)header_arr, (uint32_t)txdata_arr, height_conv, 0, 0, 0);
14522 }
14523 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
14524         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
14525         LDKu8slice block_var = block;
14526         int8_tArray block_arr = init_int8_tArray(block_var.datalen, __LINE__);
14527         memcpy(block_arr->elems, block_var.data, block_var.datalen);
14528         int32_t height_conv = height;
14529         js_invoke_function_uuuuuu(j_calls->instance_ptr, 71, (uint32_t)block_arr, height_conv, 0, 0, 0, 0);
14530 }
14531 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
14532         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
14533         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
14534         memcpy(header_arr->elems, *header, 80);
14535         int32_t height_conv = height;
14536         js_invoke_function_uuuuuu(j_calls->instance_ptr, 72, (uint32_t)header_arr, height_conv, 0, 0, 0, 0);
14537 }
14538 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
14539         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
14540         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14541 }
14542 static inline LDKListen LDKListen_init (JSValue o) {
14543         LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
14544         atomic_init(&calls->refcnt, 1);
14545         calls->instance_ptr = o;
14546
14547         LDKListen ret = {
14548                 .this_arg = (void*) calls,
14549                 .filtered_block_connected = filtered_block_connected_LDKListen_jcall,
14550                 .block_connected = block_connected_LDKListen_jcall,
14551                 .block_disconnected = block_disconnected_LDKListen_jcall,
14552                 .free = LDKListen_JCalls_free,
14553         };
14554         return ret;
14555 }
14556 uint64_t  __attribute__((export_name("TS_LDKListen_new"))) TS_LDKListen_new(JSValue o) {
14557         LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
14558         *res_ptr = LDKListen_init(o);
14559         return tag_ptr(res_ptr, true);
14560 }
14561 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) {
14562         void* this_arg_ptr = untag_ptr(this_arg);
14563         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14564         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
14565         uint8_t header_arr[80];
14566         CHECK(header->arr_len == 80);
14567         memcpy(header_arr, header->elems, 80); FREE(header);
14568         uint8_t (*header_ref)[80] = &header_arr;
14569         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
14570         txdata_constr.datalen = txdata->arr_len;
14571         if (txdata_constr.datalen > 0)
14572                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
14573         else
14574                 txdata_constr.data = NULL;
14575         uint64_t* txdata_vals = txdata->elems;
14576         for (size_t c = 0; c < txdata_constr.datalen; c++) {
14577                 uint64_t txdata_conv_28 = txdata_vals[c];
14578                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
14579                 CHECK_ACCESS(txdata_conv_28_ptr);
14580                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
14581                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
14582                 txdata_constr.data[c] = txdata_conv_28_conv;
14583         }
14584         FREE(txdata);
14585         (this_arg_conv->filtered_block_connected)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
14586 }
14587
14588 void  __attribute__((export_name("TS_Listen_block_connected"))) TS_Listen_block_connected(uint64_t this_arg, int8_tArray block, int32_t height) {
14589         void* this_arg_ptr = untag_ptr(this_arg);
14590         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14591         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
14592         LDKu8slice block_ref;
14593         block_ref.datalen = block->arr_len;
14594         block_ref.data = block->elems;
14595         (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
14596         FREE(block);
14597 }
14598
14599 void  __attribute__((export_name("TS_Listen_block_disconnected"))) TS_Listen_block_disconnected(uint64_t this_arg, int8_tArray header, int32_t height) {
14600         void* this_arg_ptr = untag_ptr(this_arg);
14601         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14602         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
14603         uint8_t header_arr[80];
14604         CHECK(header->arr_len == 80);
14605         memcpy(header_arr, header->elems, 80); FREE(header);
14606         uint8_t (*header_ref)[80] = &header_arr;
14607         (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
14608 }
14609
14610 typedef struct LDKConfirm_JCalls {
14611         atomic_size_t refcnt;
14612         uint32_t instance_ptr;
14613 } LDKConfirm_JCalls;
14614 static void LDKConfirm_JCalls_free(void* this_arg) {
14615         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
14616         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14617                 FREE(j_calls);
14618         }
14619 }
14620 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
14621         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
14622         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
14623         memcpy(header_arr->elems, *header, 80);
14624         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
14625         uint64_tArray txdata_arr = NULL;
14626         txdata_arr = init_uint64_tArray(txdata_var.datalen, __LINE__);
14627         uint64_t *txdata_arr_ptr = (uint64_t*)(((uint8_t*)txdata_arr) + 8);
14628         for (size_t c = 0; c < txdata_var.datalen; c++) {
14629                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
14630                 *txdata_conv_28_conv = txdata_var.data[c];
14631                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
14632         }
14633         
14634         FREE(txdata_var.data);
14635         int32_t height_conv = height;
14636         js_invoke_function_uuuuuu(j_calls->instance_ptr, 73, (uint32_t)header_arr, (uint32_t)txdata_arr, height_conv, 0, 0, 0);
14637 }
14638 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
14639         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
14640         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
14641         memcpy(txid_arr->elems, *txid, 32);
14642         js_invoke_function_uuuuuu(j_calls->instance_ptr, 74, (uint32_t)txid_arr, 0, 0, 0, 0, 0);
14643 }
14644 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
14645         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
14646         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
14647         memcpy(header_arr->elems, *header, 80);
14648         int32_t height_conv = height;
14649         js_invoke_function_uuuuuu(j_calls->instance_ptr, 75, (uint32_t)header_arr, height_conv, 0, 0, 0, 0);
14650 }
14651 LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
14652         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
14653         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 76, 0, 0, 0, 0, 0, 0);
14654         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret_constr;
14655         ret_constr.datalen = ret->arr_len;
14656         if (ret_constr.datalen > 0)
14657                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ Elements");
14658         else
14659                 ret_constr.data = NULL;
14660         uint64_t* ret_vals = ret->elems;
14661         for (size_t c = 0; c < ret_constr.datalen; c++) {
14662                 uint64_t ret_conv_54 = ret_vals[c];
14663                 void* ret_conv_54_ptr = untag_ptr(ret_conv_54);
14664                 CHECK_ACCESS(ret_conv_54_ptr);
14665                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ ret_conv_54_conv = *(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)(ret_conv_54_ptr);
14666                 FREE(untag_ptr(ret_conv_54));
14667                 ret_constr.data[c] = ret_conv_54_conv;
14668         }
14669         FREE(ret);
14670         return ret_constr;
14671 }
14672 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
14673         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
14674         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14675 }
14676 static inline LDKConfirm LDKConfirm_init (JSValue o) {
14677         LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
14678         atomic_init(&calls->refcnt, 1);
14679         calls->instance_ptr = o;
14680
14681         LDKConfirm ret = {
14682                 .this_arg = (void*) calls,
14683                 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
14684                 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
14685                 .best_block_updated = best_block_updated_LDKConfirm_jcall,
14686                 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
14687                 .free = LDKConfirm_JCalls_free,
14688         };
14689         return ret;
14690 }
14691 uint64_t  __attribute__((export_name("TS_LDKConfirm_new"))) TS_LDKConfirm_new(JSValue o) {
14692         LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
14693         *res_ptr = LDKConfirm_init(o);
14694         return tag_ptr(res_ptr, true);
14695 }
14696 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) {
14697         void* this_arg_ptr = untag_ptr(this_arg);
14698         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14699         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
14700         uint8_t header_arr[80];
14701         CHECK(header->arr_len == 80);
14702         memcpy(header_arr, header->elems, 80); FREE(header);
14703         uint8_t (*header_ref)[80] = &header_arr;
14704         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
14705         txdata_constr.datalen = txdata->arr_len;
14706         if (txdata_constr.datalen > 0)
14707                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
14708         else
14709                 txdata_constr.data = NULL;
14710         uint64_t* txdata_vals = txdata->elems;
14711         for (size_t c = 0; c < txdata_constr.datalen; c++) {
14712                 uint64_t txdata_conv_28 = txdata_vals[c];
14713                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
14714                 CHECK_ACCESS(txdata_conv_28_ptr);
14715                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
14716                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
14717                 txdata_constr.data[c] = txdata_conv_28_conv;
14718         }
14719         FREE(txdata);
14720         (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
14721 }
14722
14723 void  __attribute__((export_name("TS_Confirm_transaction_unconfirmed"))) TS_Confirm_transaction_unconfirmed(uint64_t this_arg, int8_tArray txid) {
14724         void* this_arg_ptr = untag_ptr(this_arg);
14725         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14726         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
14727         uint8_t txid_arr[32];
14728         CHECK(txid->arr_len == 32);
14729         memcpy(txid_arr, txid->elems, 32); FREE(txid);
14730         uint8_t (*txid_ref)[32] = &txid_arr;
14731         (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
14732 }
14733
14734 void  __attribute__((export_name("TS_Confirm_best_block_updated"))) TS_Confirm_best_block_updated(uint64_t this_arg, int8_tArray header, int32_t height) {
14735         void* this_arg_ptr = untag_ptr(this_arg);
14736         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14737         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
14738         uint8_t header_arr[80];
14739         CHECK(header->arr_len == 80);
14740         memcpy(header_arr, header->elems, 80); FREE(header);
14741         uint8_t (*header_ref)[80] = &header_arr;
14742         (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
14743 }
14744
14745 uint64_tArray  __attribute__((export_name("TS_Confirm_get_relevant_txids"))) TS_Confirm_get_relevant_txids(uint64_t this_arg) {
14746         void* this_arg_ptr = untag_ptr(this_arg);
14747         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14748         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
14749         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
14750         uint64_tArray ret_arr = NULL;
14751         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
14752         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
14753         for (size_t c = 0; c < ret_var.datalen; c++) {
14754                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv_54_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
14755                 *ret_conv_54_conv = ret_var.data[c];
14756                 ret_arr_ptr[c] = tag_ptr(ret_conv_54_conv, true);
14757         }
14758         
14759         FREE(ret_var.data);
14760         return ret_arr;
14761 }
14762
14763 uint32_t __attribute__((export_name("TS_LDKSpendingDelay_ty_from_ptr"))) TS_LDKSpendingDelay_ty_from_ptr(uint64_t ptr) {
14764         LDKSpendingDelay *obj = (LDKSpendingDelay*)untag_ptr(ptr);
14765         switch(obj->tag) {
14766                 case LDKSpendingDelay_Relative: return 0;
14767                 case LDKSpendingDelay_Absolute: return 1;
14768                 default: abort();
14769         }
14770 }
14771 int32_t __attribute__((export_name("TS_LDKSpendingDelay_Relative_get_num_blocks"))) TS_LDKSpendingDelay_Relative_get_num_blocks(uint64_t ptr) {
14772         LDKSpendingDelay *obj = (LDKSpendingDelay*)untag_ptr(ptr);
14773         assert(obj->tag == LDKSpendingDelay_Relative);
14774         int32_t num_blocks_conv = obj->relative.num_blocks;
14775         return num_blocks_conv;
14776 }
14777 int32_t __attribute__((export_name("TS_LDKSpendingDelay_Absolute_get_height"))) TS_LDKSpendingDelay_Absolute_get_height(uint64_t ptr) {
14778         LDKSpendingDelay *obj = (LDKSpendingDelay*)untag_ptr(ptr);
14779         assert(obj->tag == LDKSpendingDelay_Absolute);
14780         int32_t height_conv = obj->absolute.height;
14781         return height_conv;
14782 }
14783 typedef struct LDKFutureCallback_JCalls {
14784         atomic_size_t refcnt;
14785         uint32_t instance_ptr;
14786 } LDKFutureCallback_JCalls;
14787 static void LDKFutureCallback_JCalls_free(void* this_arg) {
14788         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
14789         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14790                 FREE(j_calls);
14791         }
14792 }
14793 void call_LDKFutureCallback_jcall(const void* this_arg) {
14794         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
14795         js_invoke_function_uuuuuu(j_calls->instance_ptr, 77, 0, 0, 0, 0, 0, 0);
14796 }
14797 static void LDKFutureCallback_JCalls_cloned(LDKFutureCallback* new_obj) {
14798         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) new_obj->this_arg;
14799         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14800 }
14801 static inline LDKFutureCallback LDKFutureCallback_init (JSValue o) {
14802         LDKFutureCallback_JCalls *calls = MALLOC(sizeof(LDKFutureCallback_JCalls), "LDKFutureCallback_JCalls");
14803         atomic_init(&calls->refcnt, 1);
14804         calls->instance_ptr = o;
14805
14806         LDKFutureCallback ret = {
14807                 .this_arg = (void*) calls,
14808                 .call = call_LDKFutureCallback_jcall,
14809                 .free = LDKFutureCallback_JCalls_free,
14810         };
14811         return ret;
14812 }
14813 uint64_t  __attribute__((export_name("TS_LDKFutureCallback_new"))) TS_LDKFutureCallback_new(JSValue o) {
14814         LDKFutureCallback *res_ptr = MALLOC(sizeof(LDKFutureCallback), "LDKFutureCallback");
14815         *res_ptr = LDKFutureCallback_init(o);
14816         return tag_ptr(res_ptr, true);
14817 }
14818 void  __attribute__((export_name("TS_FutureCallback_call"))) TS_FutureCallback_call(uint64_t this_arg) {
14819         void* this_arg_ptr = untag_ptr(this_arg);
14820         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14821         LDKFutureCallback* this_arg_conv = (LDKFutureCallback*)this_arg_ptr;
14822         (this_arg_conv->call)(this_arg_conv->this_arg);
14823 }
14824
14825 typedef struct LDKEventHandler_JCalls {
14826         atomic_size_t refcnt;
14827         uint32_t instance_ptr;
14828 } LDKEventHandler_JCalls;
14829 static void LDKEventHandler_JCalls_free(void* this_arg) {
14830         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
14831         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14832                 FREE(j_calls);
14833         }
14834 }
14835 void handle_event_LDKEventHandler_jcall(const void* this_arg, LDKEvent event) {
14836         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
14837         LDKEvent *event_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
14838         *event_copy = event;
14839         uint64_t event_ref = tag_ptr(event_copy, true);
14840         js_invoke_function_buuuuu(j_calls->instance_ptr, 78, event_ref, 0, 0, 0, 0, 0);
14841 }
14842 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
14843         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
14844         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14845 }
14846 static inline LDKEventHandler LDKEventHandler_init (JSValue o) {
14847         LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
14848         atomic_init(&calls->refcnt, 1);
14849         calls->instance_ptr = o;
14850
14851         LDKEventHandler ret = {
14852                 .this_arg = (void*) calls,
14853                 .handle_event = handle_event_LDKEventHandler_jcall,
14854                 .free = LDKEventHandler_JCalls_free,
14855         };
14856         return ret;
14857 }
14858 uint64_t  __attribute__((export_name("TS_LDKEventHandler_new"))) TS_LDKEventHandler_new(JSValue o) {
14859         LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
14860         *res_ptr = LDKEventHandler_init(o);
14861         return tag_ptr(res_ptr, true);
14862 }
14863 void  __attribute__((export_name("TS_EventHandler_handle_event"))) TS_EventHandler_handle_event(uint64_t this_arg, uint64_t event) {
14864         void* this_arg_ptr = untag_ptr(this_arg);
14865         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14866         LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
14867         void* event_ptr = untag_ptr(event);
14868         CHECK_ACCESS(event_ptr);
14869         LDKEvent event_conv = *(LDKEvent*)(event_ptr);
14870         event_conv = Event_clone((LDKEvent*)untag_ptr(event));
14871         (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
14872 }
14873
14874 typedef struct LDKEventsProvider_JCalls {
14875         atomic_size_t refcnt;
14876         uint32_t instance_ptr;
14877 } LDKEventsProvider_JCalls;
14878 static void LDKEventsProvider_JCalls_free(void* this_arg) {
14879         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
14880         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14881                 FREE(j_calls);
14882         }
14883 }
14884 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
14885         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
14886         LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
14887         *handler_ret = handler;
14888         js_invoke_function_buuuuu(j_calls->instance_ptr, 79, tag_ptr(handler_ret, true), 0, 0, 0, 0, 0);
14889 }
14890 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
14891         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
14892         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14893 }
14894 static inline LDKEventsProvider LDKEventsProvider_init (JSValue o) {
14895         LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
14896         atomic_init(&calls->refcnt, 1);
14897         calls->instance_ptr = o;
14898
14899         LDKEventsProvider ret = {
14900                 .this_arg = (void*) calls,
14901                 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
14902                 .free = LDKEventsProvider_JCalls_free,
14903         };
14904         return ret;
14905 }
14906 uint64_t  __attribute__((export_name("TS_LDKEventsProvider_new"))) TS_LDKEventsProvider_new(JSValue o) {
14907         LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
14908         *res_ptr = LDKEventsProvider_init(o);
14909         return tag_ptr(res_ptr, true);
14910 }
14911 void  __attribute__((export_name("TS_EventsProvider_process_pending_events"))) TS_EventsProvider_process_pending_events(uint64_t this_arg, uint64_t handler) {
14912         void* this_arg_ptr = untag_ptr(this_arg);
14913         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14914         LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
14915         void* handler_ptr = untag_ptr(handler);
14916         CHECK_ACCESS(handler_ptr);
14917         LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
14918         if (handler_conv.free == LDKEventHandler_JCalls_free) {
14919                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14920                 LDKEventHandler_JCalls_cloned(&handler_conv);
14921         }
14922         (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
14923 }
14924
14925 uint32_t __attribute__((export_name("TS_LDKFailureCode_ty_from_ptr"))) TS_LDKFailureCode_ty_from_ptr(uint64_t ptr) {
14926         LDKFailureCode *obj = (LDKFailureCode*)untag_ptr(ptr);
14927         switch(obj->tag) {
14928                 case LDKFailureCode_TemporaryNodeFailure: return 0;
14929                 case LDKFailureCode_RequiredNodeFeatureMissing: return 1;
14930                 case LDKFailureCode_IncorrectOrUnknownPaymentDetails: return 2;
14931                 case LDKFailureCode_InvalidOnionPayload: return 3;
14932                 default: abort();
14933         }
14934 }
14935 uint64_t __attribute__((export_name("TS_LDKFailureCode_InvalidOnionPayload_get_invalid_onion_payload"))) TS_LDKFailureCode_InvalidOnionPayload_get_invalid_onion_payload(uint64_t ptr) {
14936         LDKFailureCode *obj = (LDKFailureCode*)untag_ptr(ptr);
14937         assert(obj->tag == LDKFailureCode_InvalidOnionPayload);
14938         uint64_t invalid_onion_payload_ref = tag_ptr(&obj->invalid_onion_payload, false);
14939         return invalid_onion_payload_ref;
14940 }
14941 typedef struct LDKMessageSendEventsProvider_JCalls {
14942         atomic_size_t refcnt;
14943         uint32_t instance_ptr;
14944 } LDKMessageSendEventsProvider_JCalls;
14945 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
14946         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
14947         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14948                 FREE(j_calls);
14949         }
14950 }
14951 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
14952         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
14953         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 80, 0, 0, 0, 0, 0, 0);
14954         LDKCVec_MessageSendEventZ ret_constr;
14955         ret_constr.datalen = ret->arr_len;
14956         if (ret_constr.datalen > 0)
14957                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
14958         else
14959                 ret_constr.data = NULL;
14960         uint64_t* ret_vals = ret->elems;
14961         for (size_t s = 0; s < ret_constr.datalen; s++) {
14962                 uint64_t ret_conv_18 = ret_vals[s];
14963                 void* ret_conv_18_ptr = untag_ptr(ret_conv_18);
14964                 CHECK_ACCESS(ret_conv_18_ptr);
14965                 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
14966                 FREE(untag_ptr(ret_conv_18));
14967                 ret_constr.data[s] = ret_conv_18_conv;
14968         }
14969         FREE(ret);
14970         return ret_constr;
14971 }
14972 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
14973         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
14974         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14975 }
14976 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JSValue o) {
14977         LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
14978         atomic_init(&calls->refcnt, 1);
14979         calls->instance_ptr = o;
14980
14981         LDKMessageSendEventsProvider ret = {
14982                 .this_arg = (void*) calls,
14983                 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
14984                 .free = LDKMessageSendEventsProvider_JCalls_free,
14985         };
14986         return ret;
14987 }
14988 uint64_t  __attribute__((export_name("TS_LDKMessageSendEventsProvider_new"))) TS_LDKMessageSendEventsProvider_new(JSValue o) {
14989         LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
14990         *res_ptr = LDKMessageSendEventsProvider_init(o);
14991         return tag_ptr(res_ptr, true);
14992 }
14993 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) {
14994         void* this_arg_ptr = untag_ptr(this_arg);
14995         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14996         LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
14997         LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
14998         uint64_tArray ret_arr = NULL;
14999         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
15000         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
15001         for (size_t s = 0; s < ret_var.datalen; s++) {
15002                 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15003                 *ret_conv_18_copy = ret_var.data[s];
15004                 uint64_t ret_conv_18_ref = tag_ptr(ret_conv_18_copy, true);
15005                 ret_arr_ptr[s] = ret_conv_18_ref;
15006         }
15007         
15008         FREE(ret_var.data);
15009         return ret_arr;
15010 }
15011
15012 typedef struct LDKChannelMessageHandler_JCalls {
15013         atomic_size_t refcnt;
15014         uint32_t instance_ptr;
15015         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
15016 } LDKChannelMessageHandler_JCalls;
15017 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
15018         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15019         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15020                 FREE(j_calls);
15021         }
15022 }
15023 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannel * msg) {
15024         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15025         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15026         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15027         LDKOpenChannel msg_var = *msg;
15028         uint64_t msg_ref = 0;
15029         msg_var = OpenChannel_clone(&msg_var);
15030         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15031         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15032         js_invoke_function_ubuuuu(j_calls->instance_ptr, 81, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15033 }
15034 void handle_open_channel_v2_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannelV2 * msg) {
15035         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15036         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15037         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15038         LDKOpenChannelV2 msg_var = *msg;
15039         uint64_t msg_ref = 0;
15040         msg_var = OpenChannelV2_clone(&msg_var);
15041         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15042         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15043         js_invoke_function_ubuuuu(j_calls->instance_ptr, 82, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15044 }
15045 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannel * msg) {
15046         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15047         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15048         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15049         LDKAcceptChannel msg_var = *msg;
15050         uint64_t msg_ref = 0;
15051         msg_var = AcceptChannel_clone(&msg_var);
15052         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15053         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15054         js_invoke_function_ubuuuu(j_calls->instance_ptr, 83, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15055 }
15056 void handle_accept_channel_v2_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannelV2 * msg) {
15057         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15058         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15059         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15060         LDKAcceptChannelV2 msg_var = *msg;
15061         uint64_t msg_ref = 0;
15062         msg_var = AcceptChannelV2_clone(&msg_var);
15063         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15064         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15065         js_invoke_function_ubuuuu(j_calls->instance_ptr, 84, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15066 }
15067 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
15068         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15069         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15070         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15071         LDKFundingCreated msg_var = *msg;
15072         uint64_t msg_ref = 0;
15073         msg_var = FundingCreated_clone(&msg_var);
15074         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15075         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15076         js_invoke_function_ubuuuu(j_calls->instance_ptr, 85, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15077 }
15078 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
15079         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15080         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15081         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15082         LDKFundingSigned msg_var = *msg;
15083         uint64_t msg_ref = 0;
15084         msg_var = FundingSigned_clone(&msg_var);
15085         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15086         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15087         js_invoke_function_ubuuuu(j_calls->instance_ptr, 86, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15088 }
15089 void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReady * msg) {
15090         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15091         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15092         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15093         LDKChannelReady msg_var = *msg;
15094         uint64_t msg_ref = 0;
15095         msg_var = ChannelReady_clone(&msg_var);
15096         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15097         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15098         js_invoke_function_ubuuuu(j_calls->instance_ptr, 87, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15099 }
15100 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown * msg) {
15101         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15102         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15103         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15104         LDKShutdown msg_var = *msg;
15105         uint64_t msg_ref = 0;
15106         msg_var = Shutdown_clone(&msg_var);
15107         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15108         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15109         js_invoke_function_ubuuuu(j_calls->instance_ptr, 88, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15110 }
15111 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
15112         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15113         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15114         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15115         LDKClosingSigned msg_var = *msg;
15116         uint64_t msg_ref = 0;
15117         msg_var = ClosingSigned_clone(&msg_var);
15118         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15119         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15120         js_invoke_function_ubuuuu(j_calls->instance_ptr, 89, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15121 }
15122 void handle_stfu_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKStfu * msg) {
15123         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15124         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15125         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15126         LDKStfu msg_var = *msg;
15127         uint64_t msg_ref = 0;
15128         msg_var = Stfu_clone(&msg_var);
15129         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15130         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15131         js_invoke_function_ubuuuu(j_calls->instance_ptr, 90, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15132 }
15133 void handle_tx_add_input_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAddInput * msg) {
15134         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15135         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15136         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15137         LDKTxAddInput msg_var = *msg;
15138         uint64_t msg_ref = 0;
15139         msg_var = TxAddInput_clone(&msg_var);
15140         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15141         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15142         js_invoke_function_ubuuuu(j_calls->instance_ptr, 91, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15143 }
15144 void handle_tx_add_output_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAddOutput * msg) {
15145         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15146         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15147         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15148         LDKTxAddOutput msg_var = *msg;
15149         uint64_t msg_ref = 0;
15150         msg_var = TxAddOutput_clone(&msg_var);
15151         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15152         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15153         js_invoke_function_ubuuuu(j_calls->instance_ptr, 92, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15154 }
15155 void handle_tx_remove_input_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxRemoveInput * msg) {
15156         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15157         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15158         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15159         LDKTxRemoveInput msg_var = *msg;
15160         uint64_t msg_ref = 0;
15161         msg_var = TxRemoveInput_clone(&msg_var);
15162         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15163         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15164         js_invoke_function_ubuuuu(j_calls->instance_ptr, 93, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15165 }
15166 void handle_tx_remove_output_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxRemoveOutput * msg) {
15167         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15168         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15169         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15170         LDKTxRemoveOutput msg_var = *msg;
15171         uint64_t msg_ref = 0;
15172         msg_var = TxRemoveOutput_clone(&msg_var);
15173         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15174         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15175         js_invoke_function_ubuuuu(j_calls->instance_ptr, 94, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15176 }
15177 void handle_tx_complete_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxComplete * msg) {
15178         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15179         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15180         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15181         LDKTxComplete msg_var = *msg;
15182         uint64_t msg_ref = 0;
15183         msg_var = TxComplete_clone(&msg_var);
15184         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15185         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15186         js_invoke_function_ubuuuu(j_calls->instance_ptr, 95, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15187 }
15188 void handle_tx_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxSignatures * msg) {
15189         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15190         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15191         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15192         LDKTxSignatures msg_var = *msg;
15193         uint64_t msg_ref = 0;
15194         msg_var = TxSignatures_clone(&msg_var);
15195         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15196         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15197         js_invoke_function_ubuuuu(j_calls->instance_ptr, 96, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15198 }
15199 void handle_tx_init_rbf_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxInitRbf * msg) {
15200         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15201         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15202         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15203         LDKTxInitRbf msg_var = *msg;
15204         uint64_t msg_ref = 0;
15205         msg_var = TxInitRbf_clone(&msg_var);
15206         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15207         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15208         js_invoke_function_ubuuuu(j_calls->instance_ptr, 97, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15209 }
15210 void handle_tx_ack_rbf_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAckRbf * msg) {
15211         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15212         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15213         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15214         LDKTxAckRbf msg_var = *msg;
15215         uint64_t msg_ref = 0;
15216         msg_var = TxAckRbf_clone(&msg_var);
15217         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15218         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15219         js_invoke_function_ubuuuu(j_calls->instance_ptr, 98, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15220 }
15221 void handle_tx_abort_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAbort * msg) {
15222         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15223         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15224         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15225         LDKTxAbort msg_var = *msg;
15226         uint64_t msg_ref = 0;
15227         msg_var = TxAbort_clone(&msg_var);
15228         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15229         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15230         js_invoke_function_ubuuuu(j_calls->instance_ptr, 99, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15231 }
15232 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
15233         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15234         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15235         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15236         LDKUpdateAddHTLC msg_var = *msg;
15237         uint64_t msg_ref = 0;
15238         msg_var = UpdateAddHTLC_clone(&msg_var);
15239         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15240         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15241         js_invoke_function_ubuuuu(j_calls->instance_ptr, 100, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15242 }
15243 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
15244         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15245         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15246         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15247         LDKUpdateFulfillHTLC msg_var = *msg;
15248         uint64_t msg_ref = 0;
15249         msg_var = UpdateFulfillHTLC_clone(&msg_var);
15250         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15251         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15252         js_invoke_function_ubuuuu(j_calls->instance_ptr, 101, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15253 }
15254 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
15255         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15256         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15257         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15258         LDKUpdateFailHTLC msg_var = *msg;
15259         uint64_t msg_ref = 0;
15260         msg_var = UpdateFailHTLC_clone(&msg_var);
15261         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15262         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15263         js_invoke_function_ubuuuu(j_calls->instance_ptr, 102, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15264 }
15265 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
15266         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15267         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15268         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15269         LDKUpdateFailMalformedHTLC msg_var = *msg;
15270         uint64_t msg_ref = 0;
15271         msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
15272         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15273         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15274         js_invoke_function_ubuuuu(j_calls->instance_ptr, 103, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15275 }
15276 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
15277         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15278         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15279         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15280         LDKCommitmentSigned msg_var = *msg;
15281         uint64_t msg_ref = 0;
15282         msg_var = CommitmentSigned_clone(&msg_var);
15283         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15284         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15285         js_invoke_function_ubuuuu(j_calls->instance_ptr, 104, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15286 }
15287 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
15288         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15289         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15290         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15291         LDKRevokeAndACK msg_var = *msg;
15292         uint64_t msg_ref = 0;
15293         msg_var = RevokeAndACK_clone(&msg_var);
15294         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15295         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15296         js_invoke_function_ubuuuu(j_calls->instance_ptr, 105, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15297 }
15298 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
15299         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15300         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15301         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15302         LDKUpdateFee msg_var = *msg;
15303         uint64_t msg_ref = 0;
15304         msg_var = UpdateFee_clone(&msg_var);
15305         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15306         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15307         js_invoke_function_ubuuuu(j_calls->instance_ptr, 106, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15308 }
15309 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
15310         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15311         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15312         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15313         LDKAnnouncementSignatures msg_var = *msg;
15314         uint64_t msg_ref = 0;
15315         msg_var = AnnouncementSignatures_clone(&msg_var);
15316         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15317         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15318         js_invoke_function_ubuuuu(j_calls->instance_ptr, 107, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15319 }
15320 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
15321         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15322         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15323         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15324         js_invoke_function_uuuuuu(j_calls->instance_ptr, 108, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
15325 }
15326 LDKCResult_NoneNoneZ peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg, bool inbound) {
15327         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15328         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15329         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15330         LDKInit msg_var = *msg;
15331         uint64_t msg_ref = 0;
15332         msg_var = Init_clone(&msg_var);
15333         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15334         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15335         jboolean inbound_conv = inbound;
15336         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);
15337         void* ret_ptr = untag_ptr(ret);
15338         CHECK_ACCESS(ret_ptr);
15339         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
15340         FREE(untag_ptr(ret));
15341         return ret_conv;
15342 }
15343 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
15344         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15345         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15346         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15347         LDKChannelReestablish msg_var = *msg;
15348         uint64_t msg_ref = 0;
15349         msg_var = ChannelReestablish_clone(&msg_var);
15350         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15351         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15352         js_invoke_function_ubuuuu(j_calls->instance_ptr, 110, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15353 }
15354 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
15355         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15356         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15357         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15358         LDKChannelUpdate msg_var = *msg;
15359         uint64_t msg_ref = 0;
15360         msg_var = ChannelUpdate_clone(&msg_var);
15361         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15362         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15363         js_invoke_function_ubuuuu(j_calls->instance_ptr, 111, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15364 }
15365 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
15366         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15367         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15368         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15369         LDKErrorMessage msg_var = *msg;
15370         uint64_t msg_ref = 0;
15371         msg_var = ErrorMessage_clone(&msg_var);
15372         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15373         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15374         js_invoke_function_ubuuuu(j_calls->instance_ptr, 112, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15375 }
15376 LDKNodeFeatures provided_node_features_LDKChannelMessageHandler_jcall(const void* this_arg) {
15377         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15378         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 113, 0, 0, 0, 0, 0, 0);
15379         LDKNodeFeatures ret_conv;
15380         ret_conv.inner = untag_ptr(ret);
15381         ret_conv.is_owned = ptr_is_owned(ret);
15382         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
15383         return ret_conv;
15384 }
15385 LDKInitFeatures provided_init_features_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
15386         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15387         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15388         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15389         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 114, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
15390         LDKInitFeatures ret_conv;
15391         ret_conv.inner = untag_ptr(ret);
15392         ret_conv.is_owned = ptr_is_owned(ret);
15393         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
15394         return ret_conv;
15395 }
15396 LDKCOption_CVec_ThirtyTwoBytesZZ get_chain_hashes_LDKChannelMessageHandler_jcall(const void* this_arg) {
15397         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15398         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 115, 0, 0, 0, 0, 0, 0);
15399         void* ret_ptr = untag_ptr(ret);
15400         CHECK_ACCESS(ret_ptr);
15401         LDKCOption_CVec_ThirtyTwoBytesZZ ret_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(ret_ptr);
15402         FREE(untag_ptr(ret));
15403         return ret_conv;
15404 }
15405 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
15406         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
15407         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15408         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
15409 }
15410 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
15411         LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
15412         atomic_init(&calls->refcnt, 1);
15413         calls->instance_ptr = o;
15414
15415         LDKChannelMessageHandler ret = {
15416                 .this_arg = (void*) calls,
15417                 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
15418                 .handle_open_channel_v2 = handle_open_channel_v2_LDKChannelMessageHandler_jcall,
15419                 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
15420                 .handle_accept_channel_v2 = handle_accept_channel_v2_LDKChannelMessageHandler_jcall,
15421                 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
15422                 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
15423                 .handle_channel_ready = handle_channel_ready_LDKChannelMessageHandler_jcall,
15424                 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
15425                 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
15426                 .handle_stfu = handle_stfu_LDKChannelMessageHandler_jcall,
15427                 .handle_tx_add_input = handle_tx_add_input_LDKChannelMessageHandler_jcall,
15428                 .handle_tx_add_output = handle_tx_add_output_LDKChannelMessageHandler_jcall,
15429                 .handle_tx_remove_input = handle_tx_remove_input_LDKChannelMessageHandler_jcall,
15430                 .handle_tx_remove_output = handle_tx_remove_output_LDKChannelMessageHandler_jcall,
15431                 .handle_tx_complete = handle_tx_complete_LDKChannelMessageHandler_jcall,
15432                 .handle_tx_signatures = handle_tx_signatures_LDKChannelMessageHandler_jcall,
15433                 .handle_tx_init_rbf = handle_tx_init_rbf_LDKChannelMessageHandler_jcall,
15434                 .handle_tx_ack_rbf = handle_tx_ack_rbf_LDKChannelMessageHandler_jcall,
15435                 .handle_tx_abort = handle_tx_abort_LDKChannelMessageHandler_jcall,
15436                 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
15437                 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
15438                 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
15439                 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
15440                 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
15441                 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
15442                 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
15443                 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
15444                 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
15445                 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
15446                 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
15447                 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
15448                 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
15449                 .provided_node_features = provided_node_features_LDKChannelMessageHandler_jcall,
15450                 .provided_init_features = provided_init_features_LDKChannelMessageHandler_jcall,
15451                 .get_chain_hashes = get_chain_hashes_LDKChannelMessageHandler_jcall,
15452                 .free = LDKChannelMessageHandler_JCalls_free,
15453                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
15454         };
15455         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
15456         return ret;
15457 }
15458 uint64_t  __attribute__((export_name("TS_LDKChannelMessageHandler_new"))) TS_LDKChannelMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
15459         LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
15460         *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
15461         return tag_ptr(res_ptr, true);
15462 }
15463 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) {
15464         void* this_arg_ptr = untag_ptr(this_arg);
15465         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15466         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15467         LDKPublicKey their_node_id_ref;
15468         CHECK(their_node_id->arr_len == 33);
15469         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15470         LDKOpenChannel msg_conv;
15471         msg_conv.inner = untag_ptr(msg);
15472         msg_conv.is_owned = ptr_is_owned(msg);
15473         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15474         msg_conv.is_owned = false;
15475         (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15476 }
15477
15478 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) {
15479         void* this_arg_ptr = untag_ptr(this_arg);
15480         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15481         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15482         LDKPublicKey their_node_id_ref;
15483         CHECK(their_node_id->arr_len == 33);
15484         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15485         LDKOpenChannelV2 msg_conv;
15486         msg_conv.inner = untag_ptr(msg);
15487         msg_conv.is_owned = ptr_is_owned(msg);
15488         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15489         msg_conv.is_owned = false;
15490         (this_arg_conv->handle_open_channel_v2)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15491 }
15492
15493 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) {
15494         void* this_arg_ptr = untag_ptr(this_arg);
15495         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15496         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15497         LDKPublicKey their_node_id_ref;
15498         CHECK(their_node_id->arr_len == 33);
15499         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15500         LDKAcceptChannel msg_conv;
15501         msg_conv.inner = untag_ptr(msg);
15502         msg_conv.is_owned = ptr_is_owned(msg);
15503         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15504         msg_conv.is_owned = false;
15505         (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15506 }
15507
15508 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) {
15509         void* this_arg_ptr = untag_ptr(this_arg);
15510         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15511         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15512         LDKPublicKey their_node_id_ref;
15513         CHECK(their_node_id->arr_len == 33);
15514         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15515         LDKAcceptChannelV2 msg_conv;
15516         msg_conv.inner = untag_ptr(msg);
15517         msg_conv.is_owned = ptr_is_owned(msg);
15518         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15519         msg_conv.is_owned = false;
15520         (this_arg_conv->handle_accept_channel_v2)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15521 }
15522
15523 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) {
15524         void* this_arg_ptr = untag_ptr(this_arg);
15525         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15526         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15527         LDKPublicKey their_node_id_ref;
15528         CHECK(their_node_id->arr_len == 33);
15529         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15530         LDKFundingCreated msg_conv;
15531         msg_conv.inner = untag_ptr(msg);
15532         msg_conv.is_owned = ptr_is_owned(msg);
15533         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15534         msg_conv.is_owned = false;
15535         (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15536 }
15537
15538 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) {
15539         void* this_arg_ptr = untag_ptr(this_arg);
15540         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15541         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15542         LDKPublicKey their_node_id_ref;
15543         CHECK(their_node_id->arr_len == 33);
15544         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15545         LDKFundingSigned msg_conv;
15546         msg_conv.inner = untag_ptr(msg);
15547         msg_conv.is_owned = ptr_is_owned(msg);
15548         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15549         msg_conv.is_owned = false;
15550         (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15551 }
15552
15553 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) {
15554         void* this_arg_ptr = untag_ptr(this_arg);
15555         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15556         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15557         LDKPublicKey their_node_id_ref;
15558         CHECK(their_node_id->arr_len == 33);
15559         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15560         LDKChannelReady msg_conv;
15561         msg_conv.inner = untag_ptr(msg);
15562         msg_conv.is_owned = ptr_is_owned(msg);
15563         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15564         msg_conv.is_owned = false;
15565         (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15566 }
15567
15568 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_shutdown"))) TS_ChannelMessageHandler_handle_shutdown(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
15569         void* this_arg_ptr = untag_ptr(this_arg);
15570         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15571         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15572         LDKPublicKey their_node_id_ref;
15573         CHECK(their_node_id->arr_len == 33);
15574         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15575         LDKShutdown msg_conv;
15576         msg_conv.inner = untag_ptr(msg);
15577         msg_conv.is_owned = ptr_is_owned(msg);
15578         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15579         msg_conv.is_owned = false;
15580         (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15581 }
15582
15583 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) {
15584         void* this_arg_ptr = untag_ptr(this_arg);
15585         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15586         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15587         LDKPublicKey their_node_id_ref;
15588         CHECK(their_node_id->arr_len == 33);
15589         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15590         LDKClosingSigned msg_conv;
15591         msg_conv.inner = untag_ptr(msg);
15592         msg_conv.is_owned = ptr_is_owned(msg);
15593         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15594         msg_conv.is_owned = false;
15595         (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15596 }
15597
15598 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_stfu"))) TS_ChannelMessageHandler_handle_stfu(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
15599         void* this_arg_ptr = untag_ptr(this_arg);
15600         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15601         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15602         LDKPublicKey their_node_id_ref;
15603         CHECK(their_node_id->arr_len == 33);
15604         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15605         LDKStfu msg_conv;
15606         msg_conv.inner = untag_ptr(msg);
15607         msg_conv.is_owned = ptr_is_owned(msg);
15608         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15609         msg_conv.is_owned = false;
15610         (this_arg_conv->handle_stfu)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15611 }
15612
15613 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) {
15614         void* this_arg_ptr = untag_ptr(this_arg);
15615         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15616         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15617         LDKPublicKey their_node_id_ref;
15618         CHECK(their_node_id->arr_len == 33);
15619         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15620         LDKTxAddInput msg_conv;
15621         msg_conv.inner = untag_ptr(msg);
15622         msg_conv.is_owned = ptr_is_owned(msg);
15623         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15624         msg_conv.is_owned = false;
15625         (this_arg_conv->handle_tx_add_input)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15626 }
15627
15628 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) {
15629         void* this_arg_ptr = untag_ptr(this_arg);
15630         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15631         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15632         LDKPublicKey their_node_id_ref;
15633         CHECK(their_node_id->arr_len == 33);
15634         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15635         LDKTxAddOutput msg_conv;
15636         msg_conv.inner = untag_ptr(msg);
15637         msg_conv.is_owned = ptr_is_owned(msg);
15638         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15639         msg_conv.is_owned = false;
15640         (this_arg_conv->handle_tx_add_output)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15641 }
15642
15643 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) {
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         LDKTxRemoveInput 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_tx_remove_input)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15656 }
15657
15658 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) {
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         LDKTxRemoveOutput 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_tx_remove_output)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15671 }
15672
15673 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) {
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         LDKTxComplete 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_tx_complete)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15686 }
15687
15688 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) {
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         LDKTxSignatures 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_tx_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15701 }
15702
15703 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) {
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         LDKTxInitRbf 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_tx_init_rbf)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15716 }
15717
15718 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) {
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         LDKTxAckRbf 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_tx_ack_rbf)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15731 }
15732
15733 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) {
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         LDKTxAbort 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_tx_abort)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15746 }
15747
15748 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) {
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         LDKUpdateAddHTLC 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_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15761 }
15762
15763 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) {
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         LDKUpdateFulfillHTLC 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_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15776 }
15777
15778 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) {
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         LDKUpdateFailHTLC 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_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15791 }
15792
15793 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) {
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         LDKUpdateFailMalformedHTLC 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_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15806 }
15807
15808 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) {
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         LDKCommitmentSigned 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_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15821 }
15822
15823 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) {
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         LDKRevokeAndACK 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_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15836 }
15837
15838 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) {
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         LDKUpdateFee 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_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15851 }
15852
15853 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) {
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         LDKAnnouncementSignatures 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_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15866 }
15867
15868 void  __attribute__((export_name("TS_ChannelMessageHandler_peer_disconnected"))) TS_ChannelMessageHandler_peer_disconnected(uint64_t this_arg, int8_tArray their_node_id) {
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         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
15876 }
15877
15878 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) {
15879         void* this_arg_ptr = untag_ptr(this_arg);
15880         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15881         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15882         LDKPublicKey their_node_id_ref;
15883         CHECK(their_node_id->arr_len == 33);
15884         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15885         LDKInit msg_conv;
15886         msg_conv.inner = untag_ptr(msg);
15887         msg_conv.is_owned = ptr_is_owned(msg);
15888         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15889         msg_conv.is_owned = false;
15890         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
15891         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv, inbound);
15892         return tag_ptr(ret_conv, true);
15893 }
15894
15895 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) {
15896         void* this_arg_ptr = untag_ptr(this_arg);
15897         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15898         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15899         LDKPublicKey their_node_id_ref;
15900         CHECK(their_node_id->arr_len == 33);
15901         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15902         LDKChannelReestablish msg_conv;
15903         msg_conv.inner = untag_ptr(msg);
15904         msg_conv.is_owned = ptr_is_owned(msg);
15905         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15906         msg_conv.is_owned = false;
15907         (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15908 }
15909
15910 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) {
15911         void* this_arg_ptr = untag_ptr(this_arg);
15912         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15913         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15914         LDKPublicKey their_node_id_ref;
15915         CHECK(their_node_id->arr_len == 33);
15916         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15917         LDKChannelUpdate msg_conv;
15918         msg_conv.inner = untag_ptr(msg);
15919         msg_conv.is_owned = ptr_is_owned(msg);
15920         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15921         msg_conv.is_owned = false;
15922         (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15923 }
15924
15925 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_error"))) TS_ChannelMessageHandler_handle_error(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
15926         void* this_arg_ptr = untag_ptr(this_arg);
15927         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15928         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15929         LDKPublicKey their_node_id_ref;
15930         CHECK(their_node_id->arr_len == 33);
15931         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15932         LDKErrorMessage msg_conv;
15933         msg_conv.inner = untag_ptr(msg);
15934         msg_conv.is_owned = ptr_is_owned(msg);
15935         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15936         msg_conv.is_owned = false;
15937         (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15938 }
15939
15940 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_provided_node_features"))) TS_ChannelMessageHandler_provided_node_features(uint64_t this_arg) {
15941         void* this_arg_ptr = untag_ptr(this_arg);
15942         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15943         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15944         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
15945         uint64_t ret_ref = 0;
15946         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15947         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15948         return ret_ref;
15949 }
15950
15951 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_provided_init_features"))) TS_ChannelMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
15952         void* this_arg_ptr = untag_ptr(this_arg);
15953         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15954         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15955         LDKPublicKey their_node_id_ref;
15956         CHECK(their_node_id->arr_len == 33);
15957         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15958         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
15959         uint64_t ret_ref = 0;
15960         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15961         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15962         return ret_ref;
15963 }
15964
15965 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_get_chain_hashes"))) TS_ChannelMessageHandler_get_chain_hashes(uint64_t this_arg) {
15966         void* this_arg_ptr = untag_ptr(this_arg);
15967         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15968         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15969         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
15970         *ret_copy = (this_arg_conv->get_chain_hashes)(this_arg_conv->this_arg);
15971         uint64_t ret_ref = tag_ptr(ret_copy, true);
15972         return ret_ref;
15973 }
15974
15975 typedef struct LDKOffersMessageHandler_JCalls {
15976         atomic_size_t refcnt;
15977         uint32_t instance_ptr;
15978 } LDKOffersMessageHandler_JCalls;
15979 static void LDKOffersMessageHandler_JCalls_free(void* this_arg) {
15980         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
15981         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15982                 FREE(j_calls);
15983         }
15984 }
15985 LDKCOption_OffersMessageZ handle_message_LDKOffersMessageHandler_jcall(const void* this_arg, LDKOffersMessage message) {
15986         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
15987         LDKOffersMessage *message_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
15988         *message_copy = message;
15989         uint64_t message_ref = tag_ptr(message_copy, true);
15990         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 116, message_ref, 0, 0, 0, 0, 0);
15991         void* ret_ptr = untag_ptr(ret);
15992         CHECK_ACCESS(ret_ptr);
15993         LDKCOption_OffersMessageZ ret_conv = *(LDKCOption_OffersMessageZ*)(ret_ptr);
15994         FREE(untag_ptr(ret));
15995         return ret_conv;
15996 }
15997 LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ release_pending_messages_LDKOffersMessageHandler_jcall(const void* this_arg) {
15998         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
15999         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 117, 0, 0, 0, 0, 0, 0);
16000         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret_constr;
16001         ret_constr.datalen = ret->arr_len;
16002         if (ret_constr.datalen > 0)
16003                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ Elements");
16004         else
16005                 ret_constr.data = NULL;
16006         uint64_t* ret_vals = ret->elems;
16007         for (size_t x = 0; x < ret_constr.datalen; x++) {
16008                 uint64_t ret_conv_49 = ret_vals[x];
16009                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
16010                 CHECK_ACCESS(ret_conv_49_ptr);
16011                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ ret_conv_49_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(ret_conv_49_ptr);
16012                 FREE(untag_ptr(ret_conv_49));
16013                 ret_constr.data[x] = ret_conv_49_conv;
16014         }
16015         FREE(ret);
16016         return ret_constr;
16017 }
16018 static void LDKOffersMessageHandler_JCalls_cloned(LDKOffersMessageHandler* new_obj) {
16019         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) new_obj->this_arg;
16020         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16021 }
16022 static inline LDKOffersMessageHandler LDKOffersMessageHandler_init (JSValue o) {
16023         LDKOffersMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOffersMessageHandler_JCalls), "LDKOffersMessageHandler_JCalls");
16024         atomic_init(&calls->refcnt, 1);
16025         calls->instance_ptr = o;
16026
16027         LDKOffersMessageHandler ret = {
16028                 .this_arg = (void*) calls,
16029                 .handle_message = handle_message_LDKOffersMessageHandler_jcall,
16030                 .release_pending_messages = release_pending_messages_LDKOffersMessageHandler_jcall,
16031                 .free = LDKOffersMessageHandler_JCalls_free,
16032         };
16033         return ret;
16034 }
16035 uint64_t  __attribute__((export_name("TS_LDKOffersMessageHandler_new"))) TS_LDKOffersMessageHandler_new(JSValue o) {
16036         LDKOffersMessageHandler *res_ptr = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
16037         *res_ptr = LDKOffersMessageHandler_init(o);
16038         return tag_ptr(res_ptr, true);
16039 }
16040 uint64_t  __attribute__((export_name("TS_OffersMessageHandler_handle_message"))) TS_OffersMessageHandler_handle_message(uint64_t this_arg, uint64_t message) {
16041         void* this_arg_ptr = untag_ptr(this_arg);
16042         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16043         LDKOffersMessageHandler* this_arg_conv = (LDKOffersMessageHandler*)this_arg_ptr;
16044         void* message_ptr = untag_ptr(message);
16045         CHECK_ACCESS(message_ptr);
16046         LDKOffersMessage message_conv = *(LDKOffersMessage*)(message_ptr);
16047         message_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(message));
16048         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
16049         *ret_copy = (this_arg_conv->handle_message)(this_arg_conv->this_arg, message_conv);
16050         uint64_t ret_ref = tag_ptr(ret_copy, true);
16051         return ret_ref;
16052 }
16053
16054 uint64_tArray  __attribute__((export_name("TS_OffersMessageHandler_release_pending_messages"))) TS_OffersMessageHandler_release_pending_messages(uint64_t this_arg) {
16055         void* this_arg_ptr = untag_ptr(this_arg);
16056         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16057         LDKOffersMessageHandler* this_arg_conv = (LDKOffersMessageHandler*)this_arg_ptr;
16058         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret_var = (this_arg_conv->release_pending_messages)(this_arg_conv->this_arg);
16059         uint64_tArray ret_arr = NULL;
16060         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
16061         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
16062         for (size_t x = 0; x < ret_var.datalen; x++) {
16063                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
16064                 *ret_conv_49_conv = ret_var.data[x];
16065                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
16066         }
16067         
16068         FREE(ret_var.data);
16069         return ret_arr;
16070 }
16071
16072 typedef struct LDKNodeIdLookUp_JCalls {
16073         atomic_size_t refcnt;
16074         uint32_t instance_ptr;
16075 } LDKNodeIdLookUp_JCalls;
16076 static void LDKNodeIdLookUp_JCalls_free(void* this_arg) {
16077         LDKNodeIdLookUp_JCalls *j_calls = (LDKNodeIdLookUp_JCalls*) this_arg;
16078         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16079                 FREE(j_calls);
16080         }
16081 }
16082 LDKPublicKey next_node_id_LDKNodeIdLookUp_jcall(const void* this_arg, uint64_t short_channel_id) {
16083         LDKNodeIdLookUp_JCalls *j_calls = (LDKNodeIdLookUp_JCalls*) this_arg;
16084         int64_t short_channel_id_conv = short_channel_id;
16085         int8_tArray ret = (int8_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 118, short_channel_id_conv, 0, 0, 0, 0, 0);
16086         LDKPublicKey ret_ref;
16087         CHECK(ret->arr_len == 33);
16088         memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret);
16089         return ret_ref;
16090 }
16091 static void LDKNodeIdLookUp_JCalls_cloned(LDKNodeIdLookUp* new_obj) {
16092         LDKNodeIdLookUp_JCalls *j_calls = (LDKNodeIdLookUp_JCalls*) new_obj->this_arg;
16093         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16094 }
16095 static inline LDKNodeIdLookUp LDKNodeIdLookUp_init (JSValue o) {
16096         LDKNodeIdLookUp_JCalls *calls = MALLOC(sizeof(LDKNodeIdLookUp_JCalls), "LDKNodeIdLookUp_JCalls");
16097         atomic_init(&calls->refcnt, 1);
16098         calls->instance_ptr = o;
16099
16100         LDKNodeIdLookUp ret = {
16101                 .this_arg = (void*) calls,
16102                 .next_node_id = next_node_id_LDKNodeIdLookUp_jcall,
16103                 .free = LDKNodeIdLookUp_JCalls_free,
16104         };
16105         return ret;
16106 }
16107 uint64_t  __attribute__((export_name("TS_LDKNodeIdLookUp_new"))) TS_LDKNodeIdLookUp_new(JSValue o) {
16108         LDKNodeIdLookUp *res_ptr = MALLOC(sizeof(LDKNodeIdLookUp), "LDKNodeIdLookUp");
16109         *res_ptr = LDKNodeIdLookUp_init(o);
16110         return tag_ptr(res_ptr, true);
16111 }
16112 int8_tArray  __attribute__((export_name("TS_NodeIdLookUp_next_node_id"))) TS_NodeIdLookUp_next_node_id(uint64_t this_arg, int64_t short_channel_id) {
16113         void* this_arg_ptr = untag_ptr(this_arg);
16114         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16115         LDKNodeIdLookUp* this_arg_conv = (LDKNodeIdLookUp*)this_arg_ptr;
16116         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
16117         memcpy(ret_arr->elems, (this_arg_conv->next_node_id)(this_arg_conv->this_arg, short_channel_id).compressed_form, 33);
16118         return ret_arr;
16119 }
16120
16121 typedef struct LDKRoutingMessageHandler_JCalls {
16122         atomic_size_t refcnt;
16123         uint32_t instance_ptr;
16124         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
16125 } LDKRoutingMessageHandler_JCalls;
16126 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
16127         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16128         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16129                 FREE(j_calls);
16130         }
16131 }
16132 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
16133         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16134         LDKNodeAnnouncement msg_var = *msg;
16135         uint64_t msg_ref = 0;
16136         msg_var = NodeAnnouncement_clone(&msg_var);
16137         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16138         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16139         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 119, msg_ref, 0, 0, 0, 0, 0);
16140         void* ret_ptr = untag_ptr(ret);
16141         CHECK_ACCESS(ret_ptr);
16142         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
16143         FREE(untag_ptr(ret));
16144         return ret_conv;
16145 }
16146 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
16147         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16148         LDKChannelAnnouncement msg_var = *msg;
16149         uint64_t msg_ref = 0;
16150         msg_var = ChannelAnnouncement_clone(&msg_var);
16151         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16152         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16153         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 120, msg_ref, 0, 0, 0, 0, 0);
16154         void* ret_ptr = untag_ptr(ret);
16155         CHECK_ACCESS(ret_ptr);
16156         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
16157         FREE(untag_ptr(ret));
16158         return ret_conv;
16159 }
16160 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
16161         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16162         LDKChannelUpdate msg_var = *msg;
16163         uint64_t msg_ref = 0;
16164         msg_var = ChannelUpdate_clone(&msg_var);
16165         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16166         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16167         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 121, msg_ref, 0, 0, 0, 0, 0);
16168         void* ret_ptr = untag_ptr(ret);
16169         CHECK_ACCESS(ret_ptr);
16170         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
16171         FREE(untag_ptr(ret));
16172         return ret_conv;
16173 }
16174 LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point) {
16175         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16176         int64_t starting_point_conv = starting_point;
16177         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 122, starting_point_conv, 0, 0, 0, 0, 0);
16178         void* ret_ptr = untag_ptr(ret);
16179         CHECK_ACCESS(ret_ptr);
16180         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(ret_ptr);
16181         FREE(untag_ptr(ret));
16182         return ret_conv;
16183 }
16184 LDKNodeAnnouncement get_next_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKNodeId starting_point) {
16185         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16186         LDKNodeId starting_point_var = starting_point;
16187         uint64_t starting_point_ref = 0;
16188         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_var);
16189         starting_point_ref = tag_ptr(starting_point_var.inner, starting_point_var.is_owned);
16190         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 123, starting_point_ref, 0, 0, 0, 0, 0);
16191         LDKNodeAnnouncement ret_conv;
16192         ret_conv.inner = untag_ptr(ret);
16193         ret_conv.is_owned = ptr_is_owned(ret);
16194         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
16195         return ret_conv;
16196 }
16197 LDKCResult_NoneNoneZ peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
16198         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16199         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
16200         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
16201         LDKInit init_var = *init;
16202         uint64_t init_ref = 0;
16203         init_var = Init_clone(&init_var);
16204         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
16205         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
16206         jboolean inbound_conv = inbound;
16207         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);
16208         void* ret_ptr = untag_ptr(ret);
16209         CHECK_ACCESS(ret_ptr);
16210         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
16211         FREE(untag_ptr(ret));
16212         return ret_conv;
16213 }
16214 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
16215         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16216         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
16217         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
16218         LDKReplyChannelRange msg_var = msg;
16219         uint64_t msg_ref = 0;
16220         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16221         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16222         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 125, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
16223         void* ret_ptr = untag_ptr(ret);
16224         CHECK_ACCESS(ret_ptr);
16225         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
16226         FREE(untag_ptr(ret));
16227         return ret_conv;
16228 }
16229 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
16230         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16231         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
16232         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
16233         LDKReplyShortChannelIdsEnd msg_var = msg;
16234         uint64_t msg_ref = 0;
16235         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16236         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16237         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 126, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
16238         void* ret_ptr = untag_ptr(ret);
16239         CHECK_ACCESS(ret_ptr);
16240         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
16241         FREE(untag_ptr(ret));
16242         return ret_conv;
16243 }
16244 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
16245         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16246         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
16247         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
16248         LDKQueryChannelRange msg_var = msg;
16249         uint64_t msg_ref = 0;
16250         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16251         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16252         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 127, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
16253         void* ret_ptr = untag_ptr(ret);
16254         CHECK_ACCESS(ret_ptr);
16255         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
16256         FREE(untag_ptr(ret));
16257         return ret_conv;
16258 }
16259 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
16260         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16261         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
16262         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
16263         LDKQueryShortChannelIds msg_var = msg;
16264         uint64_t msg_ref = 0;
16265         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16266         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16267         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 128, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
16268         void* ret_ptr = untag_ptr(ret);
16269         CHECK_ACCESS(ret_ptr);
16270         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
16271         FREE(untag_ptr(ret));
16272         return ret_conv;
16273 }
16274 bool processing_queue_high_LDKRoutingMessageHandler_jcall(const void* this_arg) {
16275         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16276         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 129, 0, 0, 0, 0, 0, 0);
16277 }
16278 LDKNodeFeatures provided_node_features_LDKRoutingMessageHandler_jcall(const void* this_arg) {
16279         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16280         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 130, 0, 0, 0, 0, 0, 0);
16281         LDKNodeFeatures ret_conv;
16282         ret_conv.inner = untag_ptr(ret);
16283         ret_conv.is_owned = ptr_is_owned(ret);
16284         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
16285         return ret_conv;
16286 }
16287 LDKInitFeatures provided_init_features_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
16288         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16289         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
16290         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
16291         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 131, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
16292         LDKInitFeatures ret_conv;
16293         ret_conv.inner = untag_ptr(ret);
16294         ret_conv.is_owned = ptr_is_owned(ret);
16295         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
16296         return ret_conv;
16297 }
16298 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
16299         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
16300         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16301         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
16302 }
16303 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
16304         LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
16305         atomic_init(&calls->refcnt, 1);
16306         calls->instance_ptr = o;
16307
16308         LDKRoutingMessageHandler ret = {
16309                 .this_arg = (void*) calls,
16310                 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
16311                 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
16312                 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
16313                 .get_next_channel_announcement = get_next_channel_announcement_LDKRoutingMessageHandler_jcall,
16314                 .get_next_node_announcement = get_next_node_announcement_LDKRoutingMessageHandler_jcall,
16315                 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
16316                 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
16317                 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
16318                 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
16319                 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
16320                 .processing_queue_high = processing_queue_high_LDKRoutingMessageHandler_jcall,
16321                 .provided_node_features = provided_node_features_LDKRoutingMessageHandler_jcall,
16322                 .provided_init_features = provided_init_features_LDKRoutingMessageHandler_jcall,
16323                 .free = LDKRoutingMessageHandler_JCalls_free,
16324                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
16325         };
16326         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
16327         return ret;
16328 }
16329 uint64_t  __attribute__((export_name("TS_LDKRoutingMessageHandler_new"))) TS_LDKRoutingMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
16330         LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
16331         *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
16332         return tag_ptr(res_ptr, true);
16333 }
16334 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_node_announcement"))) TS_RoutingMessageHandler_handle_node_announcement(uint64_t this_arg, uint64_t msg) {
16335         void* this_arg_ptr = untag_ptr(this_arg);
16336         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16337         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16338         LDKNodeAnnouncement msg_conv;
16339         msg_conv.inner = untag_ptr(msg);
16340         msg_conv.is_owned = ptr_is_owned(msg);
16341         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16342         msg_conv.is_owned = false;
16343         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
16344         *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
16345         return tag_ptr(ret_conv, true);
16346 }
16347
16348 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_announcement"))) TS_RoutingMessageHandler_handle_channel_announcement(uint64_t this_arg, uint64_t msg) {
16349         void* this_arg_ptr = untag_ptr(this_arg);
16350         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16351         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16352         LDKChannelAnnouncement msg_conv;
16353         msg_conv.inner = untag_ptr(msg);
16354         msg_conv.is_owned = ptr_is_owned(msg);
16355         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16356         msg_conv.is_owned = false;
16357         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
16358         *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
16359         return tag_ptr(ret_conv, true);
16360 }
16361
16362 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_update"))) TS_RoutingMessageHandler_handle_channel_update(uint64_t this_arg, uint64_t msg) {
16363         void* this_arg_ptr = untag_ptr(this_arg);
16364         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16365         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16366         LDKChannelUpdate msg_conv;
16367         msg_conv.inner = untag_ptr(msg);
16368         msg_conv.is_owned = ptr_is_owned(msg);
16369         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16370         msg_conv.is_owned = false;
16371         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
16372         *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
16373         return tag_ptr(ret_conv, true);
16374 }
16375
16376 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) {
16377         void* this_arg_ptr = untag_ptr(this_arg);
16378         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16379         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16380         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
16381         *ret_copy = (this_arg_conv->get_next_channel_announcement)(this_arg_conv->this_arg, starting_point);
16382         uint64_t ret_ref = tag_ptr(ret_copy, true);
16383         return ret_ref;
16384 }
16385
16386 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) {
16387         void* this_arg_ptr = untag_ptr(this_arg);
16388         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16389         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16390         LDKNodeId starting_point_conv;
16391         starting_point_conv.inner = untag_ptr(starting_point);
16392         starting_point_conv.is_owned = ptr_is_owned(starting_point);
16393         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_conv);
16394         starting_point_conv = NodeId_clone(&starting_point_conv);
16395         LDKNodeAnnouncement ret_var = (this_arg_conv->get_next_node_announcement)(this_arg_conv->this_arg, starting_point_conv);
16396         uint64_t ret_ref = 0;
16397         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16398         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16399         return ret_ref;
16400 }
16401
16402 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) {
16403         void* this_arg_ptr = untag_ptr(this_arg);
16404         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16405         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16406         LDKPublicKey their_node_id_ref;
16407         CHECK(their_node_id->arr_len == 33);
16408         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16409         LDKInit init_conv;
16410         init_conv.inner = untag_ptr(init);
16411         init_conv.is_owned = ptr_is_owned(init);
16412         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
16413         init_conv.is_owned = false;
16414         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
16415         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
16416         return tag_ptr(ret_conv, true);
16417 }
16418
16419 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) {
16420         void* this_arg_ptr = untag_ptr(this_arg);
16421         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16422         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16423         LDKPublicKey their_node_id_ref;
16424         CHECK(their_node_id->arr_len == 33);
16425         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16426         LDKReplyChannelRange msg_conv;
16427         msg_conv.inner = untag_ptr(msg);
16428         msg_conv.is_owned = ptr_is_owned(msg);
16429         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16430         msg_conv = ReplyChannelRange_clone(&msg_conv);
16431         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
16432         *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
16433         return tag_ptr(ret_conv, true);
16434 }
16435
16436 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) {
16437         void* this_arg_ptr = untag_ptr(this_arg);
16438         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16439         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16440         LDKPublicKey their_node_id_ref;
16441         CHECK(their_node_id->arr_len == 33);
16442         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16443         LDKReplyShortChannelIdsEnd msg_conv;
16444         msg_conv.inner = untag_ptr(msg);
16445         msg_conv.is_owned = ptr_is_owned(msg);
16446         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16447         msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
16448         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
16449         *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
16450         return tag_ptr(ret_conv, true);
16451 }
16452
16453 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) {
16454         void* this_arg_ptr = untag_ptr(this_arg);
16455         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16456         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16457         LDKPublicKey their_node_id_ref;
16458         CHECK(their_node_id->arr_len == 33);
16459         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16460         LDKQueryChannelRange msg_conv;
16461         msg_conv.inner = untag_ptr(msg);
16462         msg_conv.is_owned = ptr_is_owned(msg);
16463         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16464         msg_conv = QueryChannelRange_clone(&msg_conv);
16465         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
16466         *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
16467         return tag_ptr(ret_conv, true);
16468 }
16469
16470 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) {
16471         void* this_arg_ptr = untag_ptr(this_arg);
16472         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16473         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16474         LDKPublicKey their_node_id_ref;
16475         CHECK(their_node_id->arr_len == 33);
16476         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16477         LDKQueryShortChannelIds msg_conv;
16478         msg_conv.inner = untag_ptr(msg);
16479         msg_conv.is_owned = ptr_is_owned(msg);
16480         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16481         msg_conv = QueryShortChannelIds_clone(&msg_conv);
16482         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
16483         *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
16484         return tag_ptr(ret_conv, true);
16485 }
16486
16487 jboolean  __attribute__((export_name("TS_RoutingMessageHandler_processing_queue_high"))) TS_RoutingMessageHandler_processing_queue_high(uint64_t this_arg) {
16488         void* this_arg_ptr = untag_ptr(this_arg);
16489         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16490         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16491         jboolean ret_conv = (this_arg_conv->processing_queue_high)(this_arg_conv->this_arg);
16492         return ret_conv;
16493 }
16494
16495 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_provided_node_features"))) TS_RoutingMessageHandler_provided_node_features(uint64_t this_arg) {
16496         void* this_arg_ptr = untag_ptr(this_arg);
16497         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16498         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16499         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
16500         uint64_t ret_ref = 0;
16501         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16502         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16503         return ret_ref;
16504 }
16505
16506 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_provided_init_features"))) TS_RoutingMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
16507         void* this_arg_ptr = untag_ptr(this_arg);
16508         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16509         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16510         LDKPublicKey their_node_id_ref;
16511         CHECK(their_node_id->arr_len == 33);
16512         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16513         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
16514         uint64_t ret_ref = 0;
16515         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16516         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16517         return ret_ref;
16518 }
16519
16520 typedef struct LDKOnionMessageHandler_JCalls {
16521         atomic_size_t refcnt;
16522         uint32_t instance_ptr;
16523 } LDKOnionMessageHandler_JCalls;
16524 static void LDKOnionMessageHandler_JCalls_free(void* this_arg) {
16525         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
16526         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16527                 FREE(j_calls);
16528         }
16529 }
16530 LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ get_and_clear_connections_needed_LDKOnionMessageHandler_jcall(const void* this_arg) {
16531         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
16532         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 132, 0, 0, 0, 0, 0, 0);
16533         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ ret_constr;
16534         ret_constr.datalen = ret->arr_len;
16535         if (ret_constr.datalen > 0)
16536                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ Elements");
16537         else
16538                 ret_constr.data = NULL;
16539         uint64_t* ret_vals = ret->elems;
16540         for (size_t o = 0; o < ret_constr.datalen; o++) {
16541                 uint64_t ret_conv_40 = ret_vals[o];
16542                 void* ret_conv_40_ptr = untag_ptr(ret_conv_40);
16543                 CHECK_ACCESS(ret_conv_40_ptr);
16544                 LDKC2Tuple_PublicKeyCVec_SocketAddressZZ ret_conv_40_conv = *(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)(ret_conv_40_ptr);
16545                 FREE(untag_ptr(ret_conv_40));
16546                 ret_constr.data[o] = ret_conv_40_conv;
16547         }
16548         FREE(ret);
16549         return ret_constr;
16550 }
16551 void handle_onion_message_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id, const LDKOnionMessage * msg) {
16552         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
16553         int8_tArray peer_node_id_arr = init_int8_tArray(33, __LINE__);
16554         memcpy(peer_node_id_arr->elems, peer_node_id.compressed_form, 33);
16555         LDKOnionMessage msg_var = *msg;
16556         uint64_t msg_ref = 0;
16557         msg_var = OnionMessage_clone(&msg_var);
16558         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16559         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16560         js_invoke_function_ubuuuu(j_calls->instance_ptr, 133, (uint32_t)peer_node_id_arr, msg_ref, 0, 0, 0, 0);
16561 }
16562 LDKOnionMessage next_onion_message_for_peer_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id) {
16563         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
16564         int8_tArray peer_node_id_arr = init_int8_tArray(33, __LINE__);
16565         memcpy(peer_node_id_arr->elems, peer_node_id.compressed_form, 33);
16566         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 134, (uint32_t)peer_node_id_arr, 0, 0, 0, 0, 0);
16567         LDKOnionMessage ret_conv;
16568         ret_conv.inner = untag_ptr(ret);
16569         ret_conv.is_owned = ptr_is_owned(ret);
16570         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
16571         return ret_conv;
16572 }
16573 LDKCResult_NoneNoneZ peer_connected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
16574         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
16575         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
16576         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
16577         LDKInit init_var = *init;
16578         uint64_t init_ref = 0;
16579         init_var = Init_clone(&init_var);
16580         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
16581         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
16582         jboolean inbound_conv = inbound;
16583         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);
16584         void* ret_ptr = untag_ptr(ret);
16585         CHECK_ACCESS(ret_ptr);
16586         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
16587         FREE(untag_ptr(ret));
16588         return ret_conv;
16589 }
16590 void peer_disconnected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
16591         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
16592         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
16593         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
16594         js_invoke_function_uuuuuu(j_calls->instance_ptr, 136, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
16595 }
16596 void timer_tick_occurred_LDKOnionMessageHandler_jcall(const void* this_arg) {
16597         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
16598         js_invoke_function_uuuuuu(j_calls->instance_ptr, 137, 0, 0, 0, 0, 0, 0);
16599 }
16600 LDKNodeFeatures provided_node_features_LDKOnionMessageHandler_jcall(const void* this_arg) {
16601         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
16602         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 138, 0, 0, 0, 0, 0, 0);
16603         LDKNodeFeatures ret_conv;
16604         ret_conv.inner = untag_ptr(ret);
16605         ret_conv.is_owned = ptr_is_owned(ret);
16606         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
16607         return ret_conv;
16608 }
16609 LDKInitFeatures provided_init_features_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
16610         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
16611         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
16612         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
16613         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 139, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
16614         LDKInitFeatures ret_conv;
16615         ret_conv.inner = untag_ptr(ret);
16616         ret_conv.is_owned = ptr_is_owned(ret);
16617         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
16618         return ret_conv;
16619 }
16620 static void LDKOnionMessageHandler_JCalls_cloned(LDKOnionMessageHandler* new_obj) {
16621         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) new_obj->this_arg;
16622         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16623 }
16624 static inline LDKOnionMessageHandler LDKOnionMessageHandler_init (JSValue o) {
16625         LDKOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOnionMessageHandler_JCalls), "LDKOnionMessageHandler_JCalls");
16626         atomic_init(&calls->refcnt, 1);
16627         calls->instance_ptr = o;
16628
16629         LDKOnionMessageHandler ret = {
16630                 .this_arg = (void*) calls,
16631                 .get_and_clear_connections_needed = get_and_clear_connections_needed_LDKOnionMessageHandler_jcall,
16632                 .handle_onion_message = handle_onion_message_LDKOnionMessageHandler_jcall,
16633                 .next_onion_message_for_peer = next_onion_message_for_peer_LDKOnionMessageHandler_jcall,
16634                 .peer_connected = peer_connected_LDKOnionMessageHandler_jcall,
16635                 .peer_disconnected = peer_disconnected_LDKOnionMessageHandler_jcall,
16636                 .timer_tick_occurred = timer_tick_occurred_LDKOnionMessageHandler_jcall,
16637                 .provided_node_features = provided_node_features_LDKOnionMessageHandler_jcall,
16638                 .provided_init_features = provided_init_features_LDKOnionMessageHandler_jcall,
16639                 .free = LDKOnionMessageHandler_JCalls_free,
16640         };
16641         return ret;
16642 }
16643 uint64_t  __attribute__((export_name("TS_LDKOnionMessageHandler_new"))) TS_LDKOnionMessageHandler_new(JSValue o) {
16644         LDKOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
16645         *res_ptr = LDKOnionMessageHandler_init(o);
16646         return tag_ptr(res_ptr, true);
16647 }
16648 uint64_tArray  __attribute__((export_name("TS_OnionMessageHandler_get_and_clear_connections_needed"))) TS_OnionMessageHandler_get_and_clear_connections_needed(uint64_t this_arg) {
16649         void* this_arg_ptr = untag_ptr(this_arg);
16650         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16651         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
16652         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ ret_var = (this_arg_conv->get_and_clear_connections_needed)(this_arg_conv->this_arg);
16653         uint64_tArray ret_arr = NULL;
16654         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
16655         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
16656         for (size_t o = 0; o < ret_var.datalen; o++) {
16657                 LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
16658                 *ret_conv_40_conv = ret_var.data[o];
16659                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
16660         }
16661         
16662         FREE(ret_var.data);
16663         return ret_arr;
16664 }
16665
16666 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) {
16667         void* this_arg_ptr = untag_ptr(this_arg);
16668         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16669         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
16670         LDKPublicKey peer_node_id_ref;
16671         CHECK(peer_node_id->arr_len == 33);
16672         memcpy(peer_node_id_ref.compressed_form, peer_node_id->elems, 33); FREE(peer_node_id);
16673         LDKOnionMessage msg_conv;
16674         msg_conv.inner = untag_ptr(msg);
16675         msg_conv.is_owned = ptr_is_owned(msg);
16676         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16677         msg_conv.is_owned = false;
16678         (this_arg_conv->handle_onion_message)(this_arg_conv->this_arg, peer_node_id_ref, &msg_conv);
16679 }
16680
16681 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) {
16682         void* this_arg_ptr = untag_ptr(this_arg);
16683         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16684         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
16685         LDKPublicKey peer_node_id_ref;
16686         CHECK(peer_node_id->arr_len == 33);
16687         memcpy(peer_node_id_ref.compressed_form, peer_node_id->elems, 33); FREE(peer_node_id);
16688         LDKOnionMessage ret_var = (this_arg_conv->next_onion_message_for_peer)(this_arg_conv->this_arg, peer_node_id_ref);
16689         uint64_t ret_ref = 0;
16690         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16691         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16692         return ret_ref;
16693 }
16694
16695 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) {
16696         void* this_arg_ptr = untag_ptr(this_arg);
16697         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16698         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
16699         LDKPublicKey their_node_id_ref;
16700         CHECK(their_node_id->arr_len == 33);
16701         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16702         LDKInit init_conv;
16703         init_conv.inner = untag_ptr(init);
16704         init_conv.is_owned = ptr_is_owned(init);
16705         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
16706         init_conv.is_owned = false;
16707         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
16708         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
16709         return tag_ptr(ret_conv, true);
16710 }
16711
16712 void  __attribute__((export_name("TS_OnionMessageHandler_peer_disconnected"))) TS_OnionMessageHandler_peer_disconnected(uint64_t this_arg, int8_tArray their_node_id) {
16713         void* this_arg_ptr = untag_ptr(this_arg);
16714         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16715         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
16716         LDKPublicKey their_node_id_ref;
16717         CHECK(their_node_id->arr_len == 33);
16718         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16719         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
16720 }
16721
16722 void  __attribute__((export_name("TS_OnionMessageHandler_timer_tick_occurred"))) TS_OnionMessageHandler_timer_tick_occurred(uint64_t this_arg) {
16723         void* this_arg_ptr = untag_ptr(this_arg);
16724         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16725         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
16726         (this_arg_conv->timer_tick_occurred)(this_arg_conv->this_arg);
16727 }
16728
16729 uint64_t  __attribute__((export_name("TS_OnionMessageHandler_provided_node_features"))) TS_OnionMessageHandler_provided_node_features(uint64_t this_arg) {
16730         void* this_arg_ptr = untag_ptr(this_arg);
16731         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16732         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
16733         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
16734         uint64_t ret_ref = 0;
16735         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16736         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16737         return ret_ref;
16738 }
16739
16740 uint64_t  __attribute__((export_name("TS_OnionMessageHandler_provided_init_features"))) TS_OnionMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
16741         void* this_arg_ptr = untag_ptr(this_arg);
16742         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16743         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
16744         LDKPublicKey their_node_id_ref;
16745         CHECK(their_node_id->arr_len == 33);
16746         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16747         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
16748         uint64_t ret_ref = 0;
16749         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16750         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16751         return ret_ref;
16752 }
16753
16754 typedef struct LDKCustomMessageReader_JCalls {
16755         atomic_size_t refcnt;
16756         uint32_t instance_ptr;
16757 } LDKCustomMessageReader_JCalls;
16758 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
16759         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
16760         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16761                 FREE(j_calls);
16762         }
16763 }
16764 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
16765         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
16766         int16_t message_type_conv = message_type;
16767         LDKu8slice buffer_var = buffer;
16768         int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
16769         memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
16770         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 140, message_type_conv, (uint32_t)buffer_arr, 0, 0, 0, 0);
16771         void* ret_ptr = untag_ptr(ret);
16772         CHECK_ACCESS(ret_ptr);
16773         LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
16774         FREE(untag_ptr(ret));
16775         return ret_conv;
16776 }
16777 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
16778         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
16779         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16780 }
16781 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JSValue o) {
16782         LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
16783         atomic_init(&calls->refcnt, 1);
16784         calls->instance_ptr = o;
16785
16786         LDKCustomMessageReader ret = {
16787                 .this_arg = (void*) calls,
16788                 .read = read_LDKCustomMessageReader_jcall,
16789                 .free = LDKCustomMessageReader_JCalls_free,
16790         };
16791         return ret;
16792 }
16793 uint64_t  __attribute__((export_name("TS_LDKCustomMessageReader_new"))) TS_LDKCustomMessageReader_new(JSValue o) {
16794         LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
16795         *res_ptr = LDKCustomMessageReader_init(o);
16796         return tag_ptr(res_ptr, true);
16797 }
16798 uint64_t  __attribute__((export_name("TS_CustomMessageReader_read"))) TS_CustomMessageReader_read(uint64_t this_arg, int16_t message_type, int8_tArray buffer) {
16799         void* this_arg_ptr = untag_ptr(this_arg);
16800         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16801         LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
16802         LDKu8slice buffer_ref;
16803         buffer_ref.datalen = buffer->arr_len;
16804         buffer_ref.data = buffer->elems;
16805         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
16806         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
16807         FREE(buffer);
16808         return tag_ptr(ret_conv, true);
16809 }
16810
16811 typedef struct LDKCustomMessageHandler_JCalls {
16812         atomic_size_t refcnt;
16813         uint32_t instance_ptr;
16814         LDKCustomMessageReader_JCalls* CustomMessageReader;
16815 } LDKCustomMessageHandler_JCalls;
16816 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
16817         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
16818         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16819                 FREE(j_calls);
16820         }
16821 }
16822 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
16823         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
16824         LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
16825         *msg_ret = msg;
16826         int8_tArray sender_node_id_arr = init_int8_tArray(33, __LINE__);
16827         memcpy(sender_node_id_arr->elems, sender_node_id.compressed_form, 33);
16828         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);
16829         void* ret_ptr = untag_ptr(ret);
16830         CHECK_ACCESS(ret_ptr);
16831         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
16832         FREE(untag_ptr(ret));
16833         return ret_conv;
16834 }
16835 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
16836         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
16837         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 142, 0, 0, 0, 0, 0, 0);
16838         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
16839         ret_constr.datalen = ret->arr_len;
16840         if (ret_constr.datalen > 0)
16841                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
16842         else
16843                 ret_constr.data = NULL;
16844         uint64_t* ret_vals = ret->elems;
16845         for (size_t z = 0; z < ret_constr.datalen; z++) {
16846                 uint64_t ret_conv_25 = ret_vals[z];
16847                 void* ret_conv_25_ptr = untag_ptr(ret_conv_25);
16848                 CHECK_ACCESS(ret_conv_25_ptr);
16849                 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
16850                 FREE(untag_ptr(ret_conv_25));
16851                 ret_constr.data[z] = ret_conv_25_conv;
16852         }
16853         FREE(ret);
16854         return ret_constr;
16855 }
16856 LDKNodeFeatures provided_node_features_LDKCustomMessageHandler_jcall(const void* this_arg) {
16857         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
16858         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 143, 0, 0, 0, 0, 0, 0);
16859         LDKNodeFeatures ret_conv;
16860         ret_conv.inner = untag_ptr(ret);
16861         ret_conv.is_owned = ptr_is_owned(ret);
16862         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
16863         return ret_conv;
16864 }
16865 LDKInitFeatures provided_init_features_LDKCustomMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
16866         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
16867         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
16868         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
16869         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 144, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
16870         LDKInitFeatures ret_conv;
16871         ret_conv.inner = untag_ptr(ret);
16872         ret_conv.is_owned = ptr_is_owned(ret);
16873         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
16874         return ret_conv;
16875 }
16876 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
16877         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
16878         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16879         atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
16880 }
16881 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JSValue o, JSValue CustomMessageReader) {
16882         LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
16883         atomic_init(&calls->refcnt, 1);
16884         calls->instance_ptr = o;
16885
16886         LDKCustomMessageHandler ret = {
16887                 .this_arg = (void*) calls,
16888                 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
16889                 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
16890                 .provided_node_features = provided_node_features_LDKCustomMessageHandler_jcall,
16891                 .provided_init_features = provided_init_features_LDKCustomMessageHandler_jcall,
16892                 .free = LDKCustomMessageHandler_JCalls_free,
16893                 .CustomMessageReader = LDKCustomMessageReader_init(CustomMessageReader),
16894         };
16895         calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
16896         return ret;
16897 }
16898 uint64_t  __attribute__((export_name("TS_LDKCustomMessageHandler_new"))) TS_LDKCustomMessageHandler_new(JSValue o, JSValue CustomMessageReader) {
16899         LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
16900         *res_ptr = LDKCustomMessageHandler_init(o, CustomMessageReader);
16901         return tag_ptr(res_ptr, true);
16902 }
16903 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) {
16904         void* this_arg_ptr = untag_ptr(this_arg);
16905         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16906         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
16907         void* msg_ptr = untag_ptr(msg);
16908         CHECK_ACCESS(msg_ptr);
16909         LDKType msg_conv = *(LDKType*)(msg_ptr);
16910         if (msg_conv.free == LDKType_JCalls_free) {
16911                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16912                 LDKType_JCalls_cloned(&msg_conv);
16913         }
16914         LDKPublicKey sender_node_id_ref;
16915         CHECK(sender_node_id->arr_len == 33);
16916         memcpy(sender_node_id_ref.compressed_form, sender_node_id->elems, 33); FREE(sender_node_id);
16917         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
16918         *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
16919         return tag_ptr(ret_conv, true);
16920 }
16921
16922 uint64_tArray  __attribute__((export_name("TS_CustomMessageHandler_get_and_clear_pending_msg"))) TS_CustomMessageHandler_get_and_clear_pending_msg(uint64_t this_arg) {
16923         void* this_arg_ptr = untag_ptr(this_arg);
16924         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16925         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
16926         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
16927         uint64_tArray ret_arr = NULL;
16928         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
16929         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
16930         for (size_t z = 0; z < ret_var.datalen; z++) {
16931                 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
16932                 *ret_conv_25_conv = ret_var.data[z];
16933                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
16934         }
16935         
16936         FREE(ret_var.data);
16937         return ret_arr;
16938 }
16939
16940 uint64_t  __attribute__((export_name("TS_CustomMessageHandler_provided_node_features"))) TS_CustomMessageHandler_provided_node_features(uint64_t this_arg) {
16941         void* this_arg_ptr = untag_ptr(this_arg);
16942         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16943         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
16944         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
16945         uint64_t ret_ref = 0;
16946         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16947         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16948         return ret_ref;
16949 }
16950
16951 uint64_t  __attribute__((export_name("TS_CustomMessageHandler_provided_init_features"))) TS_CustomMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
16952         void* this_arg_ptr = untag_ptr(this_arg);
16953         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16954         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
16955         LDKPublicKey their_node_id_ref;
16956         CHECK(their_node_id->arr_len == 33);
16957         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16958         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
16959         uint64_t ret_ref = 0;
16960         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16961         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16962         return ret_ref;
16963 }
16964
16965 typedef struct LDKCustomOnionMessageHandler_JCalls {
16966         atomic_size_t refcnt;
16967         uint32_t instance_ptr;
16968 } LDKCustomOnionMessageHandler_JCalls;
16969 static void LDKCustomOnionMessageHandler_JCalls_free(void* this_arg) {
16970         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
16971         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16972                 FREE(j_calls);
16973         }
16974 }
16975 LDKCOption_OnionMessageContentsZ handle_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, LDKOnionMessageContents msg) {
16976         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
16977         LDKOnionMessageContents* msg_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
16978         *msg_ret = msg;
16979         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 145, tag_ptr(msg_ret, true), 0, 0, 0, 0, 0);
16980         void* ret_ptr = untag_ptr(ret);
16981         CHECK_ACCESS(ret_ptr);
16982         LDKCOption_OnionMessageContentsZ ret_conv = *(LDKCOption_OnionMessageContentsZ*)(ret_ptr);
16983         FREE(untag_ptr(ret));
16984         return ret_conv;
16985 }
16986 LDKCResult_COption_OnionMessageContentsZDecodeErrorZ read_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, uint64_t message_type, LDKu8slice buffer) {
16987         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
16988         int64_t message_type_conv = message_type;
16989         LDKu8slice buffer_var = buffer;
16990         int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
16991         memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
16992         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 146, message_type_conv, (uint32_t)buffer_arr, 0, 0, 0, 0);
16993         void* ret_ptr = untag_ptr(ret);
16994         CHECK_ACCESS(ret_ptr);
16995         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ ret_conv = *(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)(ret_ptr);
16996         FREE(untag_ptr(ret));
16997         return ret_conv;
16998 }
16999 LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ release_pending_custom_messages_LDKCustomOnionMessageHandler_jcall(const void* this_arg) {
17000         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
17001         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 147, 0, 0, 0, 0, 0, 0);
17002         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret_constr;
17003         ret_constr.datalen = ret->arr_len;
17004         if (ret_constr.datalen > 0)
17005                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ Elements");
17006         else
17007                 ret_constr.data = NULL;
17008         uint64_t* ret_vals = ret->elems;
17009         for (size_t e = 0; e < ret_constr.datalen; e++) {
17010                 uint64_t ret_conv_56 = ret_vals[e];
17011                 void* ret_conv_56_ptr = untag_ptr(ret_conv_56);
17012                 CHECK_ACCESS(ret_conv_56_ptr);
17013                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ ret_conv_56_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(ret_conv_56_ptr);
17014                 FREE(untag_ptr(ret_conv_56));
17015                 ret_constr.data[e] = ret_conv_56_conv;
17016         }
17017         FREE(ret);
17018         return ret_constr;
17019 }
17020 static void LDKCustomOnionMessageHandler_JCalls_cloned(LDKCustomOnionMessageHandler* new_obj) {
17021         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) new_obj->this_arg;
17022         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17023 }
17024 static inline LDKCustomOnionMessageHandler LDKCustomOnionMessageHandler_init (JSValue o) {
17025         LDKCustomOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageHandler_JCalls), "LDKCustomOnionMessageHandler_JCalls");
17026         atomic_init(&calls->refcnt, 1);
17027         calls->instance_ptr = o;
17028
17029         LDKCustomOnionMessageHandler ret = {
17030                 .this_arg = (void*) calls,
17031                 .handle_custom_message = handle_custom_message_LDKCustomOnionMessageHandler_jcall,
17032                 .read_custom_message = read_custom_message_LDKCustomOnionMessageHandler_jcall,
17033                 .release_pending_custom_messages = release_pending_custom_messages_LDKCustomOnionMessageHandler_jcall,
17034                 .free = LDKCustomOnionMessageHandler_JCalls_free,
17035         };
17036         return ret;
17037 }
17038 uint64_t  __attribute__((export_name("TS_LDKCustomOnionMessageHandler_new"))) TS_LDKCustomOnionMessageHandler_new(JSValue o) {
17039         LDKCustomOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
17040         *res_ptr = LDKCustomOnionMessageHandler_init(o);
17041         return tag_ptr(res_ptr, true);
17042 }
17043 uint64_t  __attribute__((export_name("TS_CustomOnionMessageHandler_handle_custom_message"))) TS_CustomOnionMessageHandler_handle_custom_message(uint64_t this_arg, uint64_t msg) {
17044         void* this_arg_ptr = untag_ptr(this_arg);
17045         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17046         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
17047         void* msg_ptr = untag_ptr(msg);
17048         CHECK_ACCESS(msg_ptr);
17049         LDKOnionMessageContents msg_conv = *(LDKOnionMessageContents*)(msg_ptr);
17050         if (msg_conv.free == LDKOnionMessageContents_JCalls_free) {
17051                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17052                 LDKOnionMessageContents_JCalls_cloned(&msg_conv);
17053         }
17054         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
17055         *ret_copy = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv);
17056         uint64_t ret_ref = tag_ptr(ret_copy, true);
17057         return ret_ref;
17058 }
17059
17060 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) {
17061         void* this_arg_ptr = untag_ptr(this_arg);
17062         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17063         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
17064         LDKu8slice buffer_ref;
17065         buffer_ref.datalen = buffer->arr_len;
17066         buffer_ref.data = buffer->elems;
17067         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
17068         *ret_conv = (this_arg_conv->read_custom_message)(this_arg_conv->this_arg, message_type, buffer_ref);
17069         FREE(buffer);
17070         return tag_ptr(ret_conv, true);
17071 }
17072
17073 uint64_tArray  __attribute__((export_name("TS_CustomOnionMessageHandler_release_pending_custom_messages"))) TS_CustomOnionMessageHandler_release_pending_custom_messages(uint64_t this_arg) {
17074         void* this_arg_ptr = untag_ptr(this_arg);
17075         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17076         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
17077         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret_var = (this_arg_conv->release_pending_custom_messages)(this_arg_conv->this_arg);
17078         uint64_tArray ret_arr = NULL;
17079         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
17080         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
17081         for (size_t e = 0; e < ret_var.datalen; e++) {
17082                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv_56_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
17083                 *ret_conv_56_conv = ret_var.data[e];
17084                 ret_arr_ptr[e] = tag_ptr(ret_conv_56_conv, true);
17085         }
17086         
17087         FREE(ret_var.data);
17088         return ret_arr;
17089 }
17090
17091 typedef struct LDKSocketDescriptor_JCalls {
17092         atomic_size_t refcnt;
17093         uint32_t instance_ptr;
17094 } LDKSocketDescriptor_JCalls;
17095 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
17096         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
17097         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17098                 FREE(j_calls);
17099         }
17100 }
17101 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
17102         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
17103         LDKu8slice data_var = data;
17104         int8_tArray data_arr = init_int8_tArray(data_var.datalen, __LINE__);
17105         memcpy(data_arr->elems, data_var.data, data_var.datalen);
17106         jboolean resume_read_conv = resume_read;
17107         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 148, (uint32_t)data_arr, resume_read_conv, 0, 0, 0, 0);
17108 }
17109 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
17110         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
17111         js_invoke_function_uuuuuu(j_calls->instance_ptr, 149, 0, 0, 0, 0, 0, 0);
17112 }
17113 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
17114         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
17115         LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
17116         *other_arg_clone = SocketDescriptor_clone(other_arg);
17117         return js_invoke_function_buuuuu(j_calls->instance_ptr, 150, tag_ptr(other_arg_clone, true), 0, 0, 0, 0, 0);
17118 }
17119 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
17120         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
17121         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 151, 0, 0, 0, 0, 0, 0);
17122 }
17123 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
17124         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
17125         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17126 }
17127 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JSValue o) {
17128         LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
17129         atomic_init(&calls->refcnt, 1);
17130         calls->instance_ptr = o;
17131
17132         LDKSocketDescriptor ret = {
17133                 .this_arg = (void*) calls,
17134                 .send_data = send_data_LDKSocketDescriptor_jcall,
17135                 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
17136                 .eq = eq_LDKSocketDescriptor_jcall,
17137                 .hash = hash_LDKSocketDescriptor_jcall,
17138                 .cloned = LDKSocketDescriptor_JCalls_cloned,
17139                 .free = LDKSocketDescriptor_JCalls_free,
17140         };
17141         return ret;
17142 }
17143 uint64_t  __attribute__((export_name("TS_LDKSocketDescriptor_new"))) TS_LDKSocketDescriptor_new(JSValue o) {
17144         LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
17145         *res_ptr = LDKSocketDescriptor_init(o);
17146         return tag_ptr(res_ptr, true);
17147 }
17148 uint32_t  __attribute__((export_name("TS_SocketDescriptor_send_data"))) TS_SocketDescriptor_send_data(uint64_t this_arg, int8_tArray data, jboolean resume_read) {
17149         void* this_arg_ptr = untag_ptr(this_arg);
17150         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17151         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
17152         LDKu8slice data_ref;
17153         data_ref.datalen = data->arr_len;
17154         data_ref.data = data->elems;
17155         uint32_t ret_conv = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
17156         FREE(data);
17157         return ret_conv;
17158 }
17159
17160 void  __attribute__((export_name("TS_SocketDescriptor_disconnect_socket"))) TS_SocketDescriptor_disconnect_socket(uint64_t this_arg) {
17161         void* this_arg_ptr = untag_ptr(this_arg);
17162         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17163         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
17164         (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
17165 }
17166
17167 int64_t  __attribute__((export_name("TS_SocketDescriptor_hash"))) TS_SocketDescriptor_hash(uint64_t this_arg) {
17168         void* this_arg_ptr = untag_ptr(this_arg);
17169         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17170         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
17171         int64_t ret_conv = (this_arg_conv->hash)(this_arg_conv->this_arg);
17172         return ret_conv;
17173 }
17174
17175 typedef struct LDKSignBolt12InvoiceFn_JCalls {
17176         atomic_size_t refcnt;
17177         uint32_t instance_ptr;
17178 } LDKSignBolt12InvoiceFn_JCalls;
17179 static void LDKSignBolt12InvoiceFn_JCalls_free(void* this_arg) {
17180         LDKSignBolt12InvoiceFn_JCalls *j_calls = (LDKSignBolt12InvoiceFn_JCalls*) this_arg;
17181         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17182                 FREE(j_calls);
17183         }
17184 }
17185 LDKCResult_SchnorrSignatureNoneZ sign_invoice_LDKSignBolt12InvoiceFn_jcall(const void* this_arg, const LDKUnsignedBolt12Invoice * message) {
17186         LDKSignBolt12InvoiceFn_JCalls *j_calls = (LDKSignBolt12InvoiceFn_JCalls*) this_arg;
17187         LDKUnsignedBolt12Invoice message_var = *message;
17188         uint64_t message_ref = 0;
17189         message_var = UnsignedBolt12Invoice_clone(&message_var);
17190         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_var);
17191         message_ref = tag_ptr(message_var.inner, message_var.is_owned);
17192         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 152, message_ref, 0, 0, 0, 0, 0);
17193         void* ret_ptr = untag_ptr(ret);
17194         CHECK_ACCESS(ret_ptr);
17195         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
17196         FREE(untag_ptr(ret));
17197         return ret_conv;
17198 }
17199 static void LDKSignBolt12InvoiceFn_JCalls_cloned(LDKSignBolt12InvoiceFn* new_obj) {
17200         LDKSignBolt12InvoiceFn_JCalls *j_calls = (LDKSignBolt12InvoiceFn_JCalls*) new_obj->this_arg;
17201         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17202 }
17203 static inline LDKSignBolt12InvoiceFn LDKSignBolt12InvoiceFn_init (JSValue o) {
17204         LDKSignBolt12InvoiceFn_JCalls *calls = MALLOC(sizeof(LDKSignBolt12InvoiceFn_JCalls), "LDKSignBolt12InvoiceFn_JCalls");
17205         atomic_init(&calls->refcnt, 1);
17206         calls->instance_ptr = o;
17207
17208         LDKSignBolt12InvoiceFn ret = {
17209                 .this_arg = (void*) calls,
17210                 .sign_invoice = sign_invoice_LDKSignBolt12InvoiceFn_jcall,
17211                 .free = LDKSignBolt12InvoiceFn_JCalls_free,
17212         };
17213         return ret;
17214 }
17215 uint64_t  __attribute__((export_name("TS_LDKSignBolt12InvoiceFn_new"))) TS_LDKSignBolt12InvoiceFn_new(JSValue o) {
17216         LDKSignBolt12InvoiceFn *res_ptr = MALLOC(sizeof(LDKSignBolt12InvoiceFn), "LDKSignBolt12InvoiceFn");
17217         *res_ptr = LDKSignBolt12InvoiceFn_init(o);
17218         return tag_ptr(res_ptr, true);
17219 }
17220 uint64_t  __attribute__((export_name("TS_SignBolt12InvoiceFn_sign_invoice"))) TS_SignBolt12InvoiceFn_sign_invoice(uint64_t this_arg, uint64_t message) {
17221         void* this_arg_ptr = untag_ptr(this_arg);
17222         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17223         LDKSignBolt12InvoiceFn* this_arg_conv = (LDKSignBolt12InvoiceFn*)this_arg_ptr;
17224         LDKUnsignedBolt12Invoice message_conv;
17225         message_conv.inner = untag_ptr(message);
17226         message_conv.is_owned = ptr_is_owned(message);
17227         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_conv);
17228         message_conv.is_owned = false;
17229         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
17230         *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, &message_conv);
17231         return tag_ptr(ret_conv, true);
17232 }
17233
17234 typedef struct LDKSignInvoiceRequestFn_JCalls {
17235         atomic_size_t refcnt;
17236         uint32_t instance_ptr;
17237 } LDKSignInvoiceRequestFn_JCalls;
17238 static void LDKSignInvoiceRequestFn_JCalls_free(void* this_arg) {
17239         LDKSignInvoiceRequestFn_JCalls *j_calls = (LDKSignInvoiceRequestFn_JCalls*) this_arg;
17240         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17241                 FREE(j_calls);
17242         }
17243 }
17244 LDKCResult_SchnorrSignatureNoneZ sign_invoice_request_LDKSignInvoiceRequestFn_jcall(const void* this_arg, const LDKUnsignedInvoiceRequest * message) {
17245         LDKSignInvoiceRequestFn_JCalls *j_calls = (LDKSignInvoiceRequestFn_JCalls*) this_arg;
17246         LDKUnsignedInvoiceRequest message_var = *message;
17247         uint64_t message_ref = 0;
17248         message_var = UnsignedInvoiceRequest_clone(&message_var);
17249         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_var);
17250         message_ref = tag_ptr(message_var.inner, message_var.is_owned);
17251         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 153, message_ref, 0, 0, 0, 0, 0);
17252         void* ret_ptr = untag_ptr(ret);
17253         CHECK_ACCESS(ret_ptr);
17254         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
17255         FREE(untag_ptr(ret));
17256         return ret_conv;
17257 }
17258 static void LDKSignInvoiceRequestFn_JCalls_cloned(LDKSignInvoiceRequestFn* new_obj) {
17259         LDKSignInvoiceRequestFn_JCalls *j_calls = (LDKSignInvoiceRequestFn_JCalls*) new_obj->this_arg;
17260         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17261 }
17262 static inline LDKSignInvoiceRequestFn LDKSignInvoiceRequestFn_init (JSValue o) {
17263         LDKSignInvoiceRequestFn_JCalls *calls = MALLOC(sizeof(LDKSignInvoiceRequestFn_JCalls), "LDKSignInvoiceRequestFn_JCalls");
17264         atomic_init(&calls->refcnt, 1);
17265         calls->instance_ptr = o;
17266
17267         LDKSignInvoiceRequestFn ret = {
17268                 .this_arg = (void*) calls,
17269                 .sign_invoice_request = sign_invoice_request_LDKSignInvoiceRequestFn_jcall,
17270                 .free = LDKSignInvoiceRequestFn_JCalls_free,
17271         };
17272         return ret;
17273 }
17274 uint64_t  __attribute__((export_name("TS_LDKSignInvoiceRequestFn_new"))) TS_LDKSignInvoiceRequestFn_new(JSValue o) {
17275         LDKSignInvoiceRequestFn *res_ptr = MALLOC(sizeof(LDKSignInvoiceRequestFn), "LDKSignInvoiceRequestFn");
17276         *res_ptr = LDKSignInvoiceRequestFn_init(o);
17277         return tag_ptr(res_ptr, true);
17278 }
17279 uint64_t  __attribute__((export_name("TS_SignInvoiceRequestFn_sign_invoice_request"))) TS_SignInvoiceRequestFn_sign_invoice_request(uint64_t this_arg, uint64_t message) {
17280         void* this_arg_ptr = untag_ptr(this_arg);
17281         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17282         LDKSignInvoiceRequestFn* this_arg_conv = (LDKSignInvoiceRequestFn*)this_arg_ptr;
17283         LDKUnsignedInvoiceRequest message_conv;
17284         message_conv.inner = untag_ptr(message);
17285         message_conv.is_owned = ptr_is_owned(message);
17286         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_conv);
17287         message_conv.is_owned = false;
17288         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
17289         *ret_conv = (this_arg_conv->sign_invoice_request)(this_arg_conv->this_arg, &message_conv);
17290         return tag_ptr(ret_conv, true);
17291 }
17292
17293 uint32_t __attribute__((export_name("TS_LDKSignError_ty_from_ptr"))) TS_LDKSignError_ty_from_ptr(uint64_t ptr) {
17294         LDKSignError *obj = (LDKSignError*)untag_ptr(ptr);
17295         switch(obj->tag) {
17296                 case LDKSignError_Signing: return 0;
17297                 case LDKSignError_Verification: return 1;
17298                 default: abort();
17299         }
17300 }
17301 uint32_t __attribute__((export_name("TS_LDKSignError_Verification_get_verification"))) TS_LDKSignError_Verification_get_verification(uint64_t ptr) {
17302         LDKSignError *obj = (LDKSignError*)untag_ptr(ptr);
17303         assert(obj->tag == LDKSignError_Verification);
17304         uint32_t verification_conv = LDKSecp256k1Error_to_js(obj->verification);
17305         return verification_conv;
17306 }
17307 uint32_t __attribute__((export_name("TS_LDKEffectiveCapacity_ty_from_ptr"))) TS_LDKEffectiveCapacity_ty_from_ptr(uint64_t ptr) {
17308         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
17309         switch(obj->tag) {
17310                 case LDKEffectiveCapacity_ExactLiquidity: return 0;
17311                 case LDKEffectiveCapacity_AdvertisedMaxHTLC: return 1;
17312                 case LDKEffectiveCapacity_Total: return 2;
17313                 case LDKEffectiveCapacity_Infinite: return 3;
17314                 case LDKEffectiveCapacity_HintMaxHTLC: return 4;
17315                 case LDKEffectiveCapacity_Unknown: return 5;
17316                 default: abort();
17317         }
17318 }
17319 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat"))) TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat(uint64_t ptr) {
17320         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
17321         assert(obj->tag == LDKEffectiveCapacity_ExactLiquidity);
17322         int64_t liquidity_msat_conv = obj->exact_liquidity.liquidity_msat;
17323         return liquidity_msat_conv;
17324 }
17325 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_AdvertisedMaxHTLC_get_amount_msat"))) TS_LDKEffectiveCapacity_AdvertisedMaxHTLC_get_amount_msat(uint64_t ptr) {
17326         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
17327         assert(obj->tag == LDKEffectiveCapacity_AdvertisedMaxHTLC);
17328         int64_t amount_msat_conv = obj->advertised_max_htlc.amount_msat;
17329         return amount_msat_conv;
17330 }
17331 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_capacity_msat"))) TS_LDKEffectiveCapacity_Total_get_capacity_msat(uint64_t ptr) {
17332         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
17333         assert(obj->tag == LDKEffectiveCapacity_Total);
17334         int64_t capacity_msat_conv = obj->total.capacity_msat;
17335         return capacity_msat_conv;
17336 }
17337 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_htlc_maximum_msat"))) TS_LDKEffectiveCapacity_Total_get_htlc_maximum_msat(uint64_t ptr) {
17338         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
17339         assert(obj->tag == LDKEffectiveCapacity_Total);
17340         int64_t htlc_maximum_msat_conv = obj->total.htlc_maximum_msat;
17341         return htlc_maximum_msat_conv;
17342 }
17343 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_HintMaxHTLC_get_amount_msat"))) TS_LDKEffectiveCapacity_HintMaxHTLC_get_amount_msat(uint64_t ptr) {
17344         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
17345         assert(obj->tag == LDKEffectiveCapacity_HintMaxHTLC);
17346         int64_t amount_msat_conv = obj->hint_max_htlc.amount_msat;
17347         return amount_msat_conv;
17348 }
17349 uint32_t __attribute__((export_name("TS_LDKPayee_ty_from_ptr"))) TS_LDKPayee_ty_from_ptr(uint64_t ptr) {
17350         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
17351         switch(obj->tag) {
17352                 case LDKPayee_Blinded: return 0;
17353                 case LDKPayee_Clear: return 1;
17354                 default: abort();
17355         }
17356 }
17357 uint64_tArray __attribute__((export_name("TS_LDKPayee_Blinded_get_route_hints"))) TS_LDKPayee_Blinded_get_route_hints(uint64_t ptr) {
17358         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
17359         assert(obj->tag == LDKPayee_Blinded);
17360         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints_var = obj->blinded.route_hints;
17361                         uint64_tArray route_hints_arr = NULL;
17362                         route_hints_arr = init_uint64_tArray(route_hints_var.datalen, __LINE__);
17363                         uint64_t *route_hints_arr_ptr = (uint64_t*)(((uint8_t*)route_hints_arr) + 8);
17364                         for (size_t l = 0; l < route_hints_var.datalen; l++) {
17365                                 LDKC2Tuple_BlindedPayInfoBlindedPathZ* route_hints_conv_37_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
17366                                 *route_hints_conv_37_conv = route_hints_var.data[l];
17367                                 *route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(route_hints_conv_37_conv);
17368                                 route_hints_arr_ptr[l] = tag_ptr(route_hints_conv_37_conv, true);
17369                         }
17370                         
17371         return route_hints_arr;
17372 }
17373 uint64_t __attribute__((export_name("TS_LDKPayee_Blinded_get_features"))) TS_LDKPayee_Blinded_get_features(uint64_t ptr) {
17374         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
17375         assert(obj->tag == LDKPayee_Blinded);
17376         LDKBolt12InvoiceFeatures features_var = obj->blinded.features;
17377                         uint64_t features_ref = 0;
17378                         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_var);
17379                         features_ref = tag_ptr(features_var.inner, false);
17380         return features_ref;
17381 }
17382 int8_tArray __attribute__((export_name("TS_LDKPayee_Clear_get_node_id"))) TS_LDKPayee_Clear_get_node_id(uint64_t ptr) {
17383         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
17384         assert(obj->tag == LDKPayee_Clear);
17385         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
17386         memcpy(node_id_arr->elems, obj->clear.node_id.compressed_form, 33);
17387         return node_id_arr;
17388 }
17389 uint64_tArray __attribute__((export_name("TS_LDKPayee_Clear_get_route_hints"))) TS_LDKPayee_Clear_get_route_hints(uint64_t ptr) {
17390         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
17391         assert(obj->tag == LDKPayee_Clear);
17392         LDKCVec_RouteHintZ route_hints_var = obj->clear.route_hints;
17393                         uint64_tArray route_hints_arr = NULL;
17394                         route_hints_arr = init_uint64_tArray(route_hints_var.datalen, __LINE__);
17395                         uint64_t *route_hints_arr_ptr = (uint64_t*)(((uint8_t*)route_hints_arr) + 8);
17396                         for (size_t l = 0; l < route_hints_var.datalen; l++) {
17397                                 LDKRouteHint route_hints_conv_11_var = route_hints_var.data[l];
17398                                 uint64_t route_hints_conv_11_ref = 0;
17399                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_conv_11_var);
17400                                 route_hints_conv_11_ref = tag_ptr(route_hints_conv_11_var.inner, false);
17401                                 route_hints_arr_ptr[l] = route_hints_conv_11_ref;
17402                         }
17403                         
17404         return route_hints_arr;
17405 }
17406 uint64_t __attribute__((export_name("TS_LDKPayee_Clear_get_features"))) TS_LDKPayee_Clear_get_features(uint64_t ptr) {
17407         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
17408         assert(obj->tag == LDKPayee_Clear);
17409         LDKBolt11InvoiceFeatures features_var = obj->clear.features;
17410                         uint64_t features_ref = 0;
17411                         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_var);
17412                         features_ref = tag_ptr(features_var.inner, false);
17413         return features_ref;
17414 }
17415 int32_t __attribute__((export_name("TS_LDKPayee_Clear_get_final_cltv_expiry_delta"))) TS_LDKPayee_Clear_get_final_cltv_expiry_delta(uint64_t ptr) {
17416         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
17417         assert(obj->tag == LDKPayee_Clear);
17418         int32_t final_cltv_expiry_delta_conv = obj->clear.final_cltv_expiry_delta;
17419         return final_cltv_expiry_delta_conv;
17420 }
17421 typedef struct LDKScore_JCalls {
17422         atomic_size_t refcnt;
17423         uint32_t instance_ptr;
17424         LDKScoreLookUp_JCalls* ScoreLookUp;
17425         LDKScoreUpdate_JCalls* ScoreUpdate;
17426 } LDKScore_JCalls;
17427 static void LDKScore_JCalls_free(void* this_arg) {
17428         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
17429         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17430                 FREE(j_calls);
17431         }
17432 }
17433 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
17434         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
17435         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 154, 0, 0, 0, 0, 0, 0);
17436         LDKCVec_u8Z ret_ref;
17437         ret_ref.datalen = ret->arr_len;
17438         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
17439         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
17440         return ret_ref;
17441 }
17442 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
17443         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
17444         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17445         atomic_fetch_add_explicit(&j_calls->ScoreLookUp->refcnt, 1, memory_order_release);
17446         atomic_fetch_add_explicit(&j_calls->ScoreUpdate->refcnt, 1, memory_order_release);
17447 }
17448 static inline LDKScore LDKScore_init (JSValue o, JSValue ScoreLookUp, JSValue ScoreUpdate) {
17449         LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
17450         atomic_init(&calls->refcnt, 1);
17451         calls->instance_ptr = o;
17452
17453         LDKScore ret = {
17454                 .this_arg = (void*) calls,
17455                 .write = write_LDKScore_jcall,
17456                 .free = LDKScore_JCalls_free,
17457                 .ScoreLookUp = LDKScoreLookUp_init(ScoreLookUp),
17458                 .ScoreUpdate = LDKScoreUpdate_init(ScoreUpdate),
17459         };
17460         calls->ScoreLookUp = ret.ScoreLookUp.this_arg;
17461         calls->ScoreUpdate = ret.ScoreUpdate.this_arg;
17462         return ret;
17463 }
17464 uint64_t  __attribute__((export_name("TS_LDKScore_new"))) TS_LDKScore_new(JSValue o, JSValue ScoreLookUp, JSValue ScoreUpdate) {
17465         LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
17466         *res_ptr = LDKScore_init(o, ScoreLookUp, ScoreUpdate);
17467         return tag_ptr(res_ptr, true);
17468 }
17469 int8_tArray  __attribute__((export_name("TS_Score_write"))) TS_Score_write(uint64_t this_arg) {
17470         void* this_arg_ptr = untag_ptr(this_arg);
17471         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17472         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
17473         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
17474         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
17475         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
17476         CVec_u8Z_free(ret_var);
17477         return ret_arr;
17478 }
17479
17480 uint32_t __attribute__((export_name("TS_LDKIntroductionNode_ty_from_ptr"))) TS_LDKIntroductionNode_ty_from_ptr(uint64_t ptr) {
17481         LDKIntroductionNode *obj = (LDKIntroductionNode*)untag_ptr(ptr);
17482         switch(obj->tag) {
17483                 case LDKIntroductionNode_NodeId: return 0;
17484                 case LDKIntroductionNode_DirectedShortChannelId: return 1;
17485                 default: abort();
17486         }
17487 }
17488 int8_tArray __attribute__((export_name("TS_LDKIntroductionNode_NodeId_get_node_id"))) TS_LDKIntroductionNode_NodeId_get_node_id(uint64_t ptr) {
17489         LDKIntroductionNode *obj = (LDKIntroductionNode*)untag_ptr(ptr);
17490         assert(obj->tag == LDKIntroductionNode_NodeId);
17491         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
17492         memcpy(node_id_arr->elems, obj->node_id.compressed_form, 33);
17493         return node_id_arr;
17494 }
17495 uint32_t __attribute__((export_name("TS_LDKIntroductionNode_DirectedShortChannelId_get__0"))) TS_LDKIntroductionNode_DirectedShortChannelId_get__0(uint64_t ptr) {
17496         LDKIntroductionNode *obj = (LDKIntroductionNode*)untag_ptr(ptr);
17497         assert(obj->tag == LDKIntroductionNode_DirectedShortChannelId);
17498         uint32_t _0_conv = LDKDirection_to_js(obj->directed_short_channel_id._0);
17499         return _0_conv;
17500 }
17501 int64_t __attribute__((export_name("TS_LDKIntroductionNode_DirectedShortChannelId_get__1"))) TS_LDKIntroductionNode_DirectedShortChannelId_get__1(uint64_t ptr) {
17502         LDKIntroductionNode *obj = (LDKIntroductionNode*)untag_ptr(ptr);
17503         assert(obj->tag == LDKIntroductionNode_DirectedShortChannelId);
17504         int64_t _1_conv = obj->directed_short_channel_id._1;
17505         return _1_conv;
17506 }
17507 typedef struct LDKCoinSelectionSource_JCalls {
17508         atomic_size_t refcnt;
17509         uint32_t instance_ptr;
17510 } LDKCoinSelectionSource_JCalls;
17511 static void LDKCoinSelectionSource_JCalls_free(void* this_arg) {
17512         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
17513         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17514                 FREE(j_calls);
17515         }
17516 }
17517 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) {
17518         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
17519         int8_tArray claim_id_arr = init_int8_tArray(32, __LINE__);
17520         memcpy(claim_id_arr->elems, claim_id.data, 32);
17521         LDKCVec_InputZ must_spend_var = must_spend;
17522         uint64_tArray must_spend_arr = NULL;
17523         must_spend_arr = init_uint64_tArray(must_spend_var.datalen, __LINE__);
17524         uint64_t *must_spend_arr_ptr = (uint64_t*)(((uint8_t*)must_spend_arr) + 8);
17525         for (size_t h = 0; h < must_spend_var.datalen; h++) {
17526                 LDKInput must_spend_conv_7_var = must_spend_var.data[h];
17527                 uint64_t must_spend_conv_7_ref = 0;
17528                 CHECK_INNER_FIELD_ACCESS_OR_NULL(must_spend_conv_7_var);
17529                 must_spend_conv_7_ref = tag_ptr(must_spend_conv_7_var.inner, must_spend_conv_7_var.is_owned);
17530                 must_spend_arr_ptr[h] = must_spend_conv_7_ref;
17531         }
17532         
17533         FREE(must_spend_var.data);
17534         LDKCVec_TxOutZ must_pay_to_var = must_pay_to;
17535         uint64_tArray must_pay_to_arr = NULL;
17536         must_pay_to_arr = init_uint64_tArray(must_pay_to_var.datalen, __LINE__);
17537         uint64_t *must_pay_to_arr_ptr = (uint64_t*)(((uint8_t*)must_pay_to_arr) + 8);
17538         for (size_t h = 0; h < must_pay_to_var.datalen; h++) {
17539                 LDKTxOut* must_pay_to_conv_7_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
17540                 *must_pay_to_conv_7_ref = must_pay_to_var.data[h];
17541                 must_pay_to_arr_ptr[h] = tag_ptr(must_pay_to_conv_7_ref, true);
17542         }
17543         
17544         FREE(must_pay_to_var.data);
17545         int32_t target_feerate_sat_per_1000_weight_conv = target_feerate_sat_per_1000_weight;
17546         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);
17547         void* ret_ptr = untag_ptr(ret);
17548         CHECK_ACCESS(ret_ptr);
17549         LDKCResult_CoinSelectionNoneZ ret_conv = *(LDKCResult_CoinSelectionNoneZ*)(ret_ptr);
17550         FREE(untag_ptr(ret));
17551         return ret_conv;
17552 }
17553 LDKCResult_TransactionNoneZ sign_psbt_LDKCoinSelectionSource_jcall(const void* this_arg, LDKCVec_u8Z psbt) {
17554         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
17555         LDKCVec_u8Z psbt_var = psbt;
17556         int8_tArray psbt_arr = init_int8_tArray(psbt_var.datalen, __LINE__);
17557         memcpy(psbt_arr->elems, psbt_var.data, psbt_var.datalen);
17558         CVec_u8Z_free(psbt_var);
17559         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 156, (uint32_t)psbt_arr, 0, 0, 0, 0, 0);
17560         void* ret_ptr = untag_ptr(ret);
17561         CHECK_ACCESS(ret_ptr);
17562         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
17563         FREE(untag_ptr(ret));
17564         return ret_conv;
17565 }
17566 static void LDKCoinSelectionSource_JCalls_cloned(LDKCoinSelectionSource* new_obj) {
17567         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) new_obj->this_arg;
17568         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17569 }
17570 static inline LDKCoinSelectionSource LDKCoinSelectionSource_init (JSValue o) {
17571         LDKCoinSelectionSource_JCalls *calls = MALLOC(sizeof(LDKCoinSelectionSource_JCalls), "LDKCoinSelectionSource_JCalls");
17572         atomic_init(&calls->refcnt, 1);
17573         calls->instance_ptr = o;
17574
17575         LDKCoinSelectionSource ret = {
17576                 .this_arg = (void*) calls,
17577                 .select_confirmed_utxos = select_confirmed_utxos_LDKCoinSelectionSource_jcall,
17578                 .sign_psbt = sign_psbt_LDKCoinSelectionSource_jcall,
17579                 .free = LDKCoinSelectionSource_JCalls_free,
17580         };
17581         return ret;
17582 }
17583 uint64_t  __attribute__((export_name("TS_LDKCoinSelectionSource_new"))) TS_LDKCoinSelectionSource_new(JSValue o) {
17584         LDKCoinSelectionSource *res_ptr = MALLOC(sizeof(LDKCoinSelectionSource), "LDKCoinSelectionSource");
17585         *res_ptr = LDKCoinSelectionSource_init(o);
17586         return tag_ptr(res_ptr, true);
17587 }
17588 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) {
17589         void* this_arg_ptr = untag_ptr(this_arg);
17590         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17591         LDKCoinSelectionSource* this_arg_conv = (LDKCoinSelectionSource*)this_arg_ptr;
17592         LDKThirtyTwoBytes claim_id_ref;
17593         CHECK(claim_id->arr_len == 32);
17594         memcpy(claim_id_ref.data, claim_id->elems, 32); FREE(claim_id);
17595         LDKCVec_InputZ must_spend_constr;
17596         must_spend_constr.datalen = must_spend->arr_len;
17597         if (must_spend_constr.datalen > 0)
17598                 must_spend_constr.data = MALLOC(must_spend_constr.datalen * sizeof(LDKInput), "LDKCVec_InputZ Elements");
17599         else
17600                 must_spend_constr.data = NULL;
17601         uint64_t* must_spend_vals = must_spend->elems;
17602         for (size_t h = 0; h < must_spend_constr.datalen; h++) {
17603                 uint64_t must_spend_conv_7 = must_spend_vals[h];
17604                 LDKInput must_spend_conv_7_conv;
17605                 must_spend_conv_7_conv.inner = untag_ptr(must_spend_conv_7);
17606                 must_spend_conv_7_conv.is_owned = ptr_is_owned(must_spend_conv_7);
17607                 CHECK_INNER_FIELD_ACCESS_OR_NULL(must_spend_conv_7_conv);
17608                 must_spend_conv_7_conv = Input_clone(&must_spend_conv_7_conv);
17609                 must_spend_constr.data[h] = must_spend_conv_7_conv;
17610         }
17611         FREE(must_spend);
17612         LDKCVec_TxOutZ must_pay_to_constr;
17613         must_pay_to_constr.datalen = must_pay_to->arr_len;
17614         if (must_pay_to_constr.datalen > 0)
17615                 must_pay_to_constr.data = MALLOC(must_pay_to_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
17616         else
17617                 must_pay_to_constr.data = NULL;
17618         uint64_t* must_pay_to_vals = must_pay_to->elems;
17619         for (size_t h = 0; h < must_pay_to_constr.datalen; h++) {
17620                 uint64_t must_pay_to_conv_7 = must_pay_to_vals[h];
17621                 void* must_pay_to_conv_7_ptr = untag_ptr(must_pay_to_conv_7);
17622                 CHECK_ACCESS(must_pay_to_conv_7_ptr);
17623                 LDKTxOut must_pay_to_conv_7_conv = *(LDKTxOut*)(must_pay_to_conv_7_ptr);
17624                 must_pay_to_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(must_pay_to_conv_7));
17625                 must_pay_to_constr.data[h] = must_pay_to_conv_7_conv;
17626         }
17627         FREE(must_pay_to);
17628         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
17629         *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);
17630         return tag_ptr(ret_conv, true);
17631 }
17632
17633 uint64_t  __attribute__((export_name("TS_CoinSelectionSource_sign_psbt"))) TS_CoinSelectionSource_sign_psbt(uint64_t this_arg, int8_tArray psbt) {
17634         void* this_arg_ptr = untag_ptr(this_arg);
17635         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17636         LDKCoinSelectionSource* this_arg_conv = (LDKCoinSelectionSource*)this_arg_ptr;
17637         LDKCVec_u8Z psbt_ref;
17638         psbt_ref.datalen = psbt->arr_len;
17639         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
17640         memcpy(psbt_ref.data, psbt->elems, psbt_ref.datalen); FREE(psbt);
17641         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
17642         *ret_conv = (this_arg_conv->sign_psbt)(this_arg_conv->this_arg, psbt_ref);
17643         return tag_ptr(ret_conv, true);
17644 }
17645
17646 typedef struct LDKWalletSource_JCalls {
17647         atomic_size_t refcnt;
17648         uint32_t instance_ptr;
17649 } LDKWalletSource_JCalls;
17650 static void LDKWalletSource_JCalls_free(void* this_arg) {
17651         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
17652         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17653                 FREE(j_calls);
17654         }
17655 }
17656 LDKCResult_CVec_UtxoZNoneZ list_confirmed_utxos_LDKWalletSource_jcall(const void* this_arg) {
17657         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
17658         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 157, 0, 0, 0, 0, 0, 0);
17659         void* ret_ptr = untag_ptr(ret);
17660         CHECK_ACCESS(ret_ptr);
17661         LDKCResult_CVec_UtxoZNoneZ ret_conv = *(LDKCResult_CVec_UtxoZNoneZ*)(ret_ptr);
17662         FREE(untag_ptr(ret));
17663         return ret_conv;
17664 }
17665 LDKCResult_CVec_u8ZNoneZ get_change_script_LDKWalletSource_jcall(const void* this_arg) {
17666         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
17667         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 158, 0, 0, 0, 0, 0, 0);
17668         void* ret_ptr = untag_ptr(ret);
17669         CHECK_ACCESS(ret_ptr);
17670         LDKCResult_CVec_u8ZNoneZ ret_conv = *(LDKCResult_CVec_u8ZNoneZ*)(ret_ptr);
17671         FREE(untag_ptr(ret));
17672         return ret_conv;
17673 }
17674 LDKCResult_TransactionNoneZ sign_psbt_LDKWalletSource_jcall(const void* this_arg, LDKCVec_u8Z psbt) {
17675         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
17676         LDKCVec_u8Z psbt_var = psbt;
17677         int8_tArray psbt_arr = init_int8_tArray(psbt_var.datalen, __LINE__);
17678         memcpy(psbt_arr->elems, psbt_var.data, psbt_var.datalen);
17679         CVec_u8Z_free(psbt_var);
17680         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 159, (uint32_t)psbt_arr, 0, 0, 0, 0, 0);
17681         void* ret_ptr = untag_ptr(ret);
17682         CHECK_ACCESS(ret_ptr);
17683         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
17684         FREE(untag_ptr(ret));
17685         return ret_conv;
17686 }
17687 static void LDKWalletSource_JCalls_cloned(LDKWalletSource* new_obj) {
17688         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) new_obj->this_arg;
17689         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17690 }
17691 static inline LDKWalletSource LDKWalletSource_init (JSValue o) {
17692         LDKWalletSource_JCalls *calls = MALLOC(sizeof(LDKWalletSource_JCalls), "LDKWalletSource_JCalls");
17693         atomic_init(&calls->refcnt, 1);
17694         calls->instance_ptr = o;
17695
17696         LDKWalletSource ret = {
17697                 .this_arg = (void*) calls,
17698                 .list_confirmed_utxos = list_confirmed_utxos_LDKWalletSource_jcall,
17699                 .get_change_script = get_change_script_LDKWalletSource_jcall,
17700                 .sign_psbt = sign_psbt_LDKWalletSource_jcall,
17701                 .free = LDKWalletSource_JCalls_free,
17702         };
17703         return ret;
17704 }
17705 uint64_t  __attribute__((export_name("TS_LDKWalletSource_new"))) TS_LDKWalletSource_new(JSValue o) {
17706         LDKWalletSource *res_ptr = MALLOC(sizeof(LDKWalletSource), "LDKWalletSource");
17707         *res_ptr = LDKWalletSource_init(o);
17708         return tag_ptr(res_ptr, true);
17709 }
17710 uint64_t  __attribute__((export_name("TS_WalletSource_list_confirmed_utxos"))) TS_WalletSource_list_confirmed_utxos(uint64_t this_arg) {
17711         void* this_arg_ptr = untag_ptr(this_arg);
17712         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17713         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
17714         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
17715         *ret_conv = (this_arg_conv->list_confirmed_utxos)(this_arg_conv->this_arg);
17716         return tag_ptr(ret_conv, true);
17717 }
17718
17719 uint64_t  __attribute__((export_name("TS_WalletSource_get_change_script"))) TS_WalletSource_get_change_script(uint64_t this_arg) {
17720         void* this_arg_ptr = untag_ptr(this_arg);
17721         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17722         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
17723         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
17724         *ret_conv = (this_arg_conv->get_change_script)(this_arg_conv->this_arg);
17725         return tag_ptr(ret_conv, true);
17726 }
17727
17728 uint64_t  __attribute__((export_name("TS_WalletSource_sign_psbt"))) TS_WalletSource_sign_psbt(uint64_t this_arg, int8_tArray psbt) {
17729         void* this_arg_ptr = untag_ptr(this_arg);
17730         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17731         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
17732         LDKCVec_u8Z psbt_ref;
17733         psbt_ref.datalen = psbt->arr_len;
17734         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
17735         memcpy(psbt_ref.data, psbt->elems, psbt_ref.datalen); FREE(psbt);
17736         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
17737         *ret_conv = (this_arg_conv->sign_psbt)(this_arg_conv->this_arg, psbt_ref);
17738         return tag_ptr(ret_conv, true);
17739 }
17740
17741 uint32_t __attribute__((export_name("TS_LDKGossipSync_ty_from_ptr"))) TS_LDKGossipSync_ty_from_ptr(uint64_t ptr) {
17742         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
17743         switch(obj->tag) {
17744                 case LDKGossipSync_P2P: return 0;
17745                 case LDKGossipSync_Rapid: return 1;
17746                 case LDKGossipSync_None: return 2;
17747                 default: abort();
17748         }
17749 }
17750 uint64_t __attribute__((export_name("TS_LDKGossipSync_P2P_get_p2p"))) TS_LDKGossipSync_P2P_get_p2p(uint64_t ptr) {
17751         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
17752         assert(obj->tag == LDKGossipSync_P2P);
17753         LDKP2PGossipSync p2p_var = obj->p2p;
17754                         uint64_t p2p_ref = 0;
17755                         CHECK_INNER_FIELD_ACCESS_OR_NULL(p2p_var);
17756                         p2p_ref = tag_ptr(p2p_var.inner, false);
17757         return p2p_ref;
17758 }
17759 uint64_t __attribute__((export_name("TS_LDKGossipSync_Rapid_get_rapid"))) TS_LDKGossipSync_Rapid_get_rapid(uint64_t ptr) {
17760         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
17761         assert(obj->tag == LDKGossipSync_Rapid);
17762         LDKRapidGossipSync rapid_var = obj->rapid;
17763                         uint64_t rapid_ref = 0;
17764                         CHECK_INNER_FIELD_ACCESS_OR_NULL(rapid_var);
17765                         rapid_ref = tag_ptr(rapid_var.inner, false);
17766         return rapid_ref;
17767 }
17768 uint32_t __attribute__((export_name("TS_LDKFallback_ty_from_ptr"))) TS_LDKFallback_ty_from_ptr(uint64_t ptr) {
17769         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
17770         switch(obj->tag) {
17771                 case LDKFallback_SegWitProgram: return 0;
17772                 case LDKFallback_PubKeyHash: return 1;
17773                 case LDKFallback_ScriptHash: return 2;
17774                 default: abort();
17775         }
17776 }
17777 int8_t __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_version"))) TS_LDKFallback_SegWitProgram_get_version(uint64_t ptr) {
17778         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
17779         assert(obj->tag == LDKFallback_SegWitProgram);
17780         uint8_t version_val = obj->seg_wit_program.version._0;
17781         return version_val;
17782 }
17783 int8_tArray __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_program"))) TS_LDKFallback_SegWitProgram_get_program(uint64_t ptr) {
17784         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
17785         assert(obj->tag == LDKFallback_SegWitProgram);
17786         LDKCVec_u8Z program_var = obj->seg_wit_program.program;
17787                         int8_tArray program_arr = init_int8_tArray(program_var.datalen, __LINE__);
17788                         memcpy(program_arr->elems, program_var.data, program_var.datalen);
17789         return program_arr;
17790 }
17791 int8_tArray __attribute__((export_name("TS_LDKFallback_PubKeyHash_get_pub_key_hash"))) TS_LDKFallback_PubKeyHash_get_pub_key_hash(uint64_t ptr) {
17792         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
17793         assert(obj->tag == LDKFallback_PubKeyHash);
17794         int8_tArray pub_key_hash_arr = init_int8_tArray(20, __LINE__);
17795         memcpy(pub_key_hash_arr->elems, obj->pub_key_hash.data, 20);
17796         return pub_key_hash_arr;
17797 }
17798 int8_tArray __attribute__((export_name("TS_LDKFallback_ScriptHash_get_script_hash"))) TS_LDKFallback_ScriptHash_get_script_hash(uint64_t ptr) {
17799         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
17800         assert(obj->tag == LDKFallback_ScriptHash);
17801         int8_tArray script_hash_arr = init_int8_tArray(20, __LINE__);
17802         memcpy(script_hash_arr->elems, obj->script_hash.data, 20);
17803         return script_hash_arr;
17804 }
17805 jstring  __attribute__((export_name("TS__ldk_get_compiled_version"))) TS__ldk_get_compiled_version() {
17806         LDKStr ret_str = _ldk_get_compiled_version();
17807         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
17808         Str_free(ret_str);
17809         return ret_conv;
17810 }
17811
17812 jstring  __attribute__((export_name("TS__ldk_c_bindings_get_compiled_version"))) TS__ldk_c_bindings_get_compiled_version() {
17813         LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
17814         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
17815         Str_free(ret_str);
17816         return ret_conv;
17817 }
17818
17819 int8_tArray  __attribute__((export_name("TS_U128_le_bytes"))) TS_U128_le_bytes(int8_tArray val) {
17820         LDKU128 val_ref;
17821         CHECK(val->arr_len == 16);
17822         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
17823         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
17824         memcpy(ret_arr->elems, U128_le_bytes(val_ref).data, 16);
17825         return ret_arr;
17826 }
17827
17828 int8_tArray  __attribute__((export_name("TS_U128_new"))) TS_U128_new(int8_tArray le_bytes) {
17829         LDKSixteenBytes le_bytes_ref;
17830         CHECK(le_bytes->arr_len == 16);
17831         memcpy(le_bytes_ref.data, le_bytes->elems, 16); FREE(le_bytes);
17832         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
17833         memcpy(ret_arr->elems, U128_new(le_bytes_ref).le_bytes, 16);
17834         return ret_arr;
17835 }
17836
17837 uint64_t  __attribute__((export_name("TS_WitnessProgram_new"))) TS_WitnessProgram_new(int8_t version, int8_tArray program) {
17838         
17839         LDKCVec_u8Z program_ref;
17840         program_ref.datalen = program->arr_len;
17841         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
17842         memcpy(program_ref.data, program->elems, program_ref.datalen); FREE(program);
17843         LDKWitnessProgram* ret_ref = MALLOC(sizeof(LDKWitnessProgram), "LDKWitnessProgram");
17844         *ret_ref = WitnessProgram_new((LDKWitnessVersion){ ._0 = version }, program_ref);
17845         return tag_ptr(ret_ref, true);
17846 }
17847
17848 int8_t  __attribute__((export_name("TS_WitnessProgram_get_version"))) TS_WitnessProgram_get_version(uint64_t prog) {
17849         LDKWitnessProgram* prog_conv = (LDKWitnessProgram*)untag_ptr(prog);
17850         uint8_t ret_val = WitnessProgram_get_version(prog_conv)._0;
17851         return ret_val;
17852 }
17853
17854 int8_tArray  __attribute__((export_name("TS_WitnessProgram_get_program"))) TS_WitnessProgram_get_program(uint64_t prog) {
17855         LDKWitnessProgram* prog_conv = (LDKWitnessProgram*)untag_ptr(prog);
17856         LDKu8slice ret_var = WitnessProgram_get_program(prog_conv);
17857         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
17858         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
17859         return ret_arr;
17860 }
17861
17862 static inline uint64_t WitnessProgram_clone_ptr(LDKWitnessProgram *NONNULL_PTR arg) {
17863         LDKWitnessProgram* ret_ref = MALLOC(sizeof(LDKWitnessProgram), "LDKWitnessProgram");
17864         *ret_ref = WitnessProgram_clone(arg);
17865         return tag_ptr(ret_ref, true);
17866 }
17867 int64_t  __attribute__((export_name("TS_WitnessProgram_clone_ptr"))) TS_WitnessProgram_clone_ptr(uint64_t arg) {
17868         LDKWitnessProgram* arg_conv = (LDKWitnessProgram*)untag_ptr(arg);
17869         int64_t ret_conv = WitnessProgram_clone_ptr(arg_conv);
17870         return ret_conv;
17871 }
17872
17873 uint64_t  __attribute__((export_name("TS_WitnessProgram_clone"))) TS_WitnessProgram_clone(uint64_t orig) {
17874         LDKWitnessProgram* orig_conv = (LDKWitnessProgram*)untag_ptr(orig);
17875         LDKWitnessProgram* ret_ref = MALLOC(sizeof(LDKWitnessProgram), "LDKWitnessProgram");
17876         *ret_ref = WitnessProgram_clone(orig_conv);
17877         return tag_ptr(ret_ref, true);
17878 }
17879
17880 void  __attribute__((export_name("TS_WitnessProgram_free"))) TS_WitnessProgram_free(uint64_t o) {
17881         if (!ptr_is_owned(o)) return;
17882         void* o_ptr = untag_ptr(o);
17883         CHECK_ACCESS(o_ptr);
17884         LDKWitnessProgram o_conv = *(LDKWitnessProgram*)(o_ptr);
17885         FREE(untag_ptr(o));
17886         WitnessProgram_free(o_conv);
17887 }
17888
17889 uint64_t  __attribute__((export_name("TS_BigEndianScalar_new"))) TS_BigEndianScalar_new(int8_tArray big_endian_bytes) {
17890         LDKThirtyTwoBytes big_endian_bytes_ref;
17891         CHECK(big_endian_bytes->arr_len == 32);
17892         memcpy(big_endian_bytes_ref.data, big_endian_bytes->elems, 32); FREE(big_endian_bytes);
17893         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
17894         *ret_ref = BigEndianScalar_new(big_endian_bytes_ref);
17895         return tag_ptr(ret_ref, true);
17896 }
17897
17898 static inline uint64_t BigEndianScalar_clone_ptr(LDKBigEndianScalar *NONNULL_PTR arg) {
17899         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
17900         *ret_ref = BigEndianScalar_clone(arg);
17901         return tag_ptr(ret_ref, true);
17902 }
17903 int64_t  __attribute__((export_name("TS_BigEndianScalar_clone_ptr"))) TS_BigEndianScalar_clone_ptr(uint64_t arg) {
17904         LDKBigEndianScalar* arg_conv = (LDKBigEndianScalar*)untag_ptr(arg);
17905         int64_t ret_conv = BigEndianScalar_clone_ptr(arg_conv);
17906         return ret_conv;
17907 }
17908
17909 uint64_t  __attribute__((export_name("TS_BigEndianScalar_clone"))) TS_BigEndianScalar_clone(uint64_t orig) {
17910         LDKBigEndianScalar* orig_conv = (LDKBigEndianScalar*)untag_ptr(orig);
17911         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
17912         *ret_ref = BigEndianScalar_clone(orig_conv);
17913         return tag_ptr(ret_ref, true);
17914 }
17915
17916 static inline uint64_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
17917         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
17918         *ret_copy = Bech32Error_clone(arg);
17919         uint64_t ret_ref = tag_ptr(ret_copy, true);
17920         return ret_ref;
17921 }
17922 int64_t  __attribute__((export_name("TS_Bech32Error_clone_ptr"))) TS_Bech32Error_clone_ptr(uint64_t arg) {
17923         LDKBech32Error* arg_conv = (LDKBech32Error*)untag_ptr(arg);
17924         int64_t ret_conv = Bech32Error_clone_ptr(arg_conv);
17925         return ret_conv;
17926 }
17927
17928 uint64_t  __attribute__((export_name("TS_Bech32Error_clone"))) TS_Bech32Error_clone(uint64_t orig) {
17929         LDKBech32Error* orig_conv = (LDKBech32Error*)untag_ptr(orig);
17930         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
17931         *ret_copy = Bech32Error_clone(orig_conv);
17932         uint64_t ret_ref = tag_ptr(ret_copy, true);
17933         return ret_ref;
17934 }
17935
17936 void  __attribute__((export_name("TS_Bech32Error_free"))) TS_Bech32Error_free(uint64_t o) {
17937         if (!ptr_is_owned(o)) return;
17938         void* o_ptr = untag_ptr(o);
17939         CHECK_ACCESS(o_ptr);
17940         LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
17941         FREE(untag_ptr(o));
17942         Bech32Error_free(o_conv);
17943 }
17944
17945 void  __attribute__((export_name("TS_Transaction_free"))) TS_Transaction_free(int8_tArray _res) {
17946         LDKTransaction _res_ref;
17947         _res_ref.datalen = _res->arr_len;
17948         _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
17949         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
17950         _res_ref.data_is_owned = true;
17951         Transaction_free(_res_ref);
17952 }
17953
17954 void  __attribute__((export_name("TS_Witness_free"))) TS_Witness_free(int8_tArray _res) {
17955         LDKWitness _res_ref;
17956         _res_ref.datalen = _res->arr_len;
17957         _res_ref.data = MALLOC(_res_ref.datalen, "LDKWitness Bytes");
17958         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
17959         _res_ref.data_is_owned = true;
17960         Witness_free(_res_ref);
17961 }
17962
17963 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) {
17964         LDKWitness witness_ref;
17965         witness_ref.datalen = witness->arr_len;
17966         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
17967         memcpy(witness_ref.data, witness->elems, witness_ref.datalen); FREE(witness);
17968         witness_ref.data_is_owned = true;
17969         LDKCVec_u8Z script_sig_ref;
17970         script_sig_ref.datalen = script_sig->arr_len;
17971         script_sig_ref.data = MALLOC(script_sig_ref.datalen, "LDKCVec_u8Z Bytes");
17972         memcpy(script_sig_ref.data, script_sig->elems, script_sig_ref.datalen); FREE(script_sig);
17973         LDKThirtyTwoBytes previous_txid_ref;
17974         CHECK(previous_txid->arr_len == 32);
17975         memcpy(previous_txid_ref.data, previous_txid->elems, 32); FREE(previous_txid);
17976         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
17977         *ret_ref = TxIn_new(witness_ref, script_sig_ref, sequence, previous_txid_ref, previous_vout);
17978         return tag_ptr(ret_ref, true);
17979 }
17980
17981 int8_tArray  __attribute__((export_name("TS_TxIn_get_witness"))) TS_TxIn_get_witness(uint64_t txin) {
17982         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
17983         LDKWitness ret_var = TxIn_get_witness(txin_conv);
17984         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
17985         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
17986         Witness_free(ret_var);
17987         return ret_arr;
17988 }
17989
17990 int8_tArray  __attribute__((export_name("TS_TxIn_get_script_sig"))) TS_TxIn_get_script_sig(uint64_t txin) {
17991         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
17992         LDKu8slice ret_var = TxIn_get_script_sig(txin_conv);
17993         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
17994         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
17995         return ret_arr;
17996 }
17997
17998 int32_t  __attribute__((export_name("TS_TxIn_get_sequence"))) TS_TxIn_get_sequence(uint64_t txin) {
17999         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
18000         int32_t ret_conv = TxIn_get_sequence(txin_conv);
18001         return ret_conv;
18002 }
18003
18004 int8_tArray  __attribute__((export_name("TS_TxIn_get_previous_txid"))) TS_TxIn_get_previous_txid(uint64_t txin) {
18005         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
18006         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
18007         memcpy(ret_arr->elems, TxIn_get_previous_txid(txin_conv).data, 32);
18008         return ret_arr;
18009 }
18010
18011 int32_t  __attribute__((export_name("TS_TxIn_get_previous_vout"))) TS_TxIn_get_previous_vout(uint64_t txin) {
18012         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
18013         int32_t ret_conv = TxIn_get_previous_vout(txin_conv);
18014         return ret_conv;
18015 }
18016
18017 void  __attribute__((export_name("TS_TxIn_free"))) TS_TxIn_free(uint64_t _res) {
18018         if (!ptr_is_owned(_res)) return;
18019         void* _res_ptr = untag_ptr(_res);
18020         CHECK_ACCESS(_res_ptr);
18021         LDKTxIn _res_conv = *(LDKTxIn*)(_res_ptr);
18022         FREE(untag_ptr(_res));
18023         TxIn_free(_res_conv);
18024 }
18025
18026 uint64_t  __attribute__((export_name("TS_TxOut_new"))) TS_TxOut_new(int8_tArray script_pubkey, int64_t value) {
18027         LDKCVec_u8Z script_pubkey_ref;
18028         script_pubkey_ref.datalen = script_pubkey->arr_len;
18029         script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
18030         memcpy(script_pubkey_ref.data, script_pubkey->elems, script_pubkey_ref.datalen); FREE(script_pubkey);
18031         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
18032         *ret_ref = TxOut_new(script_pubkey_ref, value);
18033         return tag_ptr(ret_ref, true);
18034 }
18035
18036 int8_tArray  __attribute__((export_name("TS_TxOut_get_script_pubkey"))) TS_TxOut_get_script_pubkey(uint64_t txout) {
18037         LDKTxOut* txout_conv = (LDKTxOut*)untag_ptr(txout);
18038         LDKu8slice ret_var = TxOut_get_script_pubkey(txout_conv);
18039         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
18040         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
18041         return ret_arr;
18042 }
18043
18044 int64_t  __attribute__((export_name("TS_TxOut_get_value"))) TS_TxOut_get_value(uint64_t txout) {
18045         LDKTxOut* txout_conv = (LDKTxOut*)untag_ptr(txout);
18046         int64_t ret_conv = TxOut_get_value(txout_conv);
18047         return ret_conv;
18048 }
18049
18050 void  __attribute__((export_name("TS_TxOut_free"))) TS_TxOut_free(uint64_t _res) {
18051         if (!ptr_is_owned(_res)) return;
18052         void* _res_ptr = untag_ptr(_res);
18053         CHECK_ACCESS(_res_ptr);
18054         LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
18055         FREE(untag_ptr(_res));
18056         TxOut_free(_res_conv);
18057 }
18058
18059 static inline uint64_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
18060         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
18061         *ret_ref = TxOut_clone(arg);
18062         return tag_ptr(ret_ref, true);
18063 }
18064 int64_t  __attribute__((export_name("TS_TxOut_clone_ptr"))) TS_TxOut_clone_ptr(uint64_t arg) {
18065         LDKTxOut* arg_conv = (LDKTxOut*)untag_ptr(arg);
18066         int64_t ret_conv = TxOut_clone_ptr(arg_conv);
18067         return ret_conv;
18068 }
18069
18070 uint64_t  __attribute__((export_name("TS_TxOut_clone"))) TS_TxOut_clone(uint64_t orig) {
18071         LDKTxOut* orig_conv = (LDKTxOut*)untag_ptr(orig);
18072         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
18073         *ret_ref = TxOut_clone(orig_conv);
18074         return tag_ptr(ret_ref, true);
18075 }
18076
18077 void  __attribute__((export_name("TS_Str_free"))) TS_Str_free(jstring _res) {
18078         LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
18079         Str_free(dummy);
18080 }
18081
18082 void  __attribute__((export_name("TS_CVec_u8Z_free"))) TS_CVec_u8Z_free(int8_tArray _res) {
18083         LDKCVec_u8Z _res_ref;
18084         _res_ref.datalen = _res->arr_len;
18085         _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
18086         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
18087         CVec_u8Z_free(_res_ref);
18088 }
18089
18090 uint64_t  __attribute__((export_name("TS_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_ok"))) TS_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_ok(uint64_t o) {
18091         LDKRefundMaybeWithDerivedMetadataBuilder o_conv;
18092         o_conv.inner = untag_ptr(o);
18093         o_conv.is_owned = ptr_is_owned(o);
18094         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18095         o_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&o_conv);
18096         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
18097         *ret_conv = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_ok(o_conv);
18098         return tag_ptr(ret_conv, true);
18099 }
18100
18101 uint64_t  __attribute__((export_name("TS_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_err"))) TS_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_err(uint32_t e) {
18102         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_js(e);
18103         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
18104         *ret_conv = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_err(e_conv);
18105         return tag_ptr(ret_conv, true);
18106 }
18107
18108 jboolean  __attribute__((export_name("TS_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_is_ok"))) TS_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_is_ok(uint64_t o) {
18109         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* o_conv = (LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(o);
18110         jboolean ret_conv = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_is_ok(o_conv);
18111         return ret_conv;
18112 }
18113
18114 void  __attribute__((export_name("TS_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_free"))) TS_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_free(uint64_t _res) {
18115         if (!ptr_is_owned(_res)) return;
18116         void* _res_ptr = untag_ptr(_res);
18117         CHECK_ACCESS(_res_ptr);
18118         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ _res_conv = *(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ*)(_res_ptr);
18119         FREE(untag_ptr(_res));
18120         CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_free(_res_conv);
18121 }
18122
18123 static inline uint64_t CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone_ptr(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR arg) {
18124         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
18125         *ret_conv = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(arg);
18126         return tag_ptr(ret_conv, true);
18127 }
18128 int64_t  __attribute__((export_name("TS_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone_ptr"))) TS_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone_ptr(uint64_t arg) {
18129         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* arg_conv = (LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(arg);
18130         int64_t ret_conv = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone_ptr(arg_conv);
18131         return ret_conv;
18132 }
18133
18134 uint64_t  __attribute__((export_name("TS_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone"))) TS_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(uint64_t orig) {
18135         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* orig_conv = (LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(orig);
18136         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
18137         *ret_conv = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(orig_conv);
18138         return tag_ptr(ret_conv, true);
18139 }
18140
18141 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12SemanticErrorZ_ok"))) TS_CResult_RefundBolt12SemanticErrorZ_ok(uint64_t o) {
18142         LDKRefund o_conv;
18143         o_conv.inner = untag_ptr(o);
18144         o_conv.is_owned = ptr_is_owned(o);
18145         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18146         o_conv = Refund_clone(&o_conv);
18147         LDKCResult_RefundBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12SemanticErrorZ), "LDKCResult_RefundBolt12SemanticErrorZ");
18148         *ret_conv = CResult_RefundBolt12SemanticErrorZ_ok(o_conv);
18149         return tag_ptr(ret_conv, true);
18150 }
18151
18152 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12SemanticErrorZ_err"))) TS_CResult_RefundBolt12SemanticErrorZ_err(uint32_t e) {
18153         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_js(e);
18154         LDKCResult_RefundBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12SemanticErrorZ), "LDKCResult_RefundBolt12SemanticErrorZ");
18155         *ret_conv = CResult_RefundBolt12SemanticErrorZ_err(e_conv);
18156         return tag_ptr(ret_conv, true);
18157 }
18158
18159 jboolean  __attribute__((export_name("TS_CResult_RefundBolt12SemanticErrorZ_is_ok"))) TS_CResult_RefundBolt12SemanticErrorZ_is_ok(uint64_t o) {
18160         LDKCResult_RefundBolt12SemanticErrorZ* o_conv = (LDKCResult_RefundBolt12SemanticErrorZ*)untag_ptr(o);
18161         jboolean ret_conv = CResult_RefundBolt12SemanticErrorZ_is_ok(o_conv);
18162         return ret_conv;
18163 }
18164
18165 void  __attribute__((export_name("TS_CResult_RefundBolt12SemanticErrorZ_free"))) TS_CResult_RefundBolt12SemanticErrorZ_free(uint64_t _res) {
18166         if (!ptr_is_owned(_res)) return;
18167         void* _res_ptr = untag_ptr(_res);
18168         CHECK_ACCESS(_res_ptr);
18169         LDKCResult_RefundBolt12SemanticErrorZ _res_conv = *(LDKCResult_RefundBolt12SemanticErrorZ*)(_res_ptr);
18170         FREE(untag_ptr(_res));
18171         CResult_RefundBolt12SemanticErrorZ_free(_res_conv);
18172 }
18173
18174 static inline uint64_t CResult_RefundBolt12SemanticErrorZ_clone_ptr(LDKCResult_RefundBolt12SemanticErrorZ *NONNULL_PTR arg) {
18175         LDKCResult_RefundBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12SemanticErrorZ), "LDKCResult_RefundBolt12SemanticErrorZ");
18176         *ret_conv = CResult_RefundBolt12SemanticErrorZ_clone(arg);
18177         return tag_ptr(ret_conv, true);
18178 }
18179 int64_t  __attribute__((export_name("TS_CResult_RefundBolt12SemanticErrorZ_clone_ptr"))) TS_CResult_RefundBolt12SemanticErrorZ_clone_ptr(uint64_t arg) {
18180         LDKCResult_RefundBolt12SemanticErrorZ* arg_conv = (LDKCResult_RefundBolt12SemanticErrorZ*)untag_ptr(arg);
18181         int64_t ret_conv = CResult_RefundBolt12SemanticErrorZ_clone_ptr(arg_conv);
18182         return ret_conv;
18183 }
18184
18185 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12SemanticErrorZ_clone"))) TS_CResult_RefundBolt12SemanticErrorZ_clone(uint64_t orig) {
18186         LDKCResult_RefundBolt12SemanticErrorZ* orig_conv = (LDKCResult_RefundBolt12SemanticErrorZ*)untag_ptr(orig);
18187         LDKCResult_RefundBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12SemanticErrorZ), "LDKCResult_RefundBolt12SemanticErrorZ");
18188         *ret_conv = CResult_RefundBolt12SemanticErrorZ_clone(orig_conv);
18189         return tag_ptr(ret_conv, true);
18190 }
18191
18192 uint64_t  __attribute__((export_name("TS_COption_u64Z_some"))) TS_COption_u64Z_some(int64_t o) {
18193         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
18194         *ret_copy = COption_u64Z_some(o);
18195         uint64_t ret_ref = tag_ptr(ret_copy, true);
18196         return ret_ref;
18197 }
18198
18199 uint64_t  __attribute__((export_name("TS_COption_u64Z_none"))) TS_COption_u64Z_none() {
18200         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
18201         *ret_copy = COption_u64Z_none();
18202         uint64_t ret_ref = tag_ptr(ret_copy, true);
18203         return ret_ref;
18204 }
18205
18206 void  __attribute__((export_name("TS_COption_u64Z_free"))) TS_COption_u64Z_free(uint64_t _res) {
18207         if (!ptr_is_owned(_res)) return;
18208         void* _res_ptr = untag_ptr(_res);
18209         CHECK_ACCESS(_res_ptr);
18210         LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
18211         FREE(untag_ptr(_res));
18212         COption_u64Z_free(_res_conv);
18213 }
18214
18215 static inline uint64_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
18216         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
18217         *ret_copy = COption_u64Z_clone(arg);
18218         uint64_t ret_ref = tag_ptr(ret_copy, true);
18219         return ret_ref;
18220 }
18221 int64_t  __attribute__((export_name("TS_COption_u64Z_clone_ptr"))) TS_COption_u64Z_clone_ptr(uint64_t arg) {
18222         LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)untag_ptr(arg);
18223         int64_t ret_conv = COption_u64Z_clone_ptr(arg_conv);
18224         return ret_conv;
18225 }
18226
18227 uint64_t  __attribute__((export_name("TS_COption_u64Z_clone"))) TS_COption_u64Z_clone(uint64_t orig) {
18228         LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)untag_ptr(orig);
18229         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
18230         *ret_copy = COption_u64Z_clone(orig_conv);
18231         uint64_t ret_ref = tag_ptr(ret_copy, true);
18232         return ret_ref;
18233 }
18234
18235 void  __attribute__((export_name("TS_CVec_BlindedPathZ_free"))) TS_CVec_BlindedPathZ_free(uint64_tArray _res) {
18236         LDKCVec_BlindedPathZ _res_constr;
18237         _res_constr.datalen = _res->arr_len;
18238         if (_res_constr.datalen > 0)
18239                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedPath), "LDKCVec_BlindedPathZ Elements");
18240         else
18241                 _res_constr.data = NULL;
18242         uint64_t* _res_vals = _res->elems;
18243         for (size_t n = 0; n < _res_constr.datalen; n++) {
18244                 uint64_t _res_conv_13 = _res_vals[n];
18245                 LDKBlindedPath _res_conv_13_conv;
18246                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
18247                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
18248                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
18249                 _res_constr.data[n] = _res_conv_13_conv;
18250         }
18251         FREE(_res);
18252         CVec_BlindedPathZ_free(_res_constr);
18253 }
18254
18255 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_ok"))) TS_CResult_RefundBolt12ParseErrorZ_ok(uint64_t o) {
18256         LDKRefund o_conv;
18257         o_conv.inner = untag_ptr(o);
18258         o_conv.is_owned = ptr_is_owned(o);
18259         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18260         o_conv = Refund_clone(&o_conv);
18261         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
18262         *ret_conv = CResult_RefundBolt12ParseErrorZ_ok(o_conv);
18263         return tag_ptr(ret_conv, true);
18264 }
18265
18266 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_err"))) TS_CResult_RefundBolt12ParseErrorZ_err(uint64_t e) {
18267         LDKBolt12ParseError e_conv;
18268         e_conv.inner = untag_ptr(e);
18269         e_conv.is_owned = ptr_is_owned(e);
18270         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18271         e_conv = Bolt12ParseError_clone(&e_conv);
18272         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
18273         *ret_conv = CResult_RefundBolt12ParseErrorZ_err(e_conv);
18274         return tag_ptr(ret_conv, true);
18275 }
18276
18277 jboolean  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_is_ok"))) TS_CResult_RefundBolt12ParseErrorZ_is_ok(uint64_t o) {
18278         LDKCResult_RefundBolt12ParseErrorZ* o_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(o);
18279         jboolean ret_conv = CResult_RefundBolt12ParseErrorZ_is_ok(o_conv);
18280         return ret_conv;
18281 }
18282
18283 void  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_free"))) TS_CResult_RefundBolt12ParseErrorZ_free(uint64_t _res) {
18284         if (!ptr_is_owned(_res)) return;
18285         void* _res_ptr = untag_ptr(_res);
18286         CHECK_ACCESS(_res_ptr);
18287         LDKCResult_RefundBolt12ParseErrorZ _res_conv = *(LDKCResult_RefundBolt12ParseErrorZ*)(_res_ptr);
18288         FREE(untag_ptr(_res));
18289         CResult_RefundBolt12ParseErrorZ_free(_res_conv);
18290 }
18291
18292 static inline uint64_t CResult_RefundBolt12ParseErrorZ_clone_ptr(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR arg) {
18293         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
18294         *ret_conv = CResult_RefundBolt12ParseErrorZ_clone(arg);
18295         return tag_ptr(ret_conv, true);
18296 }
18297 int64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_clone_ptr"))) TS_CResult_RefundBolt12ParseErrorZ_clone_ptr(uint64_t arg) {
18298         LDKCResult_RefundBolt12ParseErrorZ* arg_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(arg);
18299         int64_t ret_conv = CResult_RefundBolt12ParseErrorZ_clone_ptr(arg_conv);
18300         return ret_conv;
18301 }
18302
18303 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_clone"))) TS_CResult_RefundBolt12ParseErrorZ_clone(uint64_t orig) {
18304         LDKCResult_RefundBolt12ParseErrorZ* orig_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(orig);
18305         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
18306         *ret_conv = CResult_RefundBolt12ParseErrorZ_clone(orig_conv);
18307         return tag_ptr(ret_conv, true);
18308 }
18309
18310 uint64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_ok"))) TS_CResult_RetryDecodeErrorZ_ok(uint64_t o) {
18311         void* o_ptr = untag_ptr(o);
18312         CHECK_ACCESS(o_ptr);
18313         LDKRetry o_conv = *(LDKRetry*)(o_ptr);
18314         o_conv = Retry_clone((LDKRetry*)untag_ptr(o));
18315         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
18316         *ret_conv = CResult_RetryDecodeErrorZ_ok(o_conv);
18317         return tag_ptr(ret_conv, true);
18318 }
18319
18320 uint64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_err"))) TS_CResult_RetryDecodeErrorZ_err(uint64_t e) {
18321         void* e_ptr = untag_ptr(e);
18322         CHECK_ACCESS(e_ptr);
18323         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18324         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18325         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
18326         *ret_conv = CResult_RetryDecodeErrorZ_err(e_conv);
18327         return tag_ptr(ret_conv, true);
18328 }
18329
18330 jboolean  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_is_ok"))) TS_CResult_RetryDecodeErrorZ_is_ok(uint64_t o) {
18331         LDKCResult_RetryDecodeErrorZ* o_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(o);
18332         jboolean ret_conv = CResult_RetryDecodeErrorZ_is_ok(o_conv);
18333         return ret_conv;
18334 }
18335
18336 void  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_free"))) TS_CResult_RetryDecodeErrorZ_free(uint64_t _res) {
18337         if (!ptr_is_owned(_res)) return;
18338         void* _res_ptr = untag_ptr(_res);
18339         CHECK_ACCESS(_res_ptr);
18340         LDKCResult_RetryDecodeErrorZ _res_conv = *(LDKCResult_RetryDecodeErrorZ*)(_res_ptr);
18341         FREE(untag_ptr(_res));
18342         CResult_RetryDecodeErrorZ_free(_res_conv);
18343 }
18344
18345 static inline uint64_t CResult_RetryDecodeErrorZ_clone_ptr(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR arg) {
18346         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
18347         *ret_conv = CResult_RetryDecodeErrorZ_clone(arg);
18348         return tag_ptr(ret_conv, true);
18349 }
18350 int64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_clone_ptr"))) TS_CResult_RetryDecodeErrorZ_clone_ptr(uint64_t arg) {
18351         LDKCResult_RetryDecodeErrorZ* arg_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(arg);
18352         int64_t ret_conv = CResult_RetryDecodeErrorZ_clone_ptr(arg_conv);
18353         return ret_conv;
18354 }
18355
18356 uint64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_clone"))) TS_CResult_RetryDecodeErrorZ_clone(uint64_t orig) {
18357         LDKCResult_RetryDecodeErrorZ* orig_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(orig);
18358         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
18359         *ret_conv = CResult_RetryDecodeErrorZ_clone(orig_conv);
18360         return tag_ptr(ret_conv, true);
18361 }
18362
18363 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_ok"))) TS_CResult_NoneAPIErrorZ_ok() {
18364         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18365         *ret_conv = CResult_NoneAPIErrorZ_ok();
18366         return tag_ptr(ret_conv, true);
18367 }
18368
18369 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_err"))) TS_CResult_NoneAPIErrorZ_err(uint64_t e) {
18370         void* e_ptr = untag_ptr(e);
18371         CHECK_ACCESS(e_ptr);
18372         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
18373         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
18374         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18375         *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
18376         return tag_ptr(ret_conv, true);
18377 }
18378
18379 jboolean  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_is_ok"))) TS_CResult_NoneAPIErrorZ_is_ok(uint64_t o) {
18380         LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(o);
18381         jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv);
18382         return ret_conv;
18383 }
18384
18385 void  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_free"))) TS_CResult_NoneAPIErrorZ_free(uint64_t _res) {
18386         if (!ptr_is_owned(_res)) return;
18387         void* _res_ptr = untag_ptr(_res);
18388         CHECK_ACCESS(_res_ptr);
18389         LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
18390         FREE(untag_ptr(_res));
18391         CResult_NoneAPIErrorZ_free(_res_conv);
18392 }
18393
18394 static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
18395         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18396         *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
18397         return tag_ptr(ret_conv, true);
18398 }
18399 int64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone_ptr"))) TS_CResult_NoneAPIErrorZ_clone_ptr(uint64_t arg) {
18400         LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(arg);
18401         int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
18402         return ret_conv;
18403 }
18404
18405 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone"))) TS_CResult_NoneAPIErrorZ_clone(uint64_t orig) {
18406         LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(orig);
18407         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18408         *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
18409         return tag_ptr(ret_conv, true);
18410 }
18411
18412 void  __attribute__((export_name("TS_CVec_CResult_NoneAPIErrorZZ_free"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint64_tArray _res) {
18413         LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
18414         _res_constr.datalen = _res->arr_len;
18415         if (_res_constr.datalen > 0)
18416                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
18417         else
18418                 _res_constr.data = NULL;
18419         uint64_t* _res_vals = _res->elems;
18420         for (size_t w = 0; w < _res_constr.datalen; w++) {
18421                 uint64_t _res_conv_22 = _res_vals[w];
18422                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
18423                 CHECK_ACCESS(_res_conv_22_ptr);
18424                 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
18425                 FREE(untag_ptr(_res_conv_22));
18426                 _res_constr.data[w] = _res_conv_22_conv;
18427         }
18428         FREE(_res);
18429         CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
18430 }
18431
18432 void  __attribute__((export_name("TS_CVec_APIErrorZ_free"))) TS_CVec_APIErrorZ_free(uint64_tArray _res) {
18433         LDKCVec_APIErrorZ _res_constr;
18434         _res_constr.datalen = _res->arr_len;
18435         if (_res_constr.datalen > 0)
18436                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
18437         else
18438                 _res_constr.data = NULL;
18439         uint64_t* _res_vals = _res->elems;
18440         for (size_t k = 0; k < _res_constr.datalen; k++) {
18441                 uint64_t _res_conv_10 = _res_vals[k];
18442                 void* _res_conv_10_ptr = untag_ptr(_res_conv_10);
18443                 CHECK_ACCESS(_res_conv_10_ptr);
18444                 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
18445                 FREE(untag_ptr(_res_conv_10));
18446                 _res_constr.data[k] = _res_conv_10_conv;
18447         }
18448         FREE(_res);
18449         CVec_APIErrorZ_free(_res_constr);
18450 }
18451
18452 uint64_t  __attribute__((export_name("TS_COption_ThirtyTwoBytesZ_some"))) TS_COption_ThirtyTwoBytesZ_some(int8_tArray o) {
18453         LDKThirtyTwoBytes o_ref;
18454         CHECK(o->arr_len == 32);
18455         memcpy(o_ref.data, o->elems, 32); FREE(o);
18456         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
18457         *ret_copy = COption_ThirtyTwoBytesZ_some(o_ref);
18458         uint64_t ret_ref = tag_ptr(ret_copy, true);
18459         return ret_ref;
18460 }
18461
18462 uint64_t  __attribute__((export_name("TS_COption_ThirtyTwoBytesZ_none"))) TS_COption_ThirtyTwoBytesZ_none() {
18463         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
18464         *ret_copy = COption_ThirtyTwoBytesZ_none();
18465         uint64_t ret_ref = tag_ptr(ret_copy, true);
18466         return ret_ref;
18467 }
18468
18469 void  __attribute__((export_name("TS_COption_ThirtyTwoBytesZ_free"))) TS_COption_ThirtyTwoBytesZ_free(uint64_t _res) {
18470         if (!ptr_is_owned(_res)) return;
18471         void* _res_ptr = untag_ptr(_res);
18472         CHECK_ACCESS(_res_ptr);
18473         LDKCOption_ThirtyTwoBytesZ _res_conv = *(LDKCOption_ThirtyTwoBytesZ*)(_res_ptr);
18474         FREE(untag_ptr(_res));
18475         COption_ThirtyTwoBytesZ_free(_res_conv);
18476 }
18477
18478 static inline uint64_t COption_ThirtyTwoBytesZ_clone_ptr(LDKCOption_ThirtyTwoBytesZ *NONNULL_PTR arg) {
18479         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
18480         *ret_copy = COption_ThirtyTwoBytesZ_clone(arg);
18481         uint64_t ret_ref = tag_ptr(ret_copy, true);
18482         return ret_ref;
18483 }
18484 int64_t  __attribute__((export_name("TS_COption_ThirtyTwoBytesZ_clone_ptr"))) TS_COption_ThirtyTwoBytesZ_clone_ptr(uint64_t arg) {
18485         LDKCOption_ThirtyTwoBytesZ* arg_conv = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(arg);
18486         int64_t ret_conv = COption_ThirtyTwoBytesZ_clone_ptr(arg_conv);
18487         return ret_conv;
18488 }
18489
18490 uint64_t  __attribute__((export_name("TS_COption_ThirtyTwoBytesZ_clone"))) TS_COption_ThirtyTwoBytesZ_clone(uint64_t orig) {
18491         LDKCOption_ThirtyTwoBytesZ* orig_conv = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(orig);
18492         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
18493         *ret_copy = COption_ThirtyTwoBytesZ_clone(orig_conv);
18494         uint64_t ret_ref = tag_ptr(ret_copy, true);
18495         return ret_ref;
18496 }
18497
18498 uint64_t  __attribute__((export_name("TS_COption_CVec_u8ZZ_some"))) TS_COption_CVec_u8ZZ_some(int8_tArray o) {
18499         LDKCVec_u8Z o_ref;
18500         o_ref.datalen = o->arr_len;
18501         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
18502         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
18503         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
18504         *ret_copy = COption_CVec_u8ZZ_some(o_ref);
18505         uint64_t ret_ref = tag_ptr(ret_copy, true);
18506         return ret_ref;
18507 }
18508
18509 uint64_t  __attribute__((export_name("TS_COption_CVec_u8ZZ_none"))) TS_COption_CVec_u8ZZ_none() {
18510         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
18511         *ret_copy = COption_CVec_u8ZZ_none();
18512         uint64_t ret_ref = tag_ptr(ret_copy, true);
18513         return ret_ref;
18514 }
18515
18516 void  __attribute__((export_name("TS_COption_CVec_u8ZZ_free"))) TS_COption_CVec_u8ZZ_free(uint64_t _res) {
18517         if (!ptr_is_owned(_res)) return;
18518         void* _res_ptr = untag_ptr(_res);
18519         CHECK_ACCESS(_res_ptr);
18520         LDKCOption_CVec_u8ZZ _res_conv = *(LDKCOption_CVec_u8ZZ*)(_res_ptr);
18521         FREE(untag_ptr(_res));
18522         COption_CVec_u8ZZ_free(_res_conv);
18523 }
18524
18525 static inline uint64_t COption_CVec_u8ZZ_clone_ptr(LDKCOption_CVec_u8ZZ *NONNULL_PTR arg) {
18526         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
18527         *ret_copy = COption_CVec_u8ZZ_clone(arg);
18528         uint64_t ret_ref = tag_ptr(ret_copy, true);
18529         return ret_ref;
18530 }
18531 int64_t  __attribute__((export_name("TS_COption_CVec_u8ZZ_clone_ptr"))) TS_COption_CVec_u8ZZ_clone_ptr(uint64_t arg) {
18532         LDKCOption_CVec_u8ZZ* arg_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(arg);
18533         int64_t ret_conv = COption_CVec_u8ZZ_clone_ptr(arg_conv);
18534         return ret_conv;
18535 }
18536
18537 uint64_t  __attribute__((export_name("TS_COption_CVec_u8ZZ_clone"))) TS_COption_CVec_u8ZZ_clone(uint64_t orig) {
18538         LDKCOption_CVec_u8ZZ* orig_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(orig);
18539         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
18540         *ret_copy = COption_CVec_u8ZZ_clone(orig_conv);
18541         uint64_t ret_ref = tag_ptr(ret_copy, true);
18542         return ret_ref;
18543 }
18544
18545 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_ok"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_ok(uint64_t o) {
18546         LDKRecipientOnionFields o_conv;
18547         o_conv.inner = untag_ptr(o);
18548         o_conv.is_owned = ptr_is_owned(o);
18549         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18550         o_conv = RecipientOnionFields_clone(&o_conv);
18551         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
18552         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_ok(o_conv);
18553         return tag_ptr(ret_conv, true);
18554 }
18555
18556 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_err"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_err(uint64_t e) {
18557         void* e_ptr = untag_ptr(e);
18558         CHECK_ACCESS(e_ptr);
18559         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18560         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18561         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
18562         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_err(e_conv);
18563         return tag_ptr(ret_conv, true);
18564 }
18565
18566 jboolean  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_is_ok"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(uint64_t o) {
18567         LDKCResult_RecipientOnionFieldsDecodeErrorZ* o_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(o);
18568         jboolean ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(o_conv);
18569         return ret_conv;
18570 }
18571
18572 void  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_free"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_free(uint64_t _res) {
18573         if (!ptr_is_owned(_res)) return;
18574         void* _res_ptr = untag_ptr(_res);
18575         CHECK_ACCESS(_res_ptr);
18576         LDKCResult_RecipientOnionFieldsDecodeErrorZ _res_conv = *(LDKCResult_RecipientOnionFieldsDecodeErrorZ*)(_res_ptr);
18577         FREE(untag_ptr(_res));
18578         CResult_RecipientOnionFieldsDecodeErrorZ_free(_res_conv);
18579 }
18580
18581 static inline uint64_t CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR arg) {
18582         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
18583         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(arg);
18584         return tag_ptr(ret_conv, true);
18585 }
18586 int64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(uint64_t arg) {
18587         LDKCResult_RecipientOnionFieldsDecodeErrorZ* arg_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(arg);
18588         int64_t ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(arg_conv);
18589         return ret_conv;
18590 }
18591
18592 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_clone"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_clone(uint64_t orig) {
18593         LDKCResult_RecipientOnionFieldsDecodeErrorZ* orig_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(orig);
18594         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
18595         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(orig_conv);
18596         return tag_ptr(ret_conv, true);
18597 }
18598
18599 static inline uint64_t C2Tuple_u64CVec_u8ZZ_clone_ptr(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR arg) {
18600         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
18601         *ret_conv = C2Tuple_u64CVec_u8ZZ_clone(arg);
18602         return tag_ptr(ret_conv, true);
18603 }
18604 int64_t  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_clone_ptr"))) TS_C2Tuple_u64CVec_u8ZZ_clone_ptr(uint64_t arg) {
18605         LDKC2Tuple_u64CVec_u8ZZ* arg_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(arg);
18606         int64_t ret_conv = C2Tuple_u64CVec_u8ZZ_clone_ptr(arg_conv);
18607         return ret_conv;
18608 }
18609
18610 uint64_t  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_clone"))) TS_C2Tuple_u64CVec_u8ZZ_clone(uint64_t orig) {
18611         LDKC2Tuple_u64CVec_u8ZZ* orig_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(orig);
18612         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
18613         *ret_conv = C2Tuple_u64CVec_u8ZZ_clone(orig_conv);
18614         return tag_ptr(ret_conv, true);
18615 }
18616
18617 uint64_t  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_new"))) TS_C2Tuple_u64CVec_u8ZZ_new(int64_t a, int8_tArray b) {
18618         LDKCVec_u8Z b_ref;
18619         b_ref.datalen = b->arr_len;
18620         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
18621         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
18622         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
18623         *ret_conv = C2Tuple_u64CVec_u8ZZ_new(a, b_ref);
18624         return tag_ptr(ret_conv, true);
18625 }
18626
18627 void  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_free"))) TS_C2Tuple_u64CVec_u8ZZ_free(uint64_t _res) {
18628         if (!ptr_is_owned(_res)) return;
18629         void* _res_ptr = untag_ptr(_res);
18630         CHECK_ACCESS(_res_ptr);
18631         LDKC2Tuple_u64CVec_u8ZZ _res_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(_res_ptr);
18632         FREE(untag_ptr(_res));
18633         C2Tuple_u64CVec_u8ZZ_free(_res_conv);
18634 }
18635
18636 void  __attribute__((export_name("TS_CVec_C2Tuple_u64CVec_u8ZZZ_free"))) TS_CVec_C2Tuple_u64CVec_u8ZZZ_free(uint64_tArray _res) {
18637         LDKCVec_C2Tuple_u64CVec_u8ZZZ _res_constr;
18638         _res_constr.datalen = _res->arr_len;
18639         if (_res_constr.datalen > 0)
18640                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
18641         else
18642                 _res_constr.data = NULL;
18643         uint64_t* _res_vals = _res->elems;
18644         for (size_t x = 0; x < _res_constr.datalen; x++) {
18645                 uint64_t _res_conv_23 = _res_vals[x];
18646                 void* _res_conv_23_ptr = untag_ptr(_res_conv_23);
18647                 CHECK_ACCESS(_res_conv_23_ptr);
18648                 LDKC2Tuple_u64CVec_u8ZZ _res_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(_res_conv_23_ptr);
18649                 FREE(untag_ptr(_res_conv_23));
18650                 _res_constr.data[x] = _res_conv_23_conv;
18651         }
18652         FREE(_res);
18653         CVec_C2Tuple_u64CVec_u8ZZZ_free(_res_constr);
18654 }
18655
18656 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_ok"))) TS_CResult_RecipientOnionFieldsNoneZ_ok(uint64_t o) {
18657         LDKRecipientOnionFields o_conv;
18658         o_conv.inner = untag_ptr(o);
18659         o_conv.is_owned = ptr_is_owned(o);
18660         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18661         o_conv = RecipientOnionFields_clone(&o_conv);
18662         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
18663         *ret_conv = CResult_RecipientOnionFieldsNoneZ_ok(o_conv);
18664         return tag_ptr(ret_conv, true);
18665 }
18666
18667 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_err"))) TS_CResult_RecipientOnionFieldsNoneZ_err() {
18668         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
18669         *ret_conv = CResult_RecipientOnionFieldsNoneZ_err();
18670         return tag_ptr(ret_conv, true);
18671 }
18672
18673 jboolean  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_is_ok"))) TS_CResult_RecipientOnionFieldsNoneZ_is_ok(uint64_t o) {
18674         LDKCResult_RecipientOnionFieldsNoneZ* o_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(o);
18675         jboolean ret_conv = CResult_RecipientOnionFieldsNoneZ_is_ok(o_conv);
18676         return ret_conv;
18677 }
18678
18679 void  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_free"))) TS_CResult_RecipientOnionFieldsNoneZ_free(uint64_t _res) {
18680         if (!ptr_is_owned(_res)) return;
18681         void* _res_ptr = untag_ptr(_res);
18682         CHECK_ACCESS(_res_ptr);
18683         LDKCResult_RecipientOnionFieldsNoneZ _res_conv = *(LDKCResult_RecipientOnionFieldsNoneZ*)(_res_ptr);
18684         FREE(untag_ptr(_res));
18685         CResult_RecipientOnionFieldsNoneZ_free(_res_conv);
18686 }
18687
18688 static inline uint64_t CResult_RecipientOnionFieldsNoneZ_clone_ptr(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR arg) {
18689         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
18690         *ret_conv = CResult_RecipientOnionFieldsNoneZ_clone(arg);
18691         return tag_ptr(ret_conv, true);
18692 }
18693 int64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_clone_ptr"))) TS_CResult_RecipientOnionFieldsNoneZ_clone_ptr(uint64_t arg) {
18694         LDKCResult_RecipientOnionFieldsNoneZ* arg_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(arg);
18695         int64_t ret_conv = CResult_RecipientOnionFieldsNoneZ_clone_ptr(arg_conv);
18696         return ret_conv;
18697 }
18698
18699 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_clone"))) TS_CResult_RecipientOnionFieldsNoneZ_clone(uint64_t orig) {
18700         LDKCResult_RecipientOnionFieldsNoneZ* orig_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(orig);
18701         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
18702         *ret_conv = CResult_RecipientOnionFieldsNoneZ_clone(orig_conv);
18703         return tag_ptr(ret_conv, true);
18704 }
18705
18706 uint64_t  __attribute__((export_name("TS_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_ok"))) TS_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_ok(uint64_t o) {
18707         LDKUnsignedBolt12Invoice o_conv;
18708         o_conv.inner = untag_ptr(o);
18709         o_conv.is_owned = ptr_is_owned(o);
18710         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18711         o_conv = UnsignedBolt12Invoice_clone(&o_conv);
18712         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ");
18713         *ret_conv = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_ok(o_conv);
18714         return tag_ptr(ret_conv, true);
18715 }
18716
18717 uint64_t  __attribute__((export_name("TS_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_err"))) TS_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_err(uint32_t e) {
18718         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_js(e);
18719         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ");
18720         *ret_conv = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_err(e_conv);
18721         return tag_ptr(ret_conv, true);
18722 }
18723
18724 jboolean  __attribute__((export_name("TS_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_is_ok"))) TS_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_is_ok(uint64_t o) {
18725         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* o_conv = (LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(o);
18726         jboolean ret_conv = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_is_ok(o_conv);
18727         return ret_conv;
18728 }
18729
18730 void  __attribute__((export_name("TS_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_free"))) TS_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_free(uint64_t _res) {
18731         if (!ptr_is_owned(_res)) return;
18732         void* _res_ptr = untag_ptr(_res);
18733         CHECK_ACCESS(_res_ptr);
18734         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ _res_conv = *(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ*)(_res_ptr);
18735         FREE(untag_ptr(_res));
18736         CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_free(_res_conv);
18737 }
18738
18739 static inline uint64_t CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone_ptr(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR arg) {
18740         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ");
18741         *ret_conv = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone(arg);
18742         return tag_ptr(ret_conv, true);
18743 }
18744 int64_t  __attribute__((export_name("TS_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone_ptr"))) TS_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone_ptr(uint64_t arg) {
18745         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* arg_conv = (LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(arg);
18746         int64_t ret_conv = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone_ptr(arg_conv);
18747         return ret_conv;
18748 }
18749
18750 uint64_t  __attribute__((export_name("TS_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone"))) TS_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone(uint64_t orig) {
18751         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* orig_conv = (LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(orig);
18752         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ");
18753         *ret_conv = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone(orig_conv);
18754         return tag_ptr(ret_conv, true);
18755 }
18756
18757 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceBolt12SemanticErrorZ_ok"))) TS_CResult_Bolt12InvoiceBolt12SemanticErrorZ_ok(uint64_t o) {
18758         LDKBolt12Invoice o_conv;
18759         o_conv.inner = untag_ptr(o);
18760         o_conv.is_owned = ptr_is_owned(o);
18761         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18762         o_conv = Bolt12Invoice_clone(&o_conv);
18763         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ");
18764         *ret_conv = CResult_Bolt12InvoiceBolt12SemanticErrorZ_ok(o_conv);
18765         return tag_ptr(ret_conv, true);
18766 }
18767
18768 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceBolt12SemanticErrorZ_err"))) TS_CResult_Bolt12InvoiceBolt12SemanticErrorZ_err(uint32_t e) {
18769         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_js(e);
18770         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ");
18771         *ret_conv = CResult_Bolt12InvoiceBolt12SemanticErrorZ_err(e_conv);
18772         return tag_ptr(ret_conv, true);
18773 }
18774
18775 jboolean  __attribute__((export_name("TS_CResult_Bolt12InvoiceBolt12SemanticErrorZ_is_ok"))) TS_CResult_Bolt12InvoiceBolt12SemanticErrorZ_is_ok(uint64_t o) {
18776         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* o_conv = (LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(o);
18777         jboolean ret_conv = CResult_Bolt12InvoiceBolt12SemanticErrorZ_is_ok(o_conv);
18778         return ret_conv;
18779 }
18780
18781 void  __attribute__((export_name("TS_CResult_Bolt12InvoiceBolt12SemanticErrorZ_free"))) TS_CResult_Bolt12InvoiceBolt12SemanticErrorZ_free(uint64_t _res) {
18782         if (!ptr_is_owned(_res)) return;
18783         void* _res_ptr = untag_ptr(_res);
18784         CHECK_ACCESS(_res_ptr);
18785         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ _res_conv = *(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ*)(_res_ptr);
18786         FREE(untag_ptr(_res));
18787         CResult_Bolt12InvoiceBolt12SemanticErrorZ_free(_res_conv);
18788 }
18789
18790 static inline uint64_t CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone_ptr(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR arg) {
18791         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ");
18792         *ret_conv = CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone(arg);
18793         return tag_ptr(ret_conv, true);
18794 }
18795 int64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone_ptr"))) TS_CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone_ptr(uint64_t arg) {
18796         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* arg_conv = (LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(arg);
18797         int64_t ret_conv = CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone_ptr(arg_conv);
18798         return ret_conv;
18799 }
18800
18801 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone"))) TS_CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone(uint64_t orig) {
18802         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* orig_conv = (LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(orig);
18803         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ");
18804         *ret_conv = CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone(orig_conv);
18805         return tag_ptr(ret_conv, true);
18806 }
18807
18808 uint64_t  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_ok"))) TS_CResult_SchnorrSignatureNoneZ_ok(int8_tArray o) {
18809         LDKSchnorrSignature o_ref;
18810         CHECK(o->arr_len == 64);
18811         memcpy(o_ref.compact_form, o->elems, 64); FREE(o);
18812         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
18813         *ret_conv = CResult_SchnorrSignatureNoneZ_ok(o_ref);
18814         return tag_ptr(ret_conv, true);
18815 }
18816
18817 uint64_t  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_err"))) TS_CResult_SchnorrSignatureNoneZ_err() {
18818         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
18819         *ret_conv = CResult_SchnorrSignatureNoneZ_err();
18820         return tag_ptr(ret_conv, true);
18821 }
18822
18823 jboolean  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_is_ok"))) TS_CResult_SchnorrSignatureNoneZ_is_ok(uint64_t o) {
18824         LDKCResult_SchnorrSignatureNoneZ* o_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(o);
18825         jboolean ret_conv = CResult_SchnorrSignatureNoneZ_is_ok(o_conv);
18826         return ret_conv;
18827 }
18828
18829 void  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_free"))) TS_CResult_SchnorrSignatureNoneZ_free(uint64_t _res) {
18830         if (!ptr_is_owned(_res)) return;
18831         void* _res_ptr = untag_ptr(_res);
18832         CHECK_ACCESS(_res_ptr);
18833         LDKCResult_SchnorrSignatureNoneZ _res_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(_res_ptr);
18834         FREE(untag_ptr(_res));
18835         CResult_SchnorrSignatureNoneZ_free(_res_conv);
18836 }
18837
18838 static inline uint64_t CResult_SchnorrSignatureNoneZ_clone_ptr(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR arg) {
18839         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
18840         *ret_conv = CResult_SchnorrSignatureNoneZ_clone(arg);
18841         return tag_ptr(ret_conv, true);
18842 }
18843 int64_t  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_clone_ptr"))) TS_CResult_SchnorrSignatureNoneZ_clone_ptr(uint64_t arg) {
18844         LDKCResult_SchnorrSignatureNoneZ* arg_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(arg);
18845         int64_t ret_conv = CResult_SchnorrSignatureNoneZ_clone_ptr(arg_conv);
18846         return ret_conv;
18847 }
18848
18849 uint64_t  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_clone"))) TS_CResult_SchnorrSignatureNoneZ_clone(uint64_t orig) {
18850         LDKCResult_SchnorrSignatureNoneZ* orig_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(orig);
18851         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
18852         *ret_conv = CResult_SchnorrSignatureNoneZ_clone(orig_conv);
18853         return tag_ptr(ret_conv, true);
18854 }
18855
18856 void  __attribute__((export_name("TS_CVec_ThirtyTwoBytesZ_free"))) TS_CVec_ThirtyTwoBytesZ_free(ptrArray _res) {
18857         LDKCVec_ThirtyTwoBytesZ _res_constr;
18858         _res_constr.datalen = _res->arr_len;
18859         if (_res_constr.datalen > 0)
18860                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
18861         else
18862                 _res_constr.data = NULL;
18863         int8_tArray* _res_vals = (void*) _res->elems;
18864         for (size_t m = 0; m < _res_constr.datalen; m++) {
18865                 int8_tArray _res_conv_12 = _res_vals[m];
18866                 LDKThirtyTwoBytes _res_conv_12_ref;
18867                 CHECK(_res_conv_12->arr_len == 32);
18868                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
18869                 _res_constr.data[m] = _res_conv_12_ref;
18870         }
18871         FREE(_res);
18872         CVec_ThirtyTwoBytesZ_free(_res_constr);
18873 }
18874
18875 uint64_t  __attribute__((export_name("TS_COption_CVec_ThirtyTwoBytesZZ_some"))) TS_COption_CVec_ThirtyTwoBytesZZ_some(ptrArray o) {
18876         LDKCVec_ThirtyTwoBytesZ o_constr;
18877         o_constr.datalen = o->arr_len;
18878         if (o_constr.datalen > 0)
18879                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
18880         else
18881                 o_constr.data = NULL;
18882         int8_tArray* o_vals = (void*) o->elems;
18883         for (size_t m = 0; m < o_constr.datalen; m++) {
18884                 int8_tArray o_conv_12 = o_vals[m];
18885                 LDKThirtyTwoBytes o_conv_12_ref;
18886                 CHECK(o_conv_12->arr_len == 32);
18887                 memcpy(o_conv_12_ref.data, o_conv_12->elems, 32); FREE(o_conv_12);
18888                 o_constr.data[m] = o_conv_12_ref;
18889         }
18890         FREE(o);
18891         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
18892         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_some(o_constr);
18893         uint64_t ret_ref = tag_ptr(ret_copy, true);
18894         return ret_ref;
18895 }
18896
18897 uint64_t  __attribute__((export_name("TS_COption_CVec_ThirtyTwoBytesZZ_none"))) TS_COption_CVec_ThirtyTwoBytesZZ_none() {
18898         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
18899         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_none();
18900         uint64_t ret_ref = tag_ptr(ret_copy, true);
18901         return ret_ref;
18902 }
18903
18904 void  __attribute__((export_name("TS_COption_CVec_ThirtyTwoBytesZZ_free"))) TS_COption_CVec_ThirtyTwoBytesZZ_free(uint64_t _res) {
18905         if (!ptr_is_owned(_res)) return;
18906         void* _res_ptr = untag_ptr(_res);
18907         CHECK_ACCESS(_res_ptr);
18908         LDKCOption_CVec_ThirtyTwoBytesZZ _res_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(_res_ptr);
18909         FREE(untag_ptr(_res));
18910         COption_CVec_ThirtyTwoBytesZZ_free(_res_conv);
18911 }
18912
18913 static inline uint64_t COption_CVec_ThirtyTwoBytesZZ_clone_ptr(LDKCOption_CVec_ThirtyTwoBytesZZ *NONNULL_PTR arg) {
18914         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
18915         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_clone(arg);
18916         uint64_t ret_ref = tag_ptr(ret_copy, true);
18917         return ret_ref;
18918 }
18919 int64_t  __attribute__((export_name("TS_COption_CVec_ThirtyTwoBytesZZ_clone_ptr"))) TS_COption_CVec_ThirtyTwoBytesZZ_clone_ptr(uint64_t arg) {
18920         LDKCOption_CVec_ThirtyTwoBytesZZ* arg_conv = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(arg);
18921         int64_t ret_conv = COption_CVec_ThirtyTwoBytesZZ_clone_ptr(arg_conv);
18922         return ret_conv;
18923 }
18924
18925 uint64_t  __attribute__((export_name("TS_COption_CVec_ThirtyTwoBytesZZ_clone"))) TS_COption_CVec_ThirtyTwoBytesZZ_clone(uint64_t orig) {
18926         LDKCOption_CVec_ThirtyTwoBytesZZ* orig_conv = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(orig);
18927         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
18928         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_clone(orig_conv);
18929         uint64_t ret_ref = tag_ptr(ret_copy, true);
18930         return ret_ref;
18931 }
18932
18933 uint64_t  __attribute__((export_name("TS_COption_AmountZ_some"))) TS_COption_AmountZ_some(uint64_t o) {
18934         void* o_ptr = untag_ptr(o);
18935         CHECK_ACCESS(o_ptr);
18936         LDKAmount o_conv = *(LDKAmount*)(o_ptr);
18937         o_conv = Amount_clone((LDKAmount*)untag_ptr(o));
18938         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
18939         *ret_copy = COption_AmountZ_some(o_conv);
18940         uint64_t ret_ref = tag_ptr(ret_copy, true);
18941         return ret_ref;
18942 }
18943
18944 uint64_t  __attribute__((export_name("TS_COption_AmountZ_none"))) TS_COption_AmountZ_none() {
18945         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
18946         *ret_copy = COption_AmountZ_none();
18947         uint64_t ret_ref = tag_ptr(ret_copy, true);
18948         return ret_ref;
18949 }
18950
18951 void  __attribute__((export_name("TS_COption_AmountZ_free"))) TS_COption_AmountZ_free(uint64_t _res) {
18952         if (!ptr_is_owned(_res)) return;
18953         void* _res_ptr = untag_ptr(_res);
18954         CHECK_ACCESS(_res_ptr);
18955         LDKCOption_AmountZ _res_conv = *(LDKCOption_AmountZ*)(_res_ptr);
18956         FREE(untag_ptr(_res));
18957         COption_AmountZ_free(_res_conv);
18958 }
18959
18960 static inline uint64_t COption_AmountZ_clone_ptr(LDKCOption_AmountZ *NONNULL_PTR arg) {
18961         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
18962         *ret_copy = COption_AmountZ_clone(arg);
18963         uint64_t ret_ref = tag_ptr(ret_copy, true);
18964         return ret_ref;
18965 }
18966 int64_t  __attribute__((export_name("TS_COption_AmountZ_clone_ptr"))) TS_COption_AmountZ_clone_ptr(uint64_t arg) {
18967         LDKCOption_AmountZ* arg_conv = (LDKCOption_AmountZ*)untag_ptr(arg);
18968         int64_t ret_conv = COption_AmountZ_clone_ptr(arg_conv);
18969         return ret_conv;
18970 }
18971
18972 uint64_t  __attribute__((export_name("TS_COption_AmountZ_clone"))) TS_COption_AmountZ_clone(uint64_t orig) {
18973         LDKCOption_AmountZ* orig_conv = (LDKCOption_AmountZ*)untag_ptr(orig);
18974         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
18975         *ret_copy = COption_AmountZ_clone(orig_conv);
18976         uint64_t ret_ref = tag_ptr(ret_copy, true);
18977         return ret_ref;
18978 }
18979
18980 uint64_t  __attribute__((export_name("TS_COption_QuantityZ_some"))) TS_COption_QuantityZ_some(uint64_t o) {
18981         void* o_ptr = untag_ptr(o);
18982         CHECK_ACCESS(o_ptr);
18983         LDKQuantity o_conv = *(LDKQuantity*)(o_ptr);
18984         o_conv = Quantity_clone((LDKQuantity*)untag_ptr(o));
18985         LDKCOption_QuantityZ *ret_copy = MALLOC(sizeof(LDKCOption_QuantityZ), "LDKCOption_QuantityZ");
18986         *ret_copy = COption_QuantityZ_some(o_conv);
18987         uint64_t ret_ref = tag_ptr(ret_copy, true);
18988         return ret_ref;
18989 }
18990
18991 uint64_t  __attribute__((export_name("TS_COption_QuantityZ_none"))) TS_COption_QuantityZ_none() {
18992         LDKCOption_QuantityZ *ret_copy = MALLOC(sizeof(LDKCOption_QuantityZ), "LDKCOption_QuantityZ");
18993         *ret_copy = COption_QuantityZ_none();
18994         uint64_t ret_ref = tag_ptr(ret_copy, true);
18995         return ret_ref;
18996 }
18997
18998 void  __attribute__((export_name("TS_COption_QuantityZ_free"))) TS_COption_QuantityZ_free(uint64_t _res) {
18999         if (!ptr_is_owned(_res)) return;
19000         void* _res_ptr = untag_ptr(_res);
19001         CHECK_ACCESS(_res_ptr);
19002         LDKCOption_QuantityZ _res_conv = *(LDKCOption_QuantityZ*)(_res_ptr);
19003         FREE(untag_ptr(_res));
19004         COption_QuantityZ_free(_res_conv);
19005 }
19006
19007 static inline uint64_t COption_QuantityZ_clone_ptr(LDKCOption_QuantityZ *NONNULL_PTR arg) {
19008         LDKCOption_QuantityZ *ret_copy = MALLOC(sizeof(LDKCOption_QuantityZ), "LDKCOption_QuantityZ");
19009         *ret_copy = COption_QuantityZ_clone(arg);
19010         uint64_t ret_ref = tag_ptr(ret_copy, true);
19011         return ret_ref;
19012 }
19013 int64_t  __attribute__((export_name("TS_COption_QuantityZ_clone_ptr"))) TS_COption_QuantityZ_clone_ptr(uint64_t arg) {
19014         LDKCOption_QuantityZ* arg_conv = (LDKCOption_QuantityZ*)untag_ptr(arg);
19015         int64_t ret_conv = COption_QuantityZ_clone_ptr(arg_conv);
19016         return ret_conv;
19017 }
19018
19019 uint64_t  __attribute__((export_name("TS_COption_QuantityZ_clone"))) TS_COption_QuantityZ_clone(uint64_t orig) {
19020         LDKCOption_QuantityZ* orig_conv = (LDKCOption_QuantityZ*)untag_ptr(orig);
19021         LDKCOption_QuantityZ *ret_copy = MALLOC(sizeof(LDKCOption_QuantityZ), "LDKCOption_QuantityZ");
19022         *ret_copy = COption_QuantityZ_clone(orig_conv);
19023         uint64_t ret_ref = tag_ptr(ret_copy, true);
19024         return ret_ref;
19025 }
19026
19027 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_ok"))) TS_CResult_ThirtyTwoBytesNoneZ_ok(int8_tArray o) {
19028         LDKThirtyTwoBytes o_ref;
19029         CHECK(o->arr_len == 32);
19030         memcpy(o_ref.data, o->elems, 32); FREE(o);
19031         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
19032         *ret_conv = CResult_ThirtyTwoBytesNoneZ_ok(o_ref);
19033         return tag_ptr(ret_conv, true);
19034 }
19035
19036 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_err"))) TS_CResult_ThirtyTwoBytesNoneZ_err() {
19037         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
19038         *ret_conv = CResult_ThirtyTwoBytesNoneZ_err();
19039         return tag_ptr(ret_conv, true);
19040 }
19041
19042 jboolean  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_is_ok"))) TS_CResult_ThirtyTwoBytesNoneZ_is_ok(uint64_t o) {
19043         LDKCResult_ThirtyTwoBytesNoneZ* o_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(o);
19044         jboolean ret_conv = CResult_ThirtyTwoBytesNoneZ_is_ok(o_conv);
19045         return ret_conv;
19046 }
19047
19048 void  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_free"))) TS_CResult_ThirtyTwoBytesNoneZ_free(uint64_t _res) {
19049         if (!ptr_is_owned(_res)) return;
19050         void* _res_ptr = untag_ptr(_res);
19051         CHECK_ACCESS(_res_ptr);
19052         LDKCResult_ThirtyTwoBytesNoneZ _res_conv = *(LDKCResult_ThirtyTwoBytesNoneZ*)(_res_ptr);
19053         FREE(untag_ptr(_res));
19054         CResult_ThirtyTwoBytesNoneZ_free(_res_conv);
19055 }
19056
19057 static inline uint64_t CResult_ThirtyTwoBytesNoneZ_clone_ptr(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR arg) {
19058         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
19059         *ret_conv = CResult_ThirtyTwoBytesNoneZ_clone(arg);
19060         return tag_ptr(ret_conv, true);
19061 }
19062 int64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_clone_ptr"))) TS_CResult_ThirtyTwoBytesNoneZ_clone_ptr(uint64_t arg) {
19063         LDKCResult_ThirtyTwoBytesNoneZ* arg_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(arg);
19064         int64_t ret_conv = CResult_ThirtyTwoBytesNoneZ_clone_ptr(arg_conv);
19065         return ret_conv;
19066 }
19067
19068 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_clone"))) TS_CResult_ThirtyTwoBytesNoneZ_clone(uint64_t orig) {
19069         LDKCResult_ThirtyTwoBytesNoneZ* orig_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(orig);
19070         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
19071         *ret_conv = CResult_ThirtyTwoBytesNoneZ_clone(orig_conv);
19072         return tag_ptr(ret_conv, true);
19073 }
19074
19075 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_ok"))) TS_CResult_BlindedPayInfoDecodeErrorZ_ok(uint64_t o) {
19076         LDKBlindedPayInfo o_conv;
19077         o_conv.inner = untag_ptr(o);
19078         o_conv.is_owned = ptr_is_owned(o);
19079         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19080         o_conv = BlindedPayInfo_clone(&o_conv);
19081         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
19082         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_ok(o_conv);
19083         return tag_ptr(ret_conv, true);
19084 }
19085
19086 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_err"))) TS_CResult_BlindedPayInfoDecodeErrorZ_err(uint64_t e) {
19087         void* e_ptr = untag_ptr(e);
19088         CHECK_ACCESS(e_ptr);
19089         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19090         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19091         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
19092         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_err(e_conv);
19093         return tag_ptr(ret_conv, true);
19094 }
19095
19096 jboolean  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_is_ok"))) TS_CResult_BlindedPayInfoDecodeErrorZ_is_ok(uint64_t o) {
19097         LDKCResult_BlindedPayInfoDecodeErrorZ* o_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(o);
19098         jboolean ret_conv = CResult_BlindedPayInfoDecodeErrorZ_is_ok(o_conv);
19099         return ret_conv;
19100 }
19101
19102 void  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_free"))) TS_CResult_BlindedPayInfoDecodeErrorZ_free(uint64_t _res) {
19103         if (!ptr_is_owned(_res)) return;
19104         void* _res_ptr = untag_ptr(_res);
19105         CHECK_ACCESS(_res_ptr);
19106         LDKCResult_BlindedPayInfoDecodeErrorZ _res_conv = *(LDKCResult_BlindedPayInfoDecodeErrorZ*)(_res_ptr);
19107         FREE(untag_ptr(_res));
19108         CResult_BlindedPayInfoDecodeErrorZ_free(_res_conv);
19109 }
19110
19111 static inline uint64_t CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR arg) {
19112         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
19113         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(arg);
19114         return tag_ptr(ret_conv, true);
19115 }
19116 int64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
19117         LDKCResult_BlindedPayInfoDecodeErrorZ* arg_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(arg);
19118         int64_t ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(arg_conv);
19119         return ret_conv;
19120 }
19121
19122 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_clone"))) TS_CResult_BlindedPayInfoDecodeErrorZ_clone(uint64_t orig) {
19123         LDKCResult_BlindedPayInfoDecodeErrorZ* orig_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(orig);
19124         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
19125         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(orig_conv);
19126         return tag_ptr(ret_conv, true);
19127 }
19128
19129 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
19130         LDKDelayedPaymentOutputDescriptor o_conv;
19131         o_conv.inner = untag_ptr(o);
19132         o_conv.is_owned = ptr_is_owned(o);
19133         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19134         o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
19135         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
19136         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
19137         return tag_ptr(ret_conv, true);
19138 }
19139
19140 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(uint64_t e) {
19141         void* e_ptr = untag_ptr(e);
19142         CHECK_ACCESS(e_ptr);
19143         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19144         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19145         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
19146         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
19147         return tag_ptr(ret_conv, true);
19148 }
19149
19150 jboolean  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
19151         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
19152         jboolean ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
19153         return ret_conv;
19154 }
19155
19156 void  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
19157         if (!ptr_is_owned(_res)) return;
19158         void* _res_ptr = untag_ptr(_res);
19159         CHECK_ACCESS(_res_ptr);
19160         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
19161         FREE(untag_ptr(_res));
19162         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
19163 }
19164
19165 static inline uint64_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
19166         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
19167         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
19168         return tag_ptr(ret_conv, true);
19169 }
19170 int64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
19171         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
19172         int64_t ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
19173         return ret_conv;
19174 }
19175
19176 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
19177         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
19178         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
19179         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
19180         return tag_ptr(ret_conv, true);
19181 }
19182
19183 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
19184         LDKStaticPaymentOutputDescriptor o_conv;
19185         o_conv.inner = untag_ptr(o);
19186         o_conv.is_owned = ptr_is_owned(o);
19187         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19188         o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
19189         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
19190         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
19191         return tag_ptr(ret_conv, true);
19192 }
19193
19194 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(uint64_t e) {
19195         void* e_ptr = untag_ptr(e);
19196         CHECK_ACCESS(e_ptr);
19197         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19198         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19199         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
19200         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
19201         return tag_ptr(ret_conv, true);
19202 }
19203
19204 jboolean  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
19205         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
19206         jboolean ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
19207         return ret_conv;
19208 }
19209
19210 void  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
19211         if (!ptr_is_owned(_res)) return;
19212         void* _res_ptr = untag_ptr(_res);
19213         CHECK_ACCESS(_res_ptr);
19214         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
19215         FREE(untag_ptr(_res));
19216         CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
19217 }
19218
19219 static inline uint64_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
19220         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
19221         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
19222         return tag_ptr(ret_conv, true);
19223 }
19224 int64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
19225         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
19226         int64_t ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
19227         return ret_conv;
19228 }
19229
19230 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
19231         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
19232         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
19233         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
19234         return tag_ptr(ret_conv, true);
19235 }
19236
19237 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
19238         void* o_ptr = untag_ptr(o);
19239         CHECK_ACCESS(o_ptr);
19240         LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
19241         o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(o));
19242         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
19243         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
19244         return tag_ptr(ret_conv, true);
19245 }
19246
19247 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err(uint64_t e) {
19248         void* e_ptr = untag_ptr(e);
19249         CHECK_ACCESS(e_ptr);
19250         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19251         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19252         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
19253         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
19254         return tag_ptr(ret_conv, true);
19255 }
19256
19257 jboolean  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
19258         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(o);
19259         jboolean ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
19260         return ret_conv;
19261 }
19262
19263 void  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
19264         if (!ptr_is_owned(_res)) return;
19265         void* _res_ptr = untag_ptr(_res);
19266         CHECK_ACCESS(_res_ptr);
19267         LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
19268         FREE(untag_ptr(_res));
19269         CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
19270 }
19271
19272 static inline uint64_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
19273         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
19274         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
19275         return tag_ptr(ret_conv, true);
19276 }
19277 int64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
19278         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
19279         int64_t ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
19280         return ret_conv;
19281 }
19282
19283 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
19284         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
19285         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
19286         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
19287         return tag_ptr(ret_conv, true);
19288 }
19289
19290 void  __attribute__((export_name("TS_CVec_SpendableOutputDescriptorZ_free"))) TS_CVec_SpendableOutputDescriptorZ_free(uint64_tArray _res) {
19291         LDKCVec_SpendableOutputDescriptorZ _res_constr;
19292         _res_constr.datalen = _res->arr_len;
19293         if (_res_constr.datalen > 0)
19294                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
19295         else
19296                 _res_constr.data = NULL;
19297         uint64_t* _res_vals = _res->elems;
19298         for (size_t b = 0; b < _res_constr.datalen; b++) {
19299                 uint64_t _res_conv_27 = _res_vals[b];
19300                 void* _res_conv_27_ptr = untag_ptr(_res_conv_27);
19301                 CHECK_ACCESS(_res_conv_27_ptr);
19302                 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
19303                 FREE(untag_ptr(_res_conv_27));
19304                 _res_constr.data[b] = _res_conv_27_conv;
19305         }
19306         FREE(_res);
19307         CVec_SpendableOutputDescriptorZ_free(_res_constr);
19308 }
19309
19310 void  __attribute__((export_name("TS_CVec_TxOutZ_free"))) TS_CVec_TxOutZ_free(uint64_tArray _res) {
19311         LDKCVec_TxOutZ _res_constr;
19312         _res_constr.datalen = _res->arr_len;
19313         if (_res_constr.datalen > 0)
19314                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
19315         else
19316                 _res_constr.data = NULL;
19317         uint64_t* _res_vals = _res->elems;
19318         for (size_t h = 0; h < _res_constr.datalen; h++) {
19319                 uint64_t _res_conv_7 = _res_vals[h];
19320                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
19321                 CHECK_ACCESS(_res_conv_7_ptr);
19322                 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
19323                 FREE(untag_ptr(_res_conv_7));
19324                 _res_constr.data[h] = _res_conv_7_conv;
19325         }
19326         FREE(_res);
19327         CVec_TxOutZ_free(_res_constr);
19328 }
19329
19330 uint64_t  __attribute__((export_name("TS_COption_u32Z_some"))) TS_COption_u32Z_some(int32_t o) {
19331         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
19332         *ret_copy = COption_u32Z_some(o);
19333         uint64_t ret_ref = tag_ptr(ret_copy, true);
19334         return ret_ref;
19335 }
19336
19337 uint64_t  __attribute__((export_name("TS_COption_u32Z_none"))) TS_COption_u32Z_none() {
19338         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
19339         *ret_copy = COption_u32Z_none();
19340         uint64_t ret_ref = tag_ptr(ret_copy, true);
19341         return ret_ref;
19342 }
19343
19344 void  __attribute__((export_name("TS_COption_u32Z_free"))) TS_COption_u32Z_free(uint64_t _res) {
19345         if (!ptr_is_owned(_res)) return;
19346         void* _res_ptr = untag_ptr(_res);
19347         CHECK_ACCESS(_res_ptr);
19348         LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
19349         FREE(untag_ptr(_res));
19350         COption_u32Z_free(_res_conv);
19351 }
19352
19353 static inline uint64_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
19354         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
19355         *ret_copy = COption_u32Z_clone(arg);
19356         uint64_t ret_ref = tag_ptr(ret_copy, true);
19357         return ret_ref;
19358 }
19359 int64_t  __attribute__((export_name("TS_COption_u32Z_clone_ptr"))) TS_COption_u32Z_clone_ptr(uint64_t arg) {
19360         LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)untag_ptr(arg);
19361         int64_t ret_conv = COption_u32Z_clone_ptr(arg_conv);
19362         return ret_conv;
19363 }
19364
19365 uint64_t  __attribute__((export_name("TS_COption_u32Z_clone"))) TS_COption_u32Z_clone(uint64_t orig) {
19366         LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)untag_ptr(orig);
19367         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
19368         *ret_copy = COption_u32Z_clone(orig_conv);
19369         uint64_t ret_ref = tag_ptr(ret_copy, true);
19370         return ret_ref;
19371 }
19372
19373 static inline uint64_t C2Tuple_CVec_u8Zu64Z_clone_ptr(LDKC2Tuple_CVec_u8Zu64Z *NONNULL_PTR arg) {
19374         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
19375         *ret_conv = C2Tuple_CVec_u8Zu64Z_clone(arg);
19376         return tag_ptr(ret_conv, true);
19377 }
19378 int64_t  __attribute__((export_name("TS_C2Tuple_CVec_u8Zu64Z_clone_ptr"))) TS_C2Tuple_CVec_u8Zu64Z_clone_ptr(uint64_t arg) {
19379         LDKC2Tuple_CVec_u8Zu64Z* arg_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(arg);
19380         int64_t ret_conv = C2Tuple_CVec_u8Zu64Z_clone_ptr(arg_conv);
19381         return ret_conv;
19382 }
19383
19384 uint64_t  __attribute__((export_name("TS_C2Tuple_CVec_u8Zu64Z_clone"))) TS_C2Tuple_CVec_u8Zu64Z_clone(uint64_t orig) {
19385         LDKC2Tuple_CVec_u8Zu64Z* orig_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(orig);
19386         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
19387         *ret_conv = C2Tuple_CVec_u8Zu64Z_clone(orig_conv);
19388         return tag_ptr(ret_conv, true);
19389 }
19390
19391 uint64_t  __attribute__((export_name("TS_C2Tuple_CVec_u8Zu64Z_new"))) TS_C2Tuple_CVec_u8Zu64Z_new(int8_tArray a, int64_t b) {
19392         LDKCVec_u8Z a_ref;
19393         a_ref.datalen = a->arr_len;
19394         a_ref.data = MALLOC(a_ref.datalen, "LDKCVec_u8Z Bytes");
19395         memcpy(a_ref.data, a->elems, a_ref.datalen); FREE(a);
19396         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
19397         *ret_conv = C2Tuple_CVec_u8Zu64Z_new(a_ref, b);
19398         return tag_ptr(ret_conv, true);
19399 }
19400
19401 void  __attribute__((export_name("TS_C2Tuple_CVec_u8Zu64Z_free"))) TS_C2Tuple_CVec_u8Zu64Z_free(uint64_t _res) {
19402         if (!ptr_is_owned(_res)) return;
19403         void* _res_ptr = untag_ptr(_res);
19404         CHECK_ACCESS(_res_ptr);
19405         LDKC2Tuple_CVec_u8Zu64Z _res_conv = *(LDKC2Tuple_CVec_u8Zu64Z*)(_res_ptr);
19406         FREE(untag_ptr(_res));
19407         C2Tuple_CVec_u8Zu64Z_free(_res_conv);
19408 }
19409
19410 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_ok"))) TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_ok(uint64_t o) {
19411         void* o_ptr = untag_ptr(o);
19412         CHECK_ACCESS(o_ptr);
19413         LDKC2Tuple_CVec_u8Zu64Z o_conv = *(LDKC2Tuple_CVec_u8Zu64Z*)(o_ptr);
19414         o_conv = C2Tuple_CVec_u8Zu64Z_clone((LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(o));
19415         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
19416         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_ok(o_conv);
19417         return tag_ptr(ret_conv, true);
19418 }
19419
19420 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_err"))) TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_err() {
19421         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
19422         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_err();
19423         return tag_ptr(ret_conv, true);
19424 }
19425
19426 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_is_ok"))) TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_is_ok(uint64_t o) {
19427         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* o_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(o);
19428         jboolean ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_is_ok(o_conv);
19429         return ret_conv;
19430 }
19431
19432 void  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_free"))) TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_free(uint64_t _res) {
19433         if (!ptr_is_owned(_res)) return;
19434         void* _res_ptr = untag_ptr(_res);
19435         CHECK_ACCESS(_res_ptr);
19436         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ _res_conv = *(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)(_res_ptr);
19437         FREE(untag_ptr(_res));
19438         CResult_C2Tuple_CVec_u8Zu64ZNoneZ_free(_res_conv);
19439 }
19440
19441 static inline uint64_t CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone_ptr(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ *NONNULL_PTR arg) {
19442         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
19443         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone(arg);
19444         return tag_ptr(ret_conv, true);
19445 }
19446 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone_ptr(uint64_t arg) {
19447         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* arg_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(arg);
19448         int64_t ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone_ptr(arg_conv);
19449         return ret_conv;
19450 }
19451
19452 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone"))) TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone(uint64_t orig) {
19453         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* orig_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(orig);
19454         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
19455         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone(orig_conv);
19456         return tag_ptr(ret_conv, true);
19457 }
19458
19459 uint64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_ok"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_ok(uint64_t o) {
19460         LDKChannelDerivationParameters o_conv;
19461         o_conv.inner = untag_ptr(o);
19462         o_conv.is_owned = ptr_is_owned(o);
19463         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19464         o_conv = ChannelDerivationParameters_clone(&o_conv);
19465         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
19466         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_ok(o_conv);
19467         return tag_ptr(ret_conv, true);
19468 }
19469
19470 uint64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_err"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_err(uint64_t e) {
19471         void* e_ptr = untag_ptr(e);
19472         CHECK_ACCESS(e_ptr);
19473         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19474         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19475         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
19476         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_err(e_conv);
19477         return tag_ptr(ret_conv, true);
19478 }
19479
19480 jboolean  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_is_ok"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(uint64_t o) {
19481         LDKCResult_ChannelDerivationParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(o);
19482         jboolean ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(o_conv);
19483         return ret_conv;
19484 }
19485
19486 void  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_free"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_free(uint64_t _res) {
19487         if (!ptr_is_owned(_res)) return;
19488         void* _res_ptr = untag_ptr(_res);
19489         CHECK_ACCESS(_res_ptr);
19490         LDKCResult_ChannelDerivationParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelDerivationParametersDecodeErrorZ*)(_res_ptr);
19491         FREE(untag_ptr(_res));
19492         CResult_ChannelDerivationParametersDecodeErrorZ_free(_res_conv);
19493 }
19494
19495 static inline uint64_t CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR arg) {
19496         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
19497         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone(arg);
19498         return tag_ptr(ret_conv, true);
19499 }
19500 int64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
19501         LDKCResult_ChannelDerivationParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(arg);
19502         int64_t ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(arg_conv);
19503         return ret_conv;
19504 }
19505
19506 uint64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_clone"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_clone(uint64_t orig) {
19507         LDKCResult_ChannelDerivationParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(orig);
19508         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
19509         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone(orig_conv);
19510         return tag_ptr(ret_conv, true);
19511 }
19512
19513 uint64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_ok"))) TS_CResult_HTLCDescriptorDecodeErrorZ_ok(uint64_t o) {
19514         LDKHTLCDescriptor o_conv;
19515         o_conv.inner = untag_ptr(o);
19516         o_conv.is_owned = ptr_is_owned(o);
19517         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19518         o_conv = HTLCDescriptor_clone(&o_conv);
19519         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
19520         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_ok(o_conv);
19521         return tag_ptr(ret_conv, true);
19522 }
19523
19524 uint64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_err"))) TS_CResult_HTLCDescriptorDecodeErrorZ_err(uint64_t e) {
19525         void* e_ptr = untag_ptr(e);
19526         CHECK_ACCESS(e_ptr);
19527         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19528         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19529         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
19530         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_err(e_conv);
19531         return tag_ptr(ret_conv, true);
19532 }
19533
19534 jboolean  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_is_ok"))) TS_CResult_HTLCDescriptorDecodeErrorZ_is_ok(uint64_t o) {
19535         LDKCResult_HTLCDescriptorDecodeErrorZ* o_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(o);
19536         jboolean ret_conv = CResult_HTLCDescriptorDecodeErrorZ_is_ok(o_conv);
19537         return ret_conv;
19538 }
19539
19540 void  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_free"))) TS_CResult_HTLCDescriptorDecodeErrorZ_free(uint64_t _res) {
19541         if (!ptr_is_owned(_res)) return;
19542         void* _res_ptr = untag_ptr(_res);
19543         CHECK_ACCESS(_res_ptr);
19544         LDKCResult_HTLCDescriptorDecodeErrorZ _res_conv = *(LDKCResult_HTLCDescriptorDecodeErrorZ*)(_res_ptr);
19545         FREE(untag_ptr(_res));
19546         CResult_HTLCDescriptorDecodeErrorZ_free(_res_conv);
19547 }
19548
19549 static inline uint64_t CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR arg) {
19550         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
19551         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone(arg);
19552         return tag_ptr(ret_conv, true);
19553 }
19554 int64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
19555         LDKCResult_HTLCDescriptorDecodeErrorZ* arg_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(arg);
19556         int64_t ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(arg_conv);
19557         return ret_conv;
19558 }
19559
19560 uint64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_clone"))) TS_CResult_HTLCDescriptorDecodeErrorZ_clone(uint64_t orig) {
19561         LDKCResult_HTLCDescriptorDecodeErrorZ* orig_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(orig);
19562         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
19563         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone(orig_conv);
19564         return tag_ptr(ret_conv, true);
19565 }
19566
19567 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_ok"))) TS_CResult_NoneNoneZ_ok() {
19568         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
19569         *ret_conv = CResult_NoneNoneZ_ok();
19570         return tag_ptr(ret_conv, true);
19571 }
19572
19573 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_err"))) TS_CResult_NoneNoneZ_err() {
19574         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
19575         *ret_conv = CResult_NoneNoneZ_err();
19576         return tag_ptr(ret_conv, true);
19577 }
19578
19579 jboolean  __attribute__((export_name("TS_CResult_NoneNoneZ_is_ok"))) TS_CResult_NoneNoneZ_is_ok(uint64_t o) {
19580         LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)untag_ptr(o);
19581         jboolean ret_conv = CResult_NoneNoneZ_is_ok(o_conv);
19582         return ret_conv;
19583 }
19584
19585 void  __attribute__((export_name("TS_CResult_NoneNoneZ_free"))) TS_CResult_NoneNoneZ_free(uint64_t _res) {
19586         if (!ptr_is_owned(_res)) return;
19587         void* _res_ptr = untag_ptr(_res);
19588         CHECK_ACCESS(_res_ptr);
19589         LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
19590         FREE(untag_ptr(_res));
19591         CResult_NoneNoneZ_free(_res_conv);
19592 }
19593
19594 static inline uint64_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
19595         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
19596         *ret_conv = CResult_NoneNoneZ_clone(arg);
19597         return tag_ptr(ret_conv, true);
19598 }
19599 int64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_clone_ptr"))) TS_CResult_NoneNoneZ_clone_ptr(uint64_t arg) {
19600         LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)untag_ptr(arg);
19601         int64_t ret_conv = CResult_NoneNoneZ_clone_ptr(arg_conv);
19602         return ret_conv;
19603 }
19604
19605 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_clone"))) TS_CResult_NoneNoneZ_clone(uint64_t orig) {
19606         LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)untag_ptr(orig);
19607         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
19608         *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
19609         return tag_ptr(ret_conv, true);
19610 }
19611
19612 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_ok"))) TS_CResult_PublicKeyNoneZ_ok(int8_tArray o) {
19613         LDKPublicKey o_ref;
19614         CHECK(o->arr_len == 33);
19615         memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
19616         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
19617         *ret_conv = CResult_PublicKeyNoneZ_ok(o_ref);
19618         return tag_ptr(ret_conv, true);
19619 }
19620
19621 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_err"))) TS_CResult_PublicKeyNoneZ_err() {
19622         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
19623         *ret_conv = CResult_PublicKeyNoneZ_err();
19624         return tag_ptr(ret_conv, true);
19625 }
19626
19627 jboolean  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_is_ok"))) TS_CResult_PublicKeyNoneZ_is_ok(uint64_t o) {
19628         LDKCResult_PublicKeyNoneZ* o_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(o);
19629         jboolean ret_conv = CResult_PublicKeyNoneZ_is_ok(o_conv);
19630         return ret_conv;
19631 }
19632
19633 void  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_free"))) TS_CResult_PublicKeyNoneZ_free(uint64_t _res) {
19634         if (!ptr_is_owned(_res)) return;
19635         void* _res_ptr = untag_ptr(_res);
19636         CHECK_ACCESS(_res_ptr);
19637         LDKCResult_PublicKeyNoneZ _res_conv = *(LDKCResult_PublicKeyNoneZ*)(_res_ptr);
19638         FREE(untag_ptr(_res));
19639         CResult_PublicKeyNoneZ_free(_res_conv);
19640 }
19641
19642 static inline uint64_t CResult_PublicKeyNoneZ_clone_ptr(LDKCResult_PublicKeyNoneZ *NONNULL_PTR arg) {
19643         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
19644         *ret_conv = CResult_PublicKeyNoneZ_clone(arg);
19645         return tag_ptr(ret_conv, true);
19646 }
19647 int64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_clone_ptr"))) TS_CResult_PublicKeyNoneZ_clone_ptr(uint64_t arg) {
19648         LDKCResult_PublicKeyNoneZ* arg_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(arg);
19649         int64_t ret_conv = CResult_PublicKeyNoneZ_clone_ptr(arg_conv);
19650         return ret_conv;
19651 }
19652
19653 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_clone"))) TS_CResult_PublicKeyNoneZ_clone(uint64_t orig) {
19654         LDKCResult_PublicKeyNoneZ* orig_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(orig);
19655         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
19656         *ret_conv = CResult_PublicKeyNoneZ_clone(orig_conv);
19657         return tag_ptr(ret_conv, true);
19658 }
19659
19660 uint64_t  __attribute__((export_name("TS_COption_BigEndianScalarZ_some"))) TS_COption_BigEndianScalarZ_some(uint64_t o) {
19661         void* o_ptr = untag_ptr(o);
19662         CHECK_ACCESS(o_ptr);
19663         LDKBigEndianScalar o_conv = *(LDKBigEndianScalar*)(o_ptr);
19664         o_conv = BigEndianScalar_clone((LDKBigEndianScalar*)untag_ptr(o));
19665         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
19666         *ret_copy = COption_BigEndianScalarZ_some(o_conv);
19667         uint64_t ret_ref = tag_ptr(ret_copy, true);
19668         return ret_ref;
19669 }
19670
19671 uint64_t  __attribute__((export_name("TS_COption_BigEndianScalarZ_none"))) TS_COption_BigEndianScalarZ_none() {
19672         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
19673         *ret_copy = COption_BigEndianScalarZ_none();
19674         uint64_t ret_ref = tag_ptr(ret_copy, true);
19675         return ret_ref;
19676 }
19677
19678 void  __attribute__((export_name("TS_COption_BigEndianScalarZ_free"))) TS_COption_BigEndianScalarZ_free(uint64_t _res) {
19679         if (!ptr_is_owned(_res)) return;
19680         void* _res_ptr = untag_ptr(_res);
19681         CHECK_ACCESS(_res_ptr);
19682         LDKCOption_BigEndianScalarZ _res_conv = *(LDKCOption_BigEndianScalarZ*)(_res_ptr);
19683         FREE(untag_ptr(_res));
19684         COption_BigEndianScalarZ_free(_res_conv);
19685 }
19686
19687 static inline uint64_t COption_BigEndianScalarZ_clone_ptr(LDKCOption_BigEndianScalarZ *NONNULL_PTR arg) {
19688         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
19689         *ret_copy = COption_BigEndianScalarZ_clone(arg);
19690         uint64_t ret_ref = tag_ptr(ret_copy, true);
19691         return ret_ref;
19692 }
19693 int64_t  __attribute__((export_name("TS_COption_BigEndianScalarZ_clone_ptr"))) TS_COption_BigEndianScalarZ_clone_ptr(uint64_t arg) {
19694         LDKCOption_BigEndianScalarZ* arg_conv = (LDKCOption_BigEndianScalarZ*)untag_ptr(arg);
19695         int64_t ret_conv = COption_BigEndianScalarZ_clone_ptr(arg_conv);
19696         return ret_conv;
19697 }
19698
19699 uint64_t  __attribute__((export_name("TS_COption_BigEndianScalarZ_clone"))) TS_COption_BigEndianScalarZ_clone(uint64_t orig) {
19700         LDKCOption_BigEndianScalarZ* orig_conv = (LDKCOption_BigEndianScalarZ*)untag_ptr(orig);
19701         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
19702         *ret_copy = COption_BigEndianScalarZ_clone(orig_conv);
19703         uint64_t ret_ref = tag_ptr(ret_copy, true);
19704         return ret_ref;
19705 }
19706
19707 void  __attribute__((export_name("TS_CVec_U5Z_free"))) TS_CVec_U5Z_free(ptrArray _res) {
19708         LDKCVec_U5Z _res_constr;
19709         _res_constr.datalen = _res->arr_len;
19710         if (_res_constr.datalen > 0)
19711                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
19712         else
19713                 _res_constr.data = NULL;
19714         int8_t* _res_vals = (void*) _res->elems;
19715         for (size_t h = 0; h < _res_constr.datalen; h++) {
19716                 int8_t _res_conv_7 = _res_vals[h];
19717                 
19718                 _res_constr.data[h] = (LDKU5){ ._0 = _res_conv_7 };
19719         }
19720         FREE(_res);
19721         CVec_U5Z_free(_res_constr);
19722 }
19723
19724 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_ok"))) TS_CResult_RecoverableSignatureNoneZ_ok(int8_tArray o) {
19725         LDKRecoverableSignature o_ref;
19726         CHECK(o->arr_len == 68);
19727         memcpy(o_ref.serialized_form, o->elems, 68); FREE(o);
19728         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
19729         *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
19730         return tag_ptr(ret_conv, true);
19731 }
19732
19733 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_err"))) TS_CResult_RecoverableSignatureNoneZ_err() {
19734         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
19735         *ret_conv = CResult_RecoverableSignatureNoneZ_err();
19736         return tag_ptr(ret_conv, true);
19737 }
19738
19739 jboolean  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_is_ok"))) TS_CResult_RecoverableSignatureNoneZ_is_ok(uint64_t o) {
19740         LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(o);
19741         jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
19742         return ret_conv;
19743 }
19744
19745 void  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_free"))) TS_CResult_RecoverableSignatureNoneZ_free(uint64_t _res) {
19746         if (!ptr_is_owned(_res)) return;
19747         void* _res_ptr = untag_ptr(_res);
19748         CHECK_ACCESS(_res_ptr);
19749         LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
19750         FREE(untag_ptr(_res));
19751         CResult_RecoverableSignatureNoneZ_free(_res_conv);
19752 }
19753
19754 static inline uint64_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
19755         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
19756         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
19757         return tag_ptr(ret_conv, true);
19758 }
19759 int64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone_ptr"))) TS_CResult_RecoverableSignatureNoneZ_clone_ptr(uint64_t arg) {
19760         LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(arg);
19761         int64_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
19762         return ret_conv;
19763 }
19764
19765 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone"))) TS_CResult_RecoverableSignatureNoneZ_clone(uint64_t orig) {
19766         LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(orig);
19767         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
19768         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
19769         return tag_ptr(ret_conv, true);
19770 }
19771
19772 uint64_t  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_ok"))) TS_CResult_ECDSASignatureNoneZ_ok(int8_tArray o) {
19773         LDKECDSASignature o_ref;
19774         CHECK(o->arr_len == 64);
19775         memcpy(o_ref.compact_form, o->elems, 64); FREE(o);
19776         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
19777         *ret_conv = CResult_ECDSASignatureNoneZ_ok(o_ref);
19778         return tag_ptr(ret_conv, true);
19779 }
19780
19781 uint64_t  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_err"))) TS_CResult_ECDSASignatureNoneZ_err() {
19782         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
19783         *ret_conv = CResult_ECDSASignatureNoneZ_err();
19784         return tag_ptr(ret_conv, true);
19785 }
19786
19787 jboolean  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_is_ok"))) TS_CResult_ECDSASignatureNoneZ_is_ok(uint64_t o) {
19788         LDKCResult_ECDSASignatureNoneZ* o_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(o);
19789         jboolean ret_conv = CResult_ECDSASignatureNoneZ_is_ok(o_conv);
19790         return ret_conv;
19791 }
19792
19793 void  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_free"))) TS_CResult_ECDSASignatureNoneZ_free(uint64_t _res) {
19794         if (!ptr_is_owned(_res)) return;
19795         void* _res_ptr = untag_ptr(_res);
19796         CHECK_ACCESS(_res_ptr);
19797         LDKCResult_ECDSASignatureNoneZ _res_conv = *(LDKCResult_ECDSASignatureNoneZ*)(_res_ptr);
19798         FREE(untag_ptr(_res));
19799         CResult_ECDSASignatureNoneZ_free(_res_conv);
19800 }
19801
19802 static inline uint64_t CResult_ECDSASignatureNoneZ_clone_ptr(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR arg) {
19803         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
19804         *ret_conv = CResult_ECDSASignatureNoneZ_clone(arg);
19805         return tag_ptr(ret_conv, true);
19806 }
19807 int64_t  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_clone_ptr"))) TS_CResult_ECDSASignatureNoneZ_clone_ptr(uint64_t arg) {
19808         LDKCResult_ECDSASignatureNoneZ* arg_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(arg);
19809         int64_t ret_conv = CResult_ECDSASignatureNoneZ_clone_ptr(arg_conv);
19810         return ret_conv;
19811 }
19812
19813 uint64_t  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_clone"))) TS_CResult_ECDSASignatureNoneZ_clone(uint64_t orig) {
19814         LDKCResult_ECDSASignatureNoneZ* orig_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(orig);
19815         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
19816         *ret_conv = CResult_ECDSASignatureNoneZ_clone(orig_conv);
19817         return tag_ptr(ret_conv, true);
19818 }
19819
19820 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_ok"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
19821         LDKTransaction o_ref;
19822         o_ref.datalen = o->arr_len;
19823         o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
19824         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
19825         o_ref.data_is_owned = true;
19826         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
19827         *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
19828         return tag_ptr(ret_conv, true);
19829 }
19830
19831 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_err"))) TS_CResult_TransactionNoneZ_err() {
19832         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
19833         *ret_conv = CResult_TransactionNoneZ_err();
19834         return tag_ptr(ret_conv, true);
19835 }
19836
19837 jboolean  __attribute__((export_name("TS_CResult_TransactionNoneZ_is_ok"))) TS_CResult_TransactionNoneZ_is_ok(uint64_t o) {
19838         LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(o);
19839         jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
19840         return ret_conv;
19841 }
19842
19843 void  __attribute__((export_name("TS_CResult_TransactionNoneZ_free"))) TS_CResult_TransactionNoneZ_free(uint64_t _res) {
19844         if (!ptr_is_owned(_res)) return;
19845         void* _res_ptr = untag_ptr(_res);
19846         CHECK_ACCESS(_res_ptr);
19847         LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
19848         FREE(untag_ptr(_res));
19849         CResult_TransactionNoneZ_free(_res_conv);
19850 }
19851
19852 static inline uint64_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
19853         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
19854         *ret_conv = CResult_TransactionNoneZ_clone(arg);
19855         return tag_ptr(ret_conv, true);
19856 }
19857 int64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_clone_ptr"))) TS_CResult_TransactionNoneZ_clone_ptr(uint64_t arg) {
19858         LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(arg);
19859         int64_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
19860         return ret_conv;
19861 }
19862
19863 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_clone"))) TS_CResult_TransactionNoneZ_clone(uint64_t orig) {
19864         LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(orig);
19865         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
19866         *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
19867         return tag_ptr(ret_conv, true);
19868 }
19869
19870 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(uint64_t o) {
19871         void* o_ptr = untag_ptr(o);
19872         CHECK_ACCESS(o_ptr);
19873         LDKWriteableEcdsaChannelSigner o_conv = *(LDKWriteableEcdsaChannelSigner*)(o_ptr);
19874         if (o_conv.free == LDKWriteableEcdsaChannelSigner_JCalls_free) {
19875                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19876                 LDKWriteableEcdsaChannelSigner_JCalls_cloned(&o_conv);
19877         }
19878         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
19879         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o_conv);
19880         return tag_ptr(ret_conv, true);
19881 }
19882
19883 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(uint64_t e) {
19884         void* e_ptr = untag_ptr(e);
19885         CHECK_ACCESS(e_ptr);
19886         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19887         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19888         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
19889         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e_conv);
19890         return tag_ptr(ret_conv, true);
19891 }
19892
19893 jboolean  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(uint64_t o) {
19894         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* o_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(o);
19895         jboolean ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o_conv);
19896         return ret_conv;
19897 }
19898
19899 void  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(uint64_t _res) {
19900         if (!ptr_is_owned(_res)) return;
19901         void* _res_ptr = untag_ptr(_res);
19902         CHECK_ACCESS(_res_ptr);
19903         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ _res_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(_res_ptr);
19904         FREE(untag_ptr(_res));
19905         CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res_conv);
19906 }
19907
19908 static inline uint64_t CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR arg) {
19909         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
19910         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(arg);
19911         return tag_ptr(ret_conv, true);
19912 }
19913 int64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(uint64_t arg) {
19914         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* arg_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(arg);
19915         int64_t ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(arg_conv);
19916         return ret_conv;
19917 }
19918
19919 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(uint64_t orig) {
19920         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* orig_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(orig);
19921         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
19922         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(orig_conv);
19923         return tag_ptr(ret_conv, true);
19924 }
19925
19926 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_ok"))) TS_CResult_CVec_u8ZNoneZ_ok(int8_tArray o) {
19927         LDKCVec_u8Z o_ref;
19928         o_ref.datalen = o->arr_len;
19929         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
19930         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
19931         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
19932         *ret_conv = CResult_CVec_u8ZNoneZ_ok(o_ref);
19933         return tag_ptr(ret_conv, true);
19934 }
19935
19936 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_err"))) TS_CResult_CVec_u8ZNoneZ_err() {
19937         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
19938         *ret_conv = CResult_CVec_u8ZNoneZ_err();
19939         return tag_ptr(ret_conv, true);
19940 }
19941
19942 jboolean  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_is_ok"))) TS_CResult_CVec_u8ZNoneZ_is_ok(uint64_t o) {
19943         LDKCResult_CVec_u8ZNoneZ* o_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(o);
19944         jboolean ret_conv = CResult_CVec_u8ZNoneZ_is_ok(o_conv);
19945         return ret_conv;
19946 }
19947
19948 void  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_free"))) TS_CResult_CVec_u8ZNoneZ_free(uint64_t _res) {
19949         if (!ptr_is_owned(_res)) return;
19950         void* _res_ptr = untag_ptr(_res);
19951         CHECK_ACCESS(_res_ptr);
19952         LDKCResult_CVec_u8ZNoneZ _res_conv = *(LDKCResult_CVec_u8ZNoneZ*)(_res_ptr);
19953         FREE(untag_ptr(_res));
19954         CResult_CVec_u8ZNoneZ_free(_res_conv);
19955 }
19956
19957 static inline uint64_t CResult_CVec_u8ZNoneZ_clone_ptr(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR arg) {
19958         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
19959         *ret_conv = CResult_CVec_u8ZNoneZ_clone(arg);
19960         return tag_ptr(ret_conv, true);
19961 }
19962 int64_t  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_clone_ptr"))) TS_CResult_CVec_u8ZNoneZ_clone_ptr(uint64_t arg) {
19963         LDKCResult_CVec_u8ZNoneZ* arg_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(arg);
19964         int64_t ret_conv = CResult_CVec_u8ZNoneZ_clone_ptr(arg_conv);
19965         return ret_conv;
19966 }
19967
19968 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_clone"))) TS_CResult_CVec_u8ZNoneZ_clone(uint64_t orig) {
19969         LDKCResult_CVec_u8ZNoneZ* orig_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(orig);
19970         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
19971         *ret_conv = CResult_CVec_u8ZNoneZ_clone(orig_conv);
19972         return tag_ptr(ret_conv, true);
19973 }
19974
19975 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_ok"))) TS_CResult_ShutdownScriptNoneZ_ok(uint64_t o) {
19976         LDKShutdownScript o_conv;
19977         o_conv.inner = untag_ptr(o);
19978         o_conv.is_owned = ptr_is_owned(o);
19979         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19980         o_conv = ShutdownScript_clone(&o_conv);
19981         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
19982         *ret_conv = CResult_ShutdownScriptNoneZ_ok(o_conv);
19983         return tag_ptr(ret_conv, true);
19984 }
19985
19986 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_err"))) TS_CResult_ShutdownScriptNoneZ_err() {
19987         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
19988         *ret_conv = CResult_ShutdownScriptNoneZ_err();
19989         return tag_ptr(ret_conv, true);
19990 }
19991
19992 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_is_ok"))) TS_CResult_ShutdownScriptNoneZ_is_ok(uint64_t o) {
19993         LDKCResult_ShutdownScriptNoneZ* o_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(o);
19994         jboolean ret_conv = CResult_ShutdownScriptNoneZ_is_ok(o_conv);
19995         return ret_conv;
19996 }
19997
19998 void  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_free"))) TS_CResult_ShutdownScriptNoneZ_free(uint64_t _res) {
19999         if (!ptr_is_owned(_res)) return;
20000         void* _res_ptr = untag_ptr(_res);
20001         CHECK_ACCESS(_res_ptr);
20002         LDKCResult_ShutdownScriptNoneZ _res_conv = *(LDKCResult_ShutdownScriptNoneZ*)(_res_ptr);
20003         FREE(untag_ptr(_res));
20004         CResult_ShutdownScriptNoneZ_free(_res_conv);
20005 }
20006
20007 static inline uint64_t CResult_ShutdownScriptNoneZ_clone_ptr(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR arg) {
20008         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
20009         *ret_conv = CResult_ShutdownScriptNoneZ_clone(arg);
20010         return tag_ptr(ret_conv, true);
20011 }
20012 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_clone_ptr"))) TS_CResult_ShutdownScriptNoneZ_clone_ptr(uint64_t arg) {
20013         LDKCResult_ShutdownScriptNoneZ* arg_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(arg);
20014         int64_t ret_conv = CResult_ShutdownScriptNoneZ_clone_ptr(arg_conv);
20015         return ret_conv;
20016 }
20017
20018 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_clone"))) TS_CResult_ShutdownScriptNoneZ_clone(uint64_t orig) {
20019         LDKCResult_ShutdownScriptNoneZ* orig_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(orig);
20020         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
20021         *ret_conv = CResult_ShutdownScriptNoneZ_clone(orig_conv);
20022         return tag_ptr(ret_conv, true);
20023 }
20024
20025 uint64_t  __attribute__((export_name("TS_COption_u16Z_some"))) TS_COption_u16Z_some(int16_t o) {
20026         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
20027         *ret_copy = COption_u16Z_some(o);
20028         uint64_t ret_ref = tag_ptr(ret_copy, true);
20029         return ret_ref;
20030 }
20031
20032 uint64_t  __attribute__((export_name("TS_COption_u16Z_none"))) TS_COption_u16Z_none() {
20033         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
20034         *ret_copy = COption_u16Z_none();
20035         uint64_t ret_ref = tag_ptr(ret_copy, true);
20036         return ret_ref;
20037 }
20038
20039 void  __attribute__((export_name("TS_COption_u16Z_free"))) TS_COption_u16Z_free(uint64_t _res) {
20040         if (!ptr_is_owned(_res)) return;
20041         void* _res_ptr = untag_ptr(_res);
20042         CHECK_ACCESS(_res_ptr);
20043         LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
20044         FREE(untag_ptr(_res));
20045         COption_u16Z_free(_res_conv);
20046 }
20047
20048 static inline uint64_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
20049         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
20050         *ret_copy = COption_u16Z_clone(arg);
20051         uint64_t ret_ref = tag_ptr(ret_copy, true);
20052         return ret_ref;
20053 }
20054 int64_t  __attribute__((export_name("TS_COption_u16Z_clone_ptr"))) TS_COption_u16Z_clone_ptr(uint64_t arg) {
20055         LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)untag_ptr(arg);
20056         int64_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
20057         return ret_conv;
20058 }
20059
20060 uint64_t  __attribute__((export_name("TS_COption_u16Z_clone"))) TS_COption_u16Z_clone(uint64_t orig) {
20061         LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)untag_ptr(orig);
20062         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
20063         *ret_copy = COption_u16Z_clone(orig_conv);
20064         uint64_t ret_ref = tag_ptr(ret_copy, true);
20065         return ret_ref;
20066 }
20067
20068 uint64_t  __attribute__((export_name("TS_COption_boolZ_some"))) TS_COption_boolZ_some(jboolean o) {
20069         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
20070         *ret_copy = COption_boolZ_some(o);
20071         uint64_t ret_ref = tag_ptr(ret_copy, true);
20072         return ret_ref;
20073 }
20074
20075 uint64_t  __attribute__((export_name("TS_COption_boolZ_none"))) TS_COption_boolZ_none() {
20076         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
20077         *ret_copy = COption_boolZ_none();
20078         uint64_t ret_ref = tag_ptr(ret_copy, true);
20079         return ret_ref;
20080 }
20081
20082 void  __attribute__((export_name("TS_COption_boolZ_free"))) TS_COption_boolZ_free(uint64_t _res) {
20083         if (!ptr_is_owned(_res)) return;
20084         void* _res_ptr = untag_ptr(_res);
20085         CHECK_ACCESS(_res_ptr);
20086         LDKCOption_boolZ _res_conv = *(LDKCOption_boolZ*)(_res_ptr);
20087         FREE(untag_ptr(_res));
20088         COption_boolZ_free(_res_conv);
20089 }
20090
20091 static inline uint64_t COption_boolZ_clone_ptr(LDKCOption_boolZ *NONNULL_PTR arg) {
20092         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
20093         *ret_copy = COption_boolZ_clone(arg);
20094         uint64_t ret_ref = tag_ptr(ret_copy, true);
20095         return ret_ref;
20096 }
20097 int64_t  __attribute__((export_name("TS_COption_boolZ_clone_ptr"))) TS_COption_boolZ_clone_ptr(uint64_t arg) {
20098         LDKCOption_boolZ* arg_conv = (LDKCOption_boolZ*)untag_ptr(arg);
20099         int64_t ret_conv = COption_boolZ_clone_ptr(arg_conv);
20100         return ret_conv;
20101 }
20102
20103 uint64_t  __attribute__((export_name("TS_COption_boolZ_clone"))) TS_COption_boolZ_clone(uint64_t orig) {
20104         LDKCOption_boolZ* orig_conv = (LDKCOption_boolZ*)untag_ptr(orig);
20105         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
20106         *ret_copy = COption_boolZ_clone(orig_conv);
20107         uint64_t ret_ref = tag_ptr(ret_copy, true);
20108         return ret_ref;
20109 }
20110
20111 uint64_t  __attribute__((export_name("TS_CResult_WitnessNoneZ_ok"))) TS_CResult_WitnessNoneZ_ok(int8_tArray o) {
20112         LDKWitness o_ref;
20113         o_ref.datalen = o->arr_len;
20114         o_ref.data = MALLOC(o_ref.datalen, "LDKWitness Bytes");
20115         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
20116         o_ref.data_is_owned = true;
20117         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
20118         *ret_conv = CResult_WitnessNoneZ_ok(o_ref);
20119         return tag_ptr(ret_conv, true);
20120 }
20121
20122 uint64_t  __attribute__((export_name("TS_CResult_WitnessNoneZ_err"))) TS_CResult_WitnessNoneZ_err() {
20123         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
20124         *ret_conv = CResult_WitnessNoneZ_err();
20125         return tag_ptr(ret_conv, true);
20126 }
20127
20128 jboolean  __attribute__((export_name("TS_CResult_WitnessNoneZ_is_ok"))) TS_CResult_WitnessNoneZ_is_ok(uint64_t o) {
20129         LDKCResult_WitnessNoneZ* o_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(o);
20130         jboolean ret_conv = CResult_WitnessNoneZ_is_ok(o_conv);
20131         return ret_conv;
20132 }
20133
20134 void  __attribute__((export_name("TS_CResult_WitnessNoneZ_free"))) TS_CResult_WitnessNoneZ_free(uint64_t _res) {
20135         if (!ptr_is_owned(_res)) return;
20136         void* _res_ptr = untag_ptr(_res);
20137         CHECK_ACCESS(_res_ptr);
20138         LDKCResult_WitnessNoneZ _res_conv = *(LDKCResult_WitnessNoneZ*)(_res_ptr);
20139         FREE(untag_ptr(_res));
20140         CResult_WitnessNoneZ_free(_res_conv);
20141 }
20142
20143 static inline uint64_t CResult_WitnessNoneZ_clone_ptr(LDKCResult_WitnessNoneZ *NONNULL_PTR arg) {
20144         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
20145         *ret_conv = CResult_WitnessNoneZ_clone(arg);
20146         return tag_ptr(ret_conv, true);
20147 }
20148 int64_t  __attribute__((export_name("TS_CResult_WitnessNoneZ_clone_ptr"))) TS_CResult_WitnessNoneZ_clone_ptr(uint64_t arg) {
20149         LDKCResult_WitnessNoneZ* arg_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(arg);
20150         int64_t ret_conv = CResult_WitnessNoneZ_clone_ptr(arg_conv);
20151         return ret_conv;
20152 }
20153
20154 uint64_t  __attribute__((export_name("TS_CResult_WitnessNoneZ_clone"))) TS_CResult_WitnessNoneZ_clone(uint64_t orig) {
20155         LDKCResult_WitnessNoneZ* orig_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(orig);
20156         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
20157         *ret_conv = CResult_WitnessNoneZ_clone(orig_conv);
20158         return tag_ptr(ret_conv, true);
20159 }
20160
20161 void  __attribute__((export_name("TS_CVec_ECDSASignatureZ_free"))) TS_CVec_ECDSASignatureZ_free(ptrArray _res) {
20162         LDKCVec_ECDSASignatureZ _res_constr;
20163         _res_constr.datalen = _res->arr_len;
20164         if (_res_constr.datalen > 0)
20165                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
20166         else
20167                 _res_constr.data = NULL;
20168         int8_tArray* _res_vals = (void*) _res->elems;
20169         for (size_t m = 0; m < _res_constr.datalen; m++) {
20170                 int8_tArray _res_conv_12 = _res_vals[m];
20171                 LDKECDSASignature _res_conv_12_ref;
20172                 CHECK(_res_conv_12->arr_len == 64);
20173                 memcpy(_res_conv_12_ref.compact_form, _res_conv_12->elems, 64); FREE(_res_conv_12);
20174                 _res_constr.data[m] = _res_conv_12_ref;
20175         }
20176         FREE(_res);
20177         CVec_ECDSASignatureZ_free(_res_constr);
20178 }
20179
20180 static inline uint64_t C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR arg) {
20181         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
20182         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(arg);
20183         return tag_ptr(ret_conv, true);
20184 }
20185 int64_t  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(uint64_t arg) {
20186         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* arg_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(arg);
20187         int64_t ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(arg_conv);
20188         return ret_conv;
20189 }
20190
20191 uint64_t  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(uint64_t orig) {
20192         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* orig_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(orig);
20193         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
20194         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(orig_conv);
20195         return tag_ptr(ret_conv, true);
20196 }
20197
20198 uint64_t  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(int8_tArray a, ptrArray b) {
20199         LDKECDSASignature a_ref;
20200         CHECK(a->arr_len == 64);
20201         memcpy(a_ref.compact_form, a->elems, 64); FREE(a);
20202         LDKCVec_ECDSASignatureZ b_constr;
20203         b_constr.datalen = b->arr_len;
20204         if (b_constr.datalen > 0)
20205                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
20206         else
20207                 b_constr.data = NULL;
20208         int8_tArray* b_vals = (void*) b->elems;
20209         for (size_t m = 0; m < b_constr.datalen; m++) {
20210                 int8_tArray b_conv_12 = b_vals[m];
20211                 LDKECDSASignature b_conv_12_ref;
20212                 CHECK(b_conv_12->arr_len == 64);
20213                 memcpy(b_conv_12_ref.compact_form, b_conv_12->elems, 64); FREE(b_conv_12);
20214                 b_constr.data[m] = b_conv_12_ref;
20215         }
20216         FREE(b);
20217         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
20218         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(a_ref, b_constr);
20219         return tag_ptr(ret_conv, true);
20220 }
20221
20222 void  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(uint64_t _res) {
20223         if (!ptr_is_owned(_res)) return;
20224         void* _res_ptr = untag_ptr(_res);
20225         CHECK_ACCESS(_res_ptr);
20226         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ _res_conv = *(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)(_res_ptr);
20227         FREE(untag_ptr(_res));
20228         C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(_res_conv);
20229 }
20230
20231 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(uint64_t o) {
20232         void* o_ptr = untag_ptr(o);
20233         CHECK_ACCESS(o_ptr);
20234         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ o_conv = *(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)(o_ptr);
20235         o_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone((LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(o));
20236         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
20237         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(o_conv);
20238         return tag_ptr(ret_conv, true);
20239 }
20240
20241 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err() {
20242         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
20243         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err();
20244         return tag_ptr(ret_conv, true);
20245 }
20246
20247 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(uint64_t o) {
20248         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(o);
20249         jboolean ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(o_conv);
20250         return ret_conv;
20251 }
20252
20253 void  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(uint64_t _res) {
20254         if (!ptr_is_owned(_res)) return;
20255         void* _res_ptr = untag_ptr(_res);
20256         CHECK_ACCESS(_res_ptr);
20257         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)(_res_ptr);
20258         FREE(untag_ptr(_res));
20259         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(_res_conv);
20260 }
20261
20262 static inline uint64_t CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR arg) {
20263         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
20264         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(arg);
20265         return tag_ptr(ret_conv, true);
20266 }
20267 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(uint64_t arg) {
20268         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(arg);
20269         int64_t ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(arg_conv);
20270         return ret_conv;
20271 }
20272
20273 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(uint64_t orig) {
20274         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(orig);
20275         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
20276         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(orig_conv);
20277         return tag_ptr(ret_conv, true);
20278 }
20279
20280 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint64_t o) {
20281         LDKInMemorySigner o_conv;
20282         o_conv.inner = untag_ptr(o);
20283         o_conv.is_owned = ptr_is_owned(o);
20284         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20285         o_conv = InMemorySigner_clone(&o_conv);
20286         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
20287         *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
20288         return tag_ptr(ret_conv, true);
20289 }
20290
20291 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_err"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint64_t e) {
20292         void* e_ptr = untag_ptr(e);
20293         CHECK_ACCESS(e_ptr);
20294         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20295         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20296         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
20297         *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
20298         return tag_ptr(ret_conv, true);
20299 }
20300
20301 jboolean  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_is_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_is_ok(uint64_t o) {
20302         LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(o);
20303         jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
20304         return ret_conv;
20305 }
20306
20307 void  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_free"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint64_t _res) {
20308         if (!ptr_is_owned(_res)) return;
20309         void* _res_ptr = untag_ptr(_res);
20310         CHECK_ACCESS(_res_ptr);
20311         LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
20312         FREE(untag_ptr(_res));
20313         CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
20314 }
20315
20316 static inline uint64_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
20317         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
20318         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
20319         return tag_ptr(ret_conv, true);
20320 }
20321 int64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr"))) TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr(uint64_t arg) {
20322         LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(arg);
20323         int64_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
20324         return ret_conv;
20325 }
20326
20327 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint64_t orig) {
20328         LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(orig);
20329         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
20330         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
20331         return tag_ptr(ret_conv, true);
20332 }
20333
20334 void  __attribute__((export_name("TS_CVec_ChannelDetailsZ_free"))) TS_CVec_ChannelDetailsZ_free(uint64_tArray _res) {
20335         LDKCVec_ChannelDetailsZ _res_constr;
20336         _res_constr.datalen = _res->arr_len;
20337         if (_res_constr.datalen > 0)
20338                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
20339         else
20340                 _res_constr.data = NULL;
20341         uint64_t* _res_vals = _res->elems;
20342         for (size_t q = 0; q < _res_constr.datalen; q++) {
20343                 uint64_t _res_conv_16 = _res_vals[q];
20344                 LDKChannelDetails _res_conv_16_conv;
20345                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
20346                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
20347                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
20348                 _res_constr.data[q] = _res_conv_16_conv;
20349         }
20350         FREE(_res);
20351         CVec_ChannelDetailsZ_free(_res_constr);
20352 }
20353
20354 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_ok"))) TS_CResult_RouteLightningErrorZ_ok(uint64_t o) {
20355         LDKRoute o_conv;
20356         o_conv.inner = untag_ptr(o);
20357         o_conv.is_owned = ptr_is_owned(o);
20358         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20359         o_conv = Route_clone(&o_conv);
20360         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
20361         *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
20362         return tag_ptr(ret_conv, true);
20363 }
20364
20365 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_err"))) TS_CResult_RouteLightningErrorZ_err(uint64_t e) {
20366         LDKLightningError e_conv;
20367         e_conv.inner = untag_ptr(e);
20368         e_conv.is_owned = ptr_is_owned(e);
20369         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20370         e_conv = LightningError_clone(&e_conv);
20371         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
20372         *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
20373         return tag_ptr(ret_conv, true);
20374 }
20375
20376 jboolean  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_is_ok"))) TS_CResult_RouteLightningErrorZ_is_ok(uint64_t o) {
20377         LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(o);
20378         jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv);
20379         return ret_conv;
20380 }
20381
20382 void  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_free"))) TS_CResult_RouteLightningErrorZ_free(uint64_t _res) {
20383         if (!ptr_is_owned(_res)) return;
20384         void* _res_ptr = untag_ptr(_res);
20385         CHECK_ACCESS(_res_ptr);
20386         LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
20387         FREE(untag_ptr(_res));
20388         CResult_RouteLightningErrorZ_free(_res_conv);
20389 }
20390
20391 static inline uint64_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
20392         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
20393         *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
20394         return tag_ptr(ret_conv, true);
20395 }
20396 int64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone_ptr"))) TS_CResult_RouteLightningErrorZ_clone_ptr(uint64_t arg) {
20397         LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(arg);
20398         int64_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
20399         return ret_conv;
20400 }
20401
20402 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone"))) TS_CResult_RouteLightningErrorZ_clone(uint64_t orig) {
20403         LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(orig);
20404         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
20405         *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
20406         return tag_ptr(ret_conv, true);
20407 }
20408
20409 static inline uint64_t C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR arg) {
20410         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
20411         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(arg);
20412         return tag_ptr(ret_conv, true);
20413 }
20414 int64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(uint64_t arg) {
20415         LDKC2Tuple_BlindedPayInfoBlindedPathZ* arg_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(arg);
20416         int64_t ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(arg_conv);
20417         return ret_conv;
20418 }
20419
20420 uint64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_clone"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_clone(uint64_t orig) {
20421         LDKC2Tuple_BlindedPayInfoBlindedPathZ* orig_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(orig);
20422         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
20423         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(orig_conv);
20424         return tag_ptr(ret_conv, true);
20425 }
20426
20427 uint64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_new"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_new(uint64_t a, uint64_t b) {
20428         LDKBlindedPayInfo a_conv;
20429         a_conv.inner = untag_ptr(a);
20430         a_conv.is_owned = ptr_is_owned(a);
20431         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
20432         a_conv = BlindedPayInfo_clone(&a_conv);
20433         LDKBlindedPath b_conv;
20434         b_conv.inner = untag_ptr(b);
20435         b_conv.is_owned = ptr_is_owned(b);
20436         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
20437         b_conv = BlindedPath_clone(&b_conv);
20438         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
20439         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_new(a_conv, b_conv);
20440         return tag_ptr(ret_conv, true);
20441 }
20442
20443 void  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_free"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_free(uint64_t _res) {
20444         if (!ptr_is_owned(_res)) return;
20445         void* _res_ptr = untag_ptr(_res);
20446         CHECK_ACCESS(_res_ptr);
20447         LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_ptr);
20448         FREE(untag_ptr(_res));
20449         C2Tuple_BlindedPayInfoBlindedPathZ_free(_res_conv);
20450 }
20451
20452 void  __attribute__((export_name("TS_CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free"))) TS_CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(uint64_tArray _res) {
20453         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ _res_constr;
20454         _res_constr.datalen = _res->arr_len;
20455         if (_res_constr.datalen > 0)
20456                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
20457         else
20458                 _res_constr.data = NULL;
20459         uint64_t* _res_vals = _res->elems;
20460         for (size_t l = 0; l < _res_constr.datalen; l++) {
20461                 uint64_t _res_conv_37 = _res_vals[l];
20462                 void* _res_conv_37_ptr = untag_ptr(_res_conv_37);
20463                 CHECK_ACCESS(_res_conv_37_ptr);
20464                 LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_conv_37_ptr);
20465                 FREE(untag_ptr(_res_conv_37));
20466                 _res_constr.data[l] = _res_conv_37_conv;
20467         }
20468         FREE(_res);
20469         CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(_res_constr);
20470 }
20471
20472 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_ok"))) TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_ok(uint64_tArray o) {
20473         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ o_constr;
20474         o_constr.datalen = o->arr_len;
20475         if (o_constr.datalen > 0)
20476                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
20477         else
20478                 o_constr.data = NULL;
20479         uint64_t* o_vals = o->elems;
20480         for (size_t l = 0; l < o_constr.datalen; l++) {
20481                 uint64_t o_conv_37 = o_vals[l];
20482                 void* o_conv_37_ptr = untag_ptr(o_conv_37);
20483                 CHECK_ACCESS(o_conv_37_ptr);
20484                 LDKC2Tuple_BlindedPayInfoBlindedPathZ o_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(o_conv_37_ptr);
20485                 o_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(o_conv_37));
20486                 o_constr.data[l] = o_conv_37_conv;
20487         }
20488         FREE(o);
20489         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
20490         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_ok(o_constr);
20491         return tag_ptr(ret_conv, true);
20492 }
20493
20494 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_err"))) TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_err() {
20495         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
20496         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_err();
20497         return tag_ptr(ret_conv, true);
20498 }
20499
20500 jboolean  __attribute__((export_name("TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_is_ok"))) TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_is_ok(uint64_t o) {
20501         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* o_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(o);
20502         jboolean ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_is_ok(o_conv);
20503         return ret_conv;
20504 }
20505
20506 void  __attribute__((export_name("TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_free"))) TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_free(uint64_t _res) {
20507         if (!ptr_is_owned(_res)) return;
20508         void* _res_ptr = untag_ptr(_res);
20509         CHECK_ACCESS(_res_ptr);
20510         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)(_res_ptr);
20511         FREE(untag_ptr(_res));
20512         CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_free(_res_conv);
20513 }
20514
20515 static inline uint64_t CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone_ptr(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ *NONNULL_PTR arg) {
20516         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
20517         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone(arg);
20518         return tag_ptr(ret_conv, true);
20519 }
20520 int64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone_ptr"))) TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone_ptr(uint64_t arg) {
20521         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* arg_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(arg);
20522         int64_t ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone_ptr(arg_conv);
20523         return ret_conv;
20524 }
20525
20526 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone"))) TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone(uint64_t orig) {
20527         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* orig_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(orig);
20528         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
20529         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone(orig_conv);
20530         return tag_ptr(ret_conv, true);
20531 }
20532
20533 void  __attribute__((export_name("TS_CVec_PublicKeyZ_free"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
20534         LDKCVec_PublicKeyZ _res_constr;
20535         _res_constr.datalen = _res->arr_len;
20536         if (_res_constr.datalen > 0)
20537                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
20538         else
20539                 _res_constr.data = NULL;
20540         int8_tArray* _res_vals = (void*) _res->elems;
20541         for (size_t m = 0; m < _res_constr.datalen; m++) {
20542                 int8_tArray _res_conv_12 = _res_vals[m];
20543                 LDKPublicKey _res_conv_12_ref;
20544                 CHECK(_res_conv_12->arr_len == 33);
20545                 memcpy(_res_conv_12_ref.compressed_form, _res_conv_12->elems, 33); FREE(_res_conv_12);
20546                 _res_constr.data[m] = _res_conv_12_ref;
20547         }
20548         FREE(_res);
20549         CVec_PublicKeyZ_free(_res_constr);
20550 }
20551
20552 uint64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_ok"))) TS_CResult_OnionMessagePathNoneZ_ok(uint64_t o) {
20553         LDKOnionMessagePath o_conv;
20554         o_conv.inner = untag_ptr(o);
20555         o_conv.is_owned = ptr_is_owned(o);
20556         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20557         o_conv = OnionMessagePath_clone(&o_conv);
20558         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
20559         *ret_conv = CResult_OnionMessagePathNoneZ_ok(o_conv);
20560         return tag_ptr(ret_conv, true);
20561 }
20562
20563 uint64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_err"))) TS_CResult_OnionMessagePathNoneZ_err() {
20564         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
20565         *ret_conv = CResult_OnionMessagePathNoneZ_err();
20566         return tag_ptr(ret_conv, true);
20567 }
20568
20569 jboolean  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_is_ok"))) TS_CResult_OnionMessagePathNoneZ_is_ok(uint64_t o) {
20570         LDKCResult_OnionMessagePathNoneZ* o_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(o);
20571         jboolean ret_conv = CResult_OnionMessagePathNoneZ_is_ok(o_conv);
20572         return ret_conv;
20573 }
20574
20575 void  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_free"))) TS_CResult_OnionMessagePathNoneZ_free(uint64_t _res) {
20576         if (!ptr_is_owned(_res)) return;
20577         void* _res_ptr = untag_ptr(_res);
20578         CHECK_ACCESS(_res_ptr);
20579         LDKCResult_OnionMessagePathNoneZ _res_conv = *(LDKCResult_OnionMessagePathNoneZ*)(_res_ptr);
20580         FREE(untag_ptr(_res));
20581         CResult_OnionMessagePathNoneZ_free(_res_conv);
20582 }
20583
20584 static inline uint64_t CResult_OnionMessagePathNoneZ_clone_ptr(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR arg) {
20585         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
20586         *ret_conv = CResult_OnionMessagePathNoneZ_clone(arg);
20587         return tag_ptr(ret_conv, true);
20588 }
20589 int64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_clone_ptr"))) TS_CResult_OnionMessagePathNoneZ_clone_ptr(uint64_t arg) {
20590         LDKCResult_OnionMessagePathNoneZ* arg_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(arg);
20591         int64_t ret_conv = CResult_OnionMessagePathNoneZ_clone_ptr(arg_conv);
20592         return ret_conv;
20593 }
20594
20595 uint64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_clone"))) TS_CResult_OnionMessagePathNoneZ_clone(uint64_t orig) {
20596         LDKCResult_OnionMessagePathNoneZ* orig_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(orig);
20597         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
20598         *ret_conv = CResult_OnionMessagePathNoneZ_clone(orig_conv);
20599         return tag_ptr(ret_conv, true);
20600 }
20601
20602 uint64_t  __attribute__((export_name("TS_CResult_CVec_BlindedPathZNoneZ_ok"))) TS_CResult_CVec_BlindedPathZNoneZ_ok(uint64_tArray o) {
20603         LDKCVec_BlindedPathZ o_constr;
20604         o_constr.datalen = o->arr_len;
20605         if (o_constr.datalen > 0)
20606                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKBlindedPath), "LDKCVec_BlindedPathZ Elements");
20607         else
20608                 o_constr.data = NULL;
20609         uint64_t* o_vals = o->elems;
20610         for (size_t n = 0; n < o_constr.datalen; n++) {
20611                 uint64_t o_conv_13 = o_vals[n];
20612                 LDKBlindedPath o_conv_13_conv;
20613                 o_conv_13_conv.inner = untag_ptr(o_conv_13);
20614                 o_conv_13_conv.is_owned = ptr_is_owned(o_conv_13);
20615                 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv_13_conv);
20616                 o_conv_13_conv = BlindedPath_clone(&o_conv_13_conv);
20617                 o_constr.data[n] = o_conv_13_conv;
20618         }
20619         FREE(o);
20620         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
20621         *ret_conv = CResult_CVec_BlindedPathZNoneZ_ok(o_constr);
20622         return tag_ptr(ret_conv, true);
20623 }
20624
20625 uint64_t  __attribute__((export_name("TS_CResult_CVec_BlindedPathZNoneZ_err"))) TS_CResult_CVec_BlindedPathZNoneZ_err() {
20626         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
20627         *ret_conv = CResult_CVec_BlindedPathZNoneZ_err();
20628         return tag_ptr(ret_conv, true);
20629 }
20630
20631 jboolean  __attribute__((export_name("TS_CResult_CVec_BlindedPathZNoneZ_is_ok"))) TS_CResult_CVec_BlindedPathZNoneZ_is_ok(uint64_t o) {
20632         LDKCResult_CVec_BlindedPathZNoneZ* o_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(o);
20633         jboolean ret_conv = CResult_CVec_BlindedPathZNoneZ_is_ok(o_conv);
20634         return ret_conv;
20635 }
20636
20637 void  __attribute__((export_name("TS_CResult_CVec_BlindedPathZNoneZ_free"))) TS_CResult_CVec_BlindedPathZNoneZ_free(uint64_t _res) {
20638         if (!ptr_is_owned(_res)) return;
20639         void* _res_ptr = untag_ptr(_res);
20640         CHECK_ACCESS(_res_ptr);
20641         LDKCResult_CVec_BlindedPathZNoneZ _res_conv = *(LDKCResult_CVec_BlindedPathZNoneZ*)(_res_ptr);
20642         FREE(untag_ptr(_res));
20643         CResult_CVec_BlindedPathZNoneZ_free(_res_conv);
20644 }
20645
20646 static inline uint64_t CResult_CVec_BlindedPathZNoneZ_clone_ptr(LDKCResult_CVec_BlindedPathZNoneZ *NONNULL_PTR arg) {
20647         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
20648         *ret_conv = CResult_CVec_BlindedPathZNoneZ_clone(arg);
20649         return tag_ptr(ret_conv, true);
20650 }
20651 int64_t  __attribute__((export_name("TS_CResult_CVec_BlindedPathZNoneZ_clone_ptr"))) TS_CResult_CVec_BlindedPathZNoneZ_clone_ptr(uint64_t arg) {
20652         LDKCResult_CVec_BlindedPathZNoneZ* arg_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(arg);
20653         int64_t ret_conv = CResult_CVec_BlindedPathZNoneZ_clone_ptr(arg_conv);
20654         return ret_conv;
20655 }
20656
20657 uint64_t  __attribute__((export_name("TS_CResult_CVec_BlindedPathZNoneZ_clone"))) TS_CResult_CVec_BlindedPathZNoneZ_clone(uint64_t orig) {
20658         LDKCResult_CVec_BlindedPathZNoneZ* orig_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(orig);
20659         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
20660         *ret_conv = CResult_CVec_BlindedPathZNoneZ_clone(orig_conv);
20661         return tag_ptr(ret_conv, true);
20662 }
20663
20664 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_ok(uint64_t o) {
20665         LDKInFlightHtlcs o_conv;
20666         o_conv.inner = untag_ptr(o);
20667         o_conv.is_owned = ptr_is_owned(o);
20668         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20669         o_conv = InFlightHtlcs_clone(&o_conv);
20670         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
20671         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_ok(o_conv);
20672         return tag_ptr(ret_conv, true);
20673 }
20674
20675 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_err"))) TS_CResult_InFlightHtlcsDecodeErrorZ_err(uint64_t e) {
20676         void* e_ptr = untag_ptr(e);
20677         CHECK_ACCESS(e_ptr);
20678         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20679         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20680         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
20681         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_err(e_conv);
20682         return tag_ptr(ret_conv, true);
20683 }
20684
20685 jboolean  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_is_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_is_ok(uint64_t o) {
20686         LDKCResult_InFlightHtlcsDecodeErrorZ* o_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(o);
20687         jboolean ret_conv = CResult_InFlightHtlcsDecodeErrorZ_is_ok(o_conv);
20688         return ret_conv;
20689 }
20690
20691 void  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_free"))) TS_CResult_InFlightHtlcsDecodeErrorZ_free(uint64_t _res) {
20692         if (!ptr_is_owned(_res)) return;
20693         void* _res_ptr = untag_ptr(_res);
20694         CHECK_ACCESS(_res_ptr);
20695         LDKCResult_InFlightHtlcsDecodeErrorZ _res_conv = *(LDKCResult_InFlightHtlcsDecodeErrorZ*)(_res_ptr);
20696         FREE(untag_ptr(_res));
20697         CResult_InFlightHtlcsDecodeErrorZ_free(_res_conv);
20698 }
20699
20700 static inline uint64_t CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR arg) {
20701         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
20702         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(arg);
20703         return tag_ptr(ret_conv, true);
20704 }
20705 int64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_clone_ptr"))) TS_CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(uint64_t arg) {
20706         LDKCResult_InFlightHtlcsDecodeErrorZ* arg_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(arg);
20707         int64_t ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(arg_conv);
20708         return ret_conv;
20709 }
20710
20711 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_clone"))) TS_CResult_InFlightHtlcsDecodeErrorZ_clone(uint64_t orig) {
20712         LDKCResult_InFlightHtlcsDecodeErrorZ* orig_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(orig);
20713         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
20714         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(orig_conv);
20715         return tag_ptr(ret_conv, true);
20716 }
20717
20718 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_ok"))) TS_CResult_RouteHopDecodeErrorZ_ok(uint64_t o) {
20719         LDKRouteHop o_conv;
20720         o_conv.inner = untag_ptr(o);
20721         o_conv.is_owned = ptr_is_owned(o);
20722         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20723         o_conv = RouteHop_clone(&o_conv);
20724         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
20725         *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
20726         return tag_ptr(ret_conv, true);
20727 }
20728
20729 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_err"))) TS_CResult_RouteHopDecodeErrorZ_err(uint64_t e) {
20730         void* e_ptr = untag_ptr(e);
20731         CHECK_ACCESS(e_ptr);
20732         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20733         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20734         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
20735         *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
20736         return tag_ptr(ret_conv, true);
20737 }
20738
20739 jboolean  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHopDecodeErrorZ_is_ok(uint64_t o) {
20740         LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(o);
20741         jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
20742         return ret_conv;
20743 }
20744
20745 void  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_free"))) TS_CResult_RouteHopDecodeErrorZ_free(uint64_t _res) {
20746         if (!ptr_is_owned(_res)) return;
20747         void* _res_ptr = untag_ptr(_res);
20748         CHECK_ACCESS(_res_ptr);
20749         LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
20750         FREE(untag_ptr(_res));
20751         CResult_RouteHopDecodeErrorZ_free(_res_conv);
20752 }
20753
20754 static inline uint64_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
20755         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
20756         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
20757         return tag_ptr(ret_conv, true);
20758 }
20759 int64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHopDecodeErrorZ_clone_ptr(uint64_t arg) {
20760         LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(arg);
20761         int64_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
20762         return ret_conv;
20763 }
20764
20765 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone"))) TS_CResult_RouteHopDecodeErrorZ_clone(uint64_t orig) {
20766         LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(orig);
20767         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
20768         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
20769         return tag_ptr(ret_conv, true);
20770 }
20771
20772 void  __attribute__((export_name("TS_CVec_BlindedHopZ_free"))) TS_CVec_BlindedHopZ_free(uint64_tArray _res) {
20773         LDKCVec_BlindedHopZ _res_constr;
20774         _res_constr.datalen = _res->arr_len;
20775         if (_res_constr.datalen > 0)
20776                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
20777         else
20778                 _res_constr.data = NULL;
20779         uint64_t* _res_vals = _res->elems;
20780         for (size_t m = 0; m < _res_constr.datalen; m++) {
20781                 uint64_t _res_conv_12 = _res_vals[m];
20782                 LDKBlindedHop _res_conv_12_conv;
20783                 _res_conv_12_conv.inner = untag_ptr(_res_conv_12);
20784                 _res_conv_12_conv.is_owned = ptr_is_owned(_res_conv_12);
20785                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv);
20786                 _res_constr.data[m] = _res_conv_12_conv;
20787         }
20788         FREE(_res);
20789         CVec_BlindedHopZ_free(_res_constr);
20790 }
20791
20792 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_ok"))) TS_CResult_BlindedTailDecodeErrorZ_ok(uint64_t o) {
20793         LDKBlindedTail o_conv;
20794         o_conv.inner = untag_ptr(o);
20795         o_conv.is_owned = ptr_is_owned(o);
20796         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20797         o_conv = BlindedTail_clone(&o_conv);
20798         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
20799         *ret_conv = CResult_BlindedTailDecodeErrorZ_ok(o_conv);
20800         return tag_ptr(ret_conv, true);
20801 }
20802
20803 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_err"))) TS_CResult_BlindedTailDecodeErrorZ_err(uint64_t e) {
20804         void* e_ptr = untag_ptr(e);
20805         CHECK_ACCESS(e_ptr);
20806         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20807         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20808         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
20809         *ret_conv = CResult_BlindedTailDecodeErrorZ_err(e_conv);
20810         return tag_ptr(ret_conv, true);
20811 }
20812
20813 jboolean  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_is_ok"))) TS_CResult_BlindedTailDecodeErrorZ_is_ok(uint64_t o) {
20814         LDKCResult_BlindedTailDecodeErrorZ* o_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(o);
20815         jboolean ret_conv = CResult_BlindedTailDecodeErrorZ_is_ok(o_conv);
20816         return ret_conv;
20817 }
20818
20819 void  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_free"))) TS_CResult_BlindedTailDecodeErrorZ_free(uint64_t _res) {
20820         if (!ptr_is_owned(_res)) return;
20821         void* _res_ptr = untag_ptr(_res);
20822         CHECK_ACCESS(_res_ptr);
20823         LDKCResult_BlindedTailDecodeErrorZ _res_conv = *(LDKCResult_BlindedTailDecodeErrorZ*)(_res_ptr);
20824         FREE(untag_ptr(_res));
20825         CResult_BlindedTailDecodeErrorZ_free(_res_conv);
20826 }
20827
20828 static inline uint64_t CResult_BlindedTailDecodeErrorZ_clone_ptr(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR arg) {
20829         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
20830         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(arg);
20831         return tag_ptr(ret_conv, true);
20832 }
20833 int64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedTailDecodeErrorZ_clone_ptr(uint64_t arg) {
20834         LDKCResult_BlindedTailDecodeErrorZ* arg_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(arg);
20835         int64_t ret_conv = CResult_BlindedTailDecodeErrorZ_clone_ptr(arg_conv);
20836         return ret_conv;
20837 }
20838
20839 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_clone"))) TS_CResult_BlindedTailDecodeErrorZ_clone(uint64_t orig) {
20840         LDKCResult_BlindedTailDecodeErrorZ* orig_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(orig);
20841         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
20842         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(orig_conv);
20843         return tag_ptr(ret_conv, true);
20844 }
20845
20846 void  __attribute__((export_name("TS_CVec_RouteHopZ_free"))) TS_CVec_RouteHopZ_free(uint64_tArray _res) {
20847         LDKCVec_RouteHopZ _res_constr;
20848         _res_constr.datalen = _res->arr_len;
20849         if (_res_constr.datalen > 0)
20850                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
20851         else
20852                 _res_constr.data = NULL;
20853         uint64_t* _res_vals = _res->elems;
20854         for (size_t k = 0; k < _res_constr.datalen; k++) {
20855                 uint64_t _res_conv_10 = _res_vals[k];
20856                 LDKRouteHop _res_conv_10_conv;
20857                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
20858                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
20859                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
20860                 _res_constr.data[k] = _res_conv_10_conv;
20861         }
20862         FREE(_res);
20863         CVec_RouteHopZ_free(_res_constr);
20864 }
20865
20866 void  __attribute__((export_name("TS_CVec_PathZ_free"))) TS_CVec_PathZ_free(uint64_tArray _res) {
20867         LDKCVec_PathZ _res_constr;
20868         _res_constr.datalen = _res->arr_len;
20869         if (_res_constr.datalen > 0)
20870                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
20871         else
20872                 _res_constr.data = NULL;
20873         uint64_t* _res_vals = _res->elems;
20874         for (size_t g = 0; g < _res_constr.datalen; g++) {
20875                 uint64_t _res_conv_6 = _res_vals[g];
20876                 LDKPath _res_conv_6_conv;
20877                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
20878                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
20879                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
20880                 _res_constr.data[g] = _res_conv_6_conv;
20881         }
20882         FREE(_res);
20883         CVec_PathZ_free(_res_constr);
20884 }
20885
20886 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_ok"))) TS_CResult_RouteDecodeErrorZ_ok(uint64_t o) {
20887         LDKRoute o_conv;
20888         o_conv.inner = untag_ptr(o);
20889         o_conv.is_owned = ptr_is_owned(o);
20890         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20891         o_conv = Route_clone(&o_conv);
20892         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
20893         *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
20894         return tag_ptr(ret_conv, true);
20895 }
20896
20897 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_err"))) TS_CResult_RouteDecodeErrorZ_err(uint64_t e) {
20898         void* e_ptr = untag_ptr(e);
20899         CHECK_ACCESS(e_ptr);
20900         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20901         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20902         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
20903         *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
20904         return tag_ptr(ret_conv, true);
20905 }
20906
20907 jboolean  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_is_ok"))) TS_CResult_RouteDecodeErrorZ_is_ok(uint64_t o) {
20908         LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(o);
20909         jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv);
20910         return ret_conv;
20911 }
20912
20913 void  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_free"))) TS_CResult_RouteDecodeErrorZ_free(uint64_t _res) {
20914         if (!ptr_is_owned(_res)) return;
20915         void* _res_ptr = untag_ptr(_res);
20916         CHECK_ACCESS(_res_ptr);
20917         LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
20918         FREE(untag_ptr(_res));
20919         CResult_RouteDecodeErrorZ_free(_res_conv);
20920 }
20921
20922 static inline uint64_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
20923         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
20924         *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
20925         return tag_ptr(ret_conv, true);
20926 }
20927 int64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone_ptr"))) TS_CResult_RouteDecodeErrorZ_clone_ptr(uint64_t arg) {
20928         LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(arg);
20929         int64_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
20930         return ret_conv;
20931 }
20932
20933 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone"))) TS_CResult_RouteDecodeErrorZ_clone(uint64_t orig) {
20934         LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(orig);
20935         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
20936         *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
20937         return tag_ptr(ret_conv, true);
20938 }
20939
20940 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_ok"))) TS_CResult_RouteParametersDecodeErrorZ_ok(uint64_t o) {
20941         LDKRouteParameters o_conv;
20942         o_conv.inner = untag_ptr(o);
20943         o_conv.is_owned = ptr_is_owned(o);
20944         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20945         o_conv = RouteParameters_clone(&o_conv);
20946         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
20947         *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
20948         return tag_ptr(ret_conv, true);
20949 }
20950
20951 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_err"))) TS_CResult_RouteParametersDecodeErrorZ_err(uint64_t e) {
20952         void* e_ptr = untag_ptr(e);
20953         CHECK_ACCESS(e_ptr);
20954         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20955         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20956         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
20957         *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
20958         return tag_ptr(ret_conv, true);
20959 }
20960
20961 jboolean  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_is_ok"))) TS_CResult_RouteParametersDecodeErrorZ_is_ok(uint64_t o) {
20962         LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(o);
20963         jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
20964         return ret_conv;
20965 }
20966
20967 void  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_free"))) TS_CResult_RouteParametersDecodeErrorZ_free(uint64_t _res) {
20968         if (!ptr_is_owned(_res)) return;
20969         void* _res_ptr = untag_ptr(_res);
20970         CHECK_ACCESS(_res_ptr);
20971         LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
20972         FREE(untag_ptr(_res));
20973         CResult_RouteParametersDecodeErrorZ_free(_res_conv);
20974 }
20975
20976 static inline uint64_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
20977         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
20978         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
20979         return tag_ptr(ret_conv, true);
20980 }
20981 int64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone_ptr"))) TS_CResult_RouteParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
20982         LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(arg);
20983         int64_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
20984         return ret_conv;
20985 }
20986
20987 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone"))) TS_CResult_RouteParametersDecodeErrorZ_clone(uint64_t orig) {
20988         LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(orig);
20989         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
20990         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
20991         return tag_ptr(ret_conv, true);
20992 }
20993
20994 void  __attribute__((export_name("TS_CVec_u64Z_free"))) TS_CVec_u64Z_free(int64_tArray _res) {
20995         LDKCVec_u64Z _res_constr;
20996         _res_constr.datalen = _res->arr_len;
20997         if (_res_constr.datalen > 0)
20998                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
20999         else
21000                 _res_constr.data = NULL;
21001         int64_t* _res_vals = _res->elems;
21002         for (size_t i = 0; i < _res_constr.datalen; i++) {
21003                 int64_t _res_conv_8 = _res_vals[i];
21004                 _res_constr.data[i] = _res_conv_8;
21005         }
21006         FREE(_res);
21007         CVec_u64Z_free(_res_constr);
21008 }
21009
21010 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_ok(uint64_t o) {
21011         LDKPaymentParameters o_conv;
21012         o_conv.inner = untag_ptr(o);
21013         o_conv.is_owned = ptr_is_owned(o);
21014         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21015         o_conv = PaymentParameters_clone(&o_conv);
21016         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
21017         *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
21018         return tag_ptr(ret_conv, true);
21019 }
21020
21021 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_err"))) TS_CResult_PaymentParametersDecodeErrorZ_err(uint64_t e) {
21022         void* e_ptr = untag_ptr(e);
21023         CHECK_ACCESS(e_ptr);
21024         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21025         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21026         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
21027         *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
21028         return tag_ptr(ret_conv, true);
21029 }
21030
21031 jboolean  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_is_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_is_ok(uint64_t o) {
21032         LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(o);
21033         jboolean ret_conv = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
21034         return ret_conv;
21035 }
21036
21037 void  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_free"))) TS_CResult_PaymentParametersDecodeErrorZ_free(uint64_t _res) {
21038         if (!ptr_is_owned(_res)) return;
21039         void* _res_ptr = untag_ptr(_res);
21040         CHECK_ACCESS(_res_ptr);
21041         LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
21042         FREE(untag_ptr(_res));
21043         CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
21044 }
21045
21046 static inline uint64_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
21047         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
21048         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
21049         return tag_ptr(ret_conv, true);
21050 }
21051 int64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
21052         LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(arg);
21053         int64_t ret_conv = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
21054         return ret_conv;
21055 }
21056
21057 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone"))) TS_CResult_PaymentParametersDecodeErrorZ_clone(uint64_t orig) {
21058         LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(orig);
21059         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
21060         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
21061         return tag_ptr(ret_conv, true);
21062 }
21063
21064 void  __attribute__((export_name("TS_CVec_RouteHintZ_free"))) TS_CVec_RouteHintZ_free(uint64_tArray _res) {
21065         LDKCVec_RouteHintZ _res_constr;
21066         _res_constr.datalen = _res->arr_len;
21067         if (_res_constr.datalen > 0)
21068                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
21069         else
21070                 _res_constr.data = NULL;
21071         uint64_t* _res_vals = _res->elems;
21072         for (size_t l = 0; l < _res_constr.datalen; l++) {
21073                 uint64_t _res_conv_11 = _res_vals[l];
21074                 LDKRouteHint _res_conv_11_conv;
21075                 _res_conv_11_conv.inner = untag_ptr(_res_conv_11);
21076                 _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11);
21077                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
21078                 _res_constr.data[l] = _res_conv_11_conv;
21079         }
21080         FREE(_res);
21081         CVec_RouteHintZ_free(_res_constr);
21082 }
21083
21084 void  __attribute__((export_name("TS_CVec_RouteHintHopZ_free"))) TS_CVec_RouteHintHopZ_free(uint64_tArray _res) {
21085         LDKCVec_RouteHintHopZ _res_constr;
21086         _res_constr.datalen = _res->arr_len;
21087         if (_res_constr.datalen > 0)
21088                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
21089         else
21090                 _res_constr.data = NULL;
21091         uint64_t* _res_vals = _res->elems;
21092         for (size_t o = 0; o < _res_constr.datalen; o++) {
21093                 uint64_t _res_conv_14 = _res_vals[o];
21094                 LDKRouteHintHop _res_conv_14_conv;
21095                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
21096                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
21097                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
21098                 _res_constr.data[o] = _res_conv_14_conv;
21099         }
21100         FREE(_res);
21101         CVec_RouteHintHopZ_free(_res_constr);
21102 }
21103
21104 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_ok"))) TS_CResult_RouteHintDecodeErrorZ_ok(uint64_t o) {
21105         LDKRouteHint o_conv;
21106         o_conv.inner = untag_ptr(o);
21107         o_conv.is_owned = ptr_is_owned(o);
21108         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21109         o_conv = RouteHint_clone(&o_conv);
21110         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
21111         *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
21112         return tag_ptr(ret_conv, true);
21113 }
21114
21115 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_err"))) TS_CResult_RouteHintDecodeErrorZ_err(uint64_t e) {
21116         void* e_ptr = untag_ptr(e);
21117         CHECK_ACCESS(e_ptr);
21118         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21119         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21120         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
21121         *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
21122         return tag_ptr(ret_conv, true);
21123 }
21124
21125 jboolean  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_is_ok"))) TS_CResult_RouteHintDecodeErrorZ_is_ok(uint64_t o) {
21126         LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(o);
21127         jboolean ret_conv = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
21128         return ret_conv;
21129 }
21130
21131 void  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_free"))) TS_CResult_RouteHintDecodeErrorZ_free(uint64_t _res) {
21132         if (!ptr_is_owned(_res)) return;
21133         void* _res_ptr = untag_ptr(_res);
21134         CHECK_ACCESS(_res_ptr);
21135         LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
21136         FREE(untag_ptr(_res));
21137         CResult_RouteHintDecodeErrorZ_free(_res_conv);
21138 }
21139
21140 static inline uint64_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
21141         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
21142         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
21143         return tag_ptr(ret_conv, true);
21144 }
21145 int64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintDecodeErrorZ_clone_ptr(uint64_t arg) {
21146         LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(arg);
21147         int64_t ret_conv = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
21148         return ret_conv;
21149 }
21150
21151 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone"))) TS_CResult_RouteHintDecodeErrorZ_clone(uint64_t orig) {
21152         LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(orig);
21153         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
21154         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
21155         return tag_ptr(ret_conv, true);
21156 }
21157
21158 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_ok(uint64_t o) {
21159         LDKRouteHintHop o_conv;
21160         o_conv.inner = untag_ptr(o);
21161         o_conv.is_owned = ptr_is_owned(o);
21162         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21163         o_conv = RouteHintHop_clone(&o_conv);
21164         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
21165         *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
21166         return tag_ptr(ret_conv, true);
21167 }
21168
21169 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_err"))) TS_CResult_RouteHintHopDecodeErrorZ_err(uint64_t e) {
21170         void* e_ptr = untag_ptr(e);
21171         CHECK_ACCESS(e_ptr);
21172         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21173         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21174         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
21175         *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
21176         return tag_ptr(ret_conv, true);
21177 }
21178
21179 jboolean  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_is_ok(uint64_t o) {
21180         LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(o);
21181         jboolean ret_conv = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
21182         return ret_conv;
21183 }
21184
21185 void  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_free"))) TS_CResult_RouteHintHopDecodeErrorZ_free(uint64_t _res) {
21186         if (!ptr_is_owned(_res)) return;
21187         void* _res_ptr = untag_ptr(_res);
21188         CHECK_ACCESS(_res_ptr);
21189         LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
21190         FREE(untag_ptr(_res));
21191         CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
21192 }
21193
21194 static inline uint64_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
21195         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
21196         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
21197         return tag_ptr(ret_conv, true);
21198 }
21199 int64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr(uint64_t arg) {
21200         LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(arg);
21201         int64_t ret_conv = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
21202         return ret_conv;
21203 }
21204
21205 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone"))) TS_CResult_RouteHintHopDecodeErrorZ_clone(uint64_t orig) {
21206         LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(orig);
21207         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
21208         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
21209         return tag_ptr(ret_conv, true);
21210 }
21211
21212 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok(uint64_t o) {
21213         LDKFixedPenaltyScorer o_conv;
21214         o_conv.inner = untag_ptr(o);
21215         o_conv.is_owned = ptr_is_owned(o);
21216         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21217         o_conv = FixedPenaltyScorer_clone(&o_conv);
21218         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
21219         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
21220         return tag_ptr(ret_conv, true);
21221 }
21222
21223 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_err(uint64_t e) {
21224         void* e_ptr = untag_ptr(e);
21225         CHECK_ACCESS(e_ptr);
21226         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21227         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21228         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
21229         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
21230         return tag_ptr(ret_conv, true);
21231 }
21232
21233 jboolean  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(uint64_t o) {
21234         LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(o);
21235         jboolean ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
21236         return ret_conv;
21237 }
21238
21239 void  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_free"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_free(uint64_t _res) {
21240         if (!ptr_is_owned(_res)) return;
21241         void* _res_ptr = untag_ptr(_res);
21242         CHECK_ACCESS(_res_ptr);
21243         LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
21244         FREE(untag_ptr(_res));
21245         CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
21246 }
21247
21248 static inline uint64_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
21249         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
21250         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
21251         return tag_ptr(ret_conv, true);
21252 }
21253 int64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(uint64_t arg) {
21254         LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(arg);
21255         int64_t ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
21256         return ret_conv;
21257 }
21258
21259 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone(uint64_t orig) {
21260         LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(orig);
21261         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
21262         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
21263         return tag_ptr(ret_conv, true);
21264 }
21265
21266 void  __attribute__((export_name("TS_CVec_NodeIdZ_free"))) TS_CVec_NodeIdZ_free(uint64_tArray _res) {
21267         LDKCVec_NodeIdZ _res_constr;
21268         _res_constr.datalen = _res->arr_len;
21269         if (_res_constr.datalen > 0)
21270                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
21271         else
21272                 _res_constr.data = NULL;
21273         uint64_t* _res_vals = _res->elems;
21274         for (size_t i = 0; i < _res_constr.datalen; i++) {
21275                 uint64_t _res_conv_8 = _res_vals[i];
21276                 LDKNodeId _res_conv_8_conv;
21277                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
21278                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
21279                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
21280                 _res_constr.data[i] = _res_conv_8_conv;
21281         }
21282         FREE(_res);
21283         CVec_NodeIdZ_free(_res_constr);
21284 }
21285
21286 static inline uint64_t C2Tuple_u64u64Z_clone_ptr(LDKC2Tuple_u64u64Z *NONNULL_PTR arg) {
21287         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
21288         *ret_conv = C2Tuple_u64u64Z_clone(arg);
21289         return tag_ptr(ret_conv, true);
21290 }
21291 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_clone_ptr"))) TS_C2Tuple_u64u64Z_clone_ptr(uint64_t arg) {
21292         LDKC2Tuple_u64u64Z* arg_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(arg);
21293         int64_t ret_conv = C2Tuple_u64u64Z_clone_ptr(arg_conv);
21294         return ret_conv;
21295 }
21296
21297 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_clone"))) TS_C2Tuple_u64u64Z_clone(uint64_t orig) {
21298         LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(orig);
21299         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
21300         *ret_conv = C2Tuple_u64u64Z_clone(orig_conv);
21301         return tag_ptr(ret_conv, true);
21302 }
21303
21304 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_new"))) TS_C2Tuple_u64u64Z_new(int64_t a, int64_t b) {
21305         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
21306         *ret_conv = C2Tuple_u64u64Z_new(a, b);
21307         return tag_ptr(ret_conv, true);
21308 }
21309
21310 void  __attribute__((export_name("TS_C2Tuple_u64u64Z_free"))) TS_C2Tuple_u64u64Z_free(uint64_t _res) {
21311         if (!ptr_is_owned(_res)) return;
21312         void* _res_ptr = untag_ptr(_res);
21313         CHECK_ACCESS(_res_ptr);
21314         LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(_res_ptr);
21315         FREE(untag_ptr(_res));
21316         C2Tuple_u64u64Z_free(_res_conv);
21317 }
21318
21319 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_some"))) TS_COption_C2Tuple_u64u64ZZ_some(uint64_t o) {
21320         void* o_ptr = untag_ptr(o);
21321         CHECK_ACCESS(o_ptr);
21322         LDKC2Tuple_u64u64Z o_conv = *(LDKC2Tuple_u64u64Z*)(o_ptr);
21323         o_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)untag_ptr(o));
21324         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
21325         *ret_copy = COption_C2Tuple_u64u64ZZ_some(o_conv);
21326         uint64_t ret_ref = tag_ptr(ret_copy, true);
21327         return ret_ref;
21328 }
21329
21330 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_none"))) TS_COption_C2Tuple_u64u64ZZ_none() {
21331         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
21332         *ret_copy = COption_C2Tuple_u64u64ZZ_none();
21333         uint64_t ret_ref = tag_ptr(ret_copy, true);
21334         return ret_ref;
21335 }
21336
21337 void  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_free"))) TS_COption_C2Tuple_u64u64ZZ_free(uint64_t _res) {
21338         if (!ptr_is_owned(_res)) return;
21339         void* _res_ptr = untag_ptr(_res);
21340         CHECK_ACCESS(_res_ptr);
21341         LDKCOption_C2Tuple_u64u64ZZ _res_conv = *(LDKCOption_C2Tuple_u64u64ZZ*)(_res_ptr);
21342         FREE(untag_ptr(_res));
21343         COption_C2Tuple_u64u64ZZ_free(_res_conv);
21344 }
21345
21346 static inline uint64_t COption_C2Tuple_u64u64ZZ_clone_ptr(LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR arg) {
21347         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
21348         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(arg);
21349         uint64_t ret_ref = tag_ptr(ret_copy, true);
21350         return ret_ref;
21351 }
21352 int64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_clone_ptr"))) TS_COption_C2Tuple_u64u64ZZ_clone_ptr(uint64_t arg) {
21353         LDKCOption_C2Tuple_u64u64ZZ* arg_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(arg);
21354         int64_t ret_conv = COption_C2Tuple_u64u64ZZ_clone_ptr(arg_conv);
21355         return ret_conv;
21356 }
21357
21358 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_clone"))) TS_COption_C2Tuple_u64u64ZZ_clone(uint64_t orig) {
21359         LDKCOption_C2Tuple_u64u64ZZ* orig_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(orig);
21360         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
21361         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(orig_conv);
21362         uint64_t ret_ref = tag_ptr(ret_copy, true);
21363         return ret_ref;
21364 }
21365
21366 uint64_t  __attribute__((export_name("TS_C2Tuple_Z_new"))) TS_C2Tuple_Z_new(int16_tArray a, int16_tArray b) {
21367         LDKThirtyTwoU16s a_ref;
21368         CHECK(a->arr_len == 32);
21369         memcpy(a_ref.data, a->elems, 32 * 2); FREE(a);
21370         LDKThirtyTwoU16s b_ref;
21371         CHECK(b->arr_len == 32);
21372         memcpy(b_ref.data, b->elems, 32 * 2); FREE(b);
21373         LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z");
21374         *ret_conv = C2Tuple_Z_new(a_ref, b_ref);
21375         return tag_ptr(ret_conv, true);
21376 }
21377
21378 void  __attribute__((export_name("TS_C2Tuple_Z_free"))) TS_C2Tuple_Z_free(uint64_t _res) {
21379         if (!ptr_is_owned(_res)) return;
21380         void* _res_ptr = untag_ptr(_res);
21381         CHECK_ACCESS(_res_ptr);
21382         LDKC2Tuple_Z _res_conv = *(LDKC2Tuple_Z*)(_res_ptr);
21383         FREE(untag_ptr(_res));
21384         C2Tuple_Z_free(_res_conv);
21385 }
21386
21387 uint64_t  __attribute__((export_name("TS_C2Tuple__u1632_u1632Z_new"))) TS_C2Tuple__u1632_u1632Z_new(int16_tArray a, int16_tArray b) {
21388         LDKThirtyTwoU16s a_ref;
21389         CHECK(a->arr_len == 32);
21390         memcpy(a_ref.data, a->elems, 32 * 2); FREE(a);
21391         LDKThirtyTwoU16s b_ref;
21392         CHECK(b->arr_len == 32);
21393         memcpy(b_ref.data, b->elems, 32 * 2); FREE(b);
21394         LDKC2Tuple__u1632_u1632Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u1632_u1632Z), "LDKC2Tuple__u1632_u1632Z");
21395         *ret_conv = C2Tuple__u1632_u1632Z_new(a_ref, b_ref);
21396         return tag_ptr(ret_conv, true);
21397 }
21398
21399 void  __attribute__((export_name("TS_C2Tuple__u1632_u1632Z_free"))) TS_C2Tuple__u1632_u1632Z_free(uint64_t _res) {
21400         if (!ptr_is_owned(_res)) return;
21401         void* _res_ptr = untag_ptr(_res);
21402         CHECK_ACCESS(_res_ptr);
21403         LDKC2Tuple__u1632_u1632Z _res_conv = *(LDKC2Tuple__u1632_u1632Z*)(_res_ptr);
21404         FREE(untag_ptr(_res));
21405         C2Tuple__u1632_u1632Z_free(_res_conv);
21406 }
21407
21408 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some"))) TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(uint64_t o) {
21409         void* o_ptr = untag_ptr(o);
21410         CHECK_ACCESS(o_ptr);
21411         LDKC2Tuple__u1632_u1632Z o_conv = *(LDKC2Tuple__u1632_u1632Z*)(o_ptr);
21412         // WARNING: we may need a move here but no clone is available for LDKC2Tuple__u1632_u1632Z
21413         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
21414         *ret_copy = COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(o_conv);
21415         uint64_t ret_ref = tag_ptr(ret_copy, true);
21416         return ret_ref;
21417 }
21418
21419 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none"))) TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none() {
21420         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
21421         *ret_copy = COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none();
21422         uint64_t ret_ref = tag_ptr(ret_copy, true);
21423         return ret_ref;
21424 }
21425
21426 void  __attribute__((export_name("TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free"))) TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(uint64_t _res) {
21427         if (!ptr_is_owned(_res)) return;
21428         void* _res_ptr = untag_ptr(_res);
21429         CHECK_ACCESS(_res_ptr);
21430         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ _res_conv = *(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)(_res_ptr);
21431         FREE(untag_ptr(_res));
21432         COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(_res_conv);
21433 }
21434
21435 uint64_t  __attribute__((export_name("TS_COption_f64Z_some"))) TS_COption_f64Z_some(double o) {
21436         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
21437         *ret_copy = COption_f64Z_some(o);
21438         uint64_t ret_ref = tag_ptr(ret_copy, true);
21439         return ret_ref;
21440 }
21441
21442 uint64_t  __attribute__((export_name("TS_COption_f64Z_none"))) TS_COption_f64Z_none() {
21443         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
21444         *ret_copy = COption_f64Z_none();
21445         uint64_t ret_ref = tag_ptr(ret_copy, true);
21446         return ret_ref;
21447 }
21448
21449 void  __attribute__((export_name("TS_COption_f64Z_free"))) TS_COption_f64Z_free(uint64_t _res) {
21450         if (!ptr_is_owned(_res)) return;
21451         void* _res_ptr = untag_ptr(_res);
21452         CHECK_ACCESS(_res_ptr);
21453         LDKCOption_f64Z _res_conv = *(LDKCOption_f64Z*)(_res_ptr);
21454         FREE(untag_ptr(_res));
21455         COption_f64Z_free(_res_conv);
21456 }
21457
21458 static inline uint64_t COption_f64Z_clone_ptr(LDKCOption_f64Z *NONNULL_PTR arg) {
21459         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
21460         *ret_copy = COption_f64Z_clone(arg);
21461         uint64_t ret_ref = tag_ptr(ret_copy, true);
21462         return ret_ref;
21463 }
21464 int64_t  __attribute__((export_name("TS_COption_f64Z_clone_ptr"))) TS_COption_f64Z_clone_ptr(uint64_t arg) {
21465         LDKCOption_f64Z* arg_conv = (LDKCOption_f64Z*)untag_ptr(arg);
21466         int64_t ret_conv = COption_f64Z_clone_ptr(arg_conv);
21467         return ret_conv;
21468 }
21469
21470 uint64_t  __attribute__((export_name("TS_COption_f64Z_clone"))) TS_COption_f64Z_clone(uint64_t orig) {
21471         LDKCOption_f64Z* orig_conv = (LDKCOption_f64Z*)untag_ptr(orig);
21472         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
21473         *ret_copy = COption_f64Z_clone(orig_conv);
21474         uint64_t ret_ref = tag_ptr(ret_copy, true);
21475         return ret_ref;
21476 }
21477
21478 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_ok(uint64_t o) {
21479         LDKProbabilisticScorer o_conv;
21480         o_conv.inner = untag_ptr(o);
21481         o_conv.is_owned = ptr_is_owned(o);
21482         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21483         // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
21484         
21485         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
21486         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
21487         return tag_ptr(ret_conv, true);
21488 }
21489
21490 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_err(uint64_t e) {
21491         void* e_ptr = untag_ptr(e);
21492         CHECK_ACCESS(e_ptr);
21493         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21494         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21495         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
21496         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
21497         return tag_ptr(ret_conv, true);
21498 }
21499
21500 jboolean  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok(uint64_t o) {
21501         LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(o);
21502         jboolean ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
21503         return ret_conv;
21504 }
21505
21506 void  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_free"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_free(uint64_t _res) {
21507         if (!ptr_is_owned(_res)) return;
21508         void* _res_ptr = untag_ptr(_res);
21509         CHECK_ACCESS(_res_ptr);
21510         LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
21511         FREE(untag_ptr(_res));
21512         CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
21513 }
21514
21515 uint64_t  __attribute__((export_name("TS_CResult_BestBlockDecodeErrorZ_ok"))) TS_CResult_BestBlockDecodeErrorZ_ok(uint64_t o) {
21516         LDKBestBlock o_conv;
21517         o_conv.inner = untag_ptr(o);
21518         o_conv.is_owned = ptr_is_owned(o);
21519         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21520         o_conv = BestBlock_clone(&o_conv);
21521         LDKCResult_BestBlockDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BestBlockDecodeErrorZ), "LDKCResult_BestBlockDecodeErrorZ");
21522         *ret_conv = CResult_BestBlockDecodeErrorZ_ok(o_conv);
21523         return tag_ptr(ret_conv, true);
21524 }
21525
21526 uint64_t  __attribute__((export_name("TS_CResult_BestBlockDecodeErrorZ_err"))) TS_CResult_BestBlockDecodeErrorZ_err(uint64_t e) {
21527         void* e_ptr = untag_ptr(e);
21528         CHECK_ACCESS(e_ptr);
21529         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21530         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21531         LDKCResult_BestBlockDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BestBlockDecodeErrorZ), "LDKCResult_BestBlockDecodeErrorZ");
21532         *ret_conv = CResult_BestBlockDecodeErrorZ_err(e_conv);
21533         return tag_ptr(ret_conv, true);
21534 }
21535
21536 jboolean  __attribute__((export_name("TS_CResult_BestBlockDecodeErrorZ_is_ok"))) TS_CResult_BestBlockDecodeErrorZ_is_ok(uint64_t o) {
21537         LDKCResult_BestBlockDecodeErrorZ* o_conv = (LDKCResult_BestBlockDecodeErrorZ*)untag_ptr(o);
21538         jboolean ret_conv = CResult_BestBlockDecodeErrorZ_is_ok(o_conv);
21539         return ret_conv;
21540 }
21541
21542 void  __attribute__((export_name("TS_CResult_BestBlockDecodeErrorZ_free"))) TS_CResult_BestBlockDecodeErrorZ_free(uint64_t _res) {
21543         if (!ptr_is_owned(_res)) return;
21544         void* _res_ptr = untag_ptr(_res);
21545         CHECK_ACCESS(_res_ptr);
21546         LDKCResult_BestBlockDecodeErrorZ _res_conv = *(LDKCResult_BestBlockDecodeErrorZ*)(_res_ptr);
21547         FREE(untag_ptr(_res));
21548         CResult_BestBlockDecodeErrorZ_free(_res_conv);
21549 }
21550
21551 static inline uint64_t CResult_BestBlockDecodeErrorZ_clone_ptr(LDKCResult_BestBlockDecodeErrorZ *NONNULL_PTR arg) {
21552         LDKCResult_BestBlockDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BestBlockDecodeErrorZ), "LDKCResult_BestBlockDecodeErrorZ");
21553         *ret_conv = CResult_BestBlockDecodeErrorZ_clone(arg);
21554         return tag_ptr(ret_conv, true);
21555 }
21556 int64_t  __attribute__((export_name("TS_CResult_BestBlockDecodeErrorZ_clone_ptr"))) TS_CResult_BestBlockDecodeErrorZ_clone_ptr(uint64_t arg) {
21557         LDKCResult_BestBlockDecodeErrorZ* arg_conv = (LDKCResult_BestBlockDecodeErrorZ*)untag_ptr(arg);
21558         int64_t ret_conv = CResult_BestBlockDecodeErrorZ_clone_ptr(arg_conv);
21559         return ret_conv;
21560 }
21561
21562 uint64_t  __attribute__((export_name("TS_CResult_BestBlockDecodeErrorZ_clone"))) TS_CResult_BestBlockDecodeErrorZ_clone(uint64_t orig) {
21563         LDKCResult_BestBlockDecodeErrorZ* orig_conv = (LDKCResult_BestBlockDecodeErrorZ*)untag_ptr(orig);
21564         LDKCResult_BestBlockDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BestBlockDecodeErrorZ), "LDKCResult_BestBlockDecodeErrorZ");
21565         *ret_conv = CResult_BestBlockDecodeErrorZ_clone(orig_conv);
21566         return tag_ptr(ret_conv, true);
21567 }
21568
21569 static inline uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
21570         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
21571         *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
21572         return tag_ptr(ret_conv, true);
21573 }
21574 int64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone_ptr"))) TS_C2Tuple_usizeTransactionZ_clone_ptr(uint64_t arg) {
21575         LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(arg);
21576         int64_t ret_conv = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
21577         return ret_conv;
21578 }
21579
21580 uint64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone"))) TS_C2Tuple_usizeTransactionZ_clone(uint64_t orig) {
21581         LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(orig);
21582         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
21583         *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
21584         return tag_ptr(ret_conv, true);
21585 }
21586
21587 uint64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_new"))) TS_C2Tuple_usizeTransactionZ_new(uint32_t a, int8_tArray b) {
21588         LDKTransaction b_ref;
21589         b_ref.datalen = b->arr_len;
21590         b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
21591         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
21592         b_ref.data_is_owned = true;
21593         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
21594         *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
21595         return tag_ptr(ret_conv, true);
21596 }
21597
21598 void  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_free"))) TS_C2Tuple_usizeTransactionZ_free(uint64_t _res) {
21599         if (!ptr_is_owned(_res)) return;
21600         void* _res_ptr = untag_ptr(_res);
21601         CHECK_ACCESS(_res_ptr);
21602         LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
21603         FREE(untag_ptr(_res));
21604         C2Tuple_usizeTransactionZ_free(_res_conv);
21605 }
21606
21607 void  __attribute__((export_name("TS_CVec_C2Tuple_usizeTransactionZZ_free"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint64_tArray _res) {
21608         LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
21609         _res_constr.datalen = _res->arr_len;
21610         if (_res_constr.datalen > 0)
21611                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
21612         else
21613                 _res_constr.data = NULL;
21614         uint64_t* _res_vals = _res->elems;
21615         for (size_t c = 0; c < _res_constr.datalen; c++) {
21616                 uint64_t _res_conv_28 = _res_vals[c];
21617                 void* _res_conv_28_ptr = untag_ptr(_res_conv_28);
21618                 CHECK_ACCESS(_res_conv_28_ptr);
21619                 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
21620                 FREE(untag_ptr(_res_conv_28));
21621                 _res_constr.data[c] = _res_conv_28_conv;
21622         }
21623         FREE(_res);
21624         CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
21625 }
21626
21627 static inline uint64_t C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone_ptr(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR arg) {
21628         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
21629         *ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(arg);
21630         return tag_ptr(ret_conv, true);
21631 }
21632 int64_t  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone_ptr"))) TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone_ptr(uint64_t arg) {
21633         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* arg_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(arg);
21634         int64_t ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone_ptr(arg_conv);
21635         return ret_conv;
21636 }
21637
21638 uint64_t  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone"))) TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(uint64_t orig) {
21639         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* orig_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(orig);
21640         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
21641         *ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(orig_conv);
21642         return tag_ptr(ret_conv, true);
21643 }
21644
21645 uint64_t  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_new"))) TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_new(int8_tArray a, int32_t b, uint64_t c) {
21646         LDKThirtyTwoBytes a_ref;
21647         CHECK(a->arr_len == 32);
21648         memcpy(a_ref.data, a->elems, 32); FREE(a);
21649         void* c_ptr = untag_ptr(c);
21650         CHECK_ACCESS(c_ptr);
21651         LDKCOption_ThirtyTwoBytesZ c_conv = *(LDKCOption_ThirtyTwoBytesZ*)(c_ptr);
21652         c_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(c));
21653         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
21654         *ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_new(a_ref, b, c_conv);
21655         return tag_ptr(ret_conv, true);
21656 }
21657
21658 void  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_free"))) TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_free(uint64_t _res) {
21659         if (!ptr_is_owned(_res)) return;
21660         void* _res_ptr = untag_ptr(_res);
21661         CHECK_ACCESS(_res_ptr);
21662         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ _res_conv = *(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)(_res_ptr);
21663         FREE(untag_ptr(_res));
21664         C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_free(_res_conv);
21665 }
21666
21667 void  __attribute__((export_name("TS_CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_free"))) TS_CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_free(uint64_tArray _res) {
21668         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ _res_constr;
21669         _res_constr.datalen = _res->arr_len;
21670         if (_res_constr.datalen > 0)
21671                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ Elements");
21672         else
21673                 _res_constr.data = NULL;
21674         uint64_t* _res_vals = _res->elems;
21675         for (size_t c = 0; c < _res_constr.datalen; c++) {
21676                 uint64_t _res_conv_54 = _res_vals[c];
21677                 void* _res_conv_54_ptr = untag_ptr(_res_conv_54);
21678                 CHECK_ACCESS(_res_conv_54_ptr);
21679                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ _res_conv_54_conv = *(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)(_res_conv_54_ptr);
21680                 FREE(untag_ptr(_res_conv_54));
21681                 _res_constr.data[c] = _res_conv_54_conv;
21682         }
21683         FREE(_res);
21684         CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_free(_res_constr);
21685 }
21686
21687 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_ok"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_ok(uint32_t o) {
21688         LDKChannelMonitorUpdateStatus o_conv = LDKChannelMonitorUpdateStatus_from_js(o);
21689         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
21690         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_ok(o_conv);
21691         return tag_ptr(ret_conv, true);
21692 }
21693
21694 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_err"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_err() {
21695         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
21696         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_err();
21697         return tag_ptr(ret_conv, true);
21698 }
21699
21700 jboolean  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_is_ok"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(uint64_t o) {
21701         LDKCResult_ChannelMonitorUpdateStatusNoneZ* o_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(o);
21702         jboolean ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(o_conv);
21703         return ret_conv;
21704 }
21705
21706 void  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_free"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_free(uint64_t _res) {
21707         if (!ptr_is_owned(_res)) return;
21708         void* _res_ptr = untag_ptr(_res);
21709         CHECK_ACCESS(_res_ptr);
21710         LDKCResult_ChannelMonitorUpdateStatusNoneZ _res_conv = *(LDKCResult_ChannelMonitorUpdateStatusNoneZ*)(_res_ptr);
21711         FREE(untag_ptr(_res));
21712         CResult_ChannelMonitorUpdateStatusNoneZ_free(_res_conv);
21713 }
21714
21715 static inline uint64_t CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR arg) {
21716         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
21717         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone(arg);
21718         return tag_ptr(ret_conv, true);
21719 }
21720 int64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(uint64_t arg) {
21721         LDKCResult_ChannelMonitorUpdateStatusNoneZ* arg_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(arg);
21722         int64_t ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(arg_conv);
21723         return ret_conv;
21724 }
21725
21726 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_clone"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_clone(uint64_t orig) {
21727         LDKCResult_ChannelMonitorUpdateStatusNoneZ* orig_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(orig);
21728         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
21729         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone(orig_conv);
21730         return tag_ptr(ret_conv, true);
21731 }
21732
21733 void  __attribute__((export_name("TS_CVec_MonitorEventZ_free"))) TS_CVec_MonitorEventZ_free(uint64_tArray _res) {
21734         LDKCVec_MonitorEventZ _res_constr;
21735         _res_constr.datalen = _res->arr_len;
21736         if (_res_constr.datalen > 0)
21737                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
21738         else
21739                 _res_constr.data = NULL;
21740         uint64_t* _res_vals = _res->elems;
21741         for (size_t o = 0; o < _res_constr.datalen; o++) {
21742                 uint64_t _res_conv_14 = _res_vals[o];
21743                 void* _res_conv_14_ptr = untag_ptr(_res_conv_14);
21744                 CHECK_ACCESS(_res_conv_14_ptr);
21745                 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
21746                 FREE(untag_ptr(_res_conv_14));
21747                 _res_constr.data[o] = _res_conv_14_conv;
21748         }
21749         FREE(_res);
21750         CVec_MonitorEventZ_free(_res_constr);
21751 }
21752
21753 static inline uint64_t C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone_ptr(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ *NONNULL_PTR arg) {
21754         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ), "LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ");
21755         *ret_conv = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone(arg);
21756         return tag_ptr(ret_conv, true);
21757 }
21758 int64_t  __attribute__((export_name("TS_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone_ptr"))) TS_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone_ptr(uint64_t arg) {
21759         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* arg_conv = (LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)untag_ptr(arg);
21760         int64_t ret_conv = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone_ptr(arg_conv);
21761         return ret_conv;
21762 }
21763
21764 uint64_t  __attribute__((export_name("TS_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone"))) TS_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone(uint64_t orig) {
21765         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* orig_conv = (LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)untag_ptr(orig);
21766         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ), "LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ");
21767         *ret_conv = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone(orig_conv);
21768         return tag_ptr(ret_conv, true);
21769 }
21770
21771 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) {
21772         LDKOutPoint a_conv;
21773         a_conv.inner = untag_ptr(a);
21774         a_conv.is_owned = ptr_is_owned(a);
21775         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
21776         a_conv = OutPoint_clone(&a_conv);
21777         LDKChannelId b_conv;
21778         b_conv.inner = untag_ptr(b);
21779         b_conv.is_owned = ptr_is_owned(b);
21780         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
21781         b_conv = ChannelId_clone(&b_conv);
21782         LDKCVec_MonitorEventZ c_constr;
21783         c_constr.datalen = c->arr_len;
21784         if (c_constr.datalen > 0)
21785                 c_constr.data = MALLOC(c_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
21786         else
21787                 c_constr.data = NULL;
21788         uint64_t* c_vals = c->elems;
21789         for (size_t o = 0; o < c_constr.datalen; o++) {
21790                 uint64_t c_conv_14 = c_vals[o];
21791                 void* c_conv_14_ptr = untag_ptr(c_conv_14);
21792                 CHECK_ACCESS(c_conv_14_ptr);
21793                 LDKMonitorEvent c_conv_14_conv = *(LDKMonitorEvent*)(c_conv_14_ptr);
21794                 c_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(c_conv_14));
21795                 c_constr.data[o] = c_conv_14_conv;
21796         }
21797         FREE(c);
21798         LDKPublicKey d_ref;
21799         CHECK(d->arr_len == 33);
21800         memcpy(d_ref.compressed_form, d->elems, 33); FREE(d);
21801         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ), "LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ");
21802         *ret_conv = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_new(a_conv, b_conv, c_constr, d_ref);
21803         return tag_ptr(ret_conv, true);
21804 }
21805
21806 void  __attribute__((export_name("TS_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_free"))) TS_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_free(uint64_t _res) {
21807         if (!ptr_is_owned(_res)) return;
21808         void* _res_ptr = untag_ptr(_res);
21809         CHECK_ACCESS(_res_ptr);
21810         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ _res_conv = *(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)(_res_ptr);
21811         FREE(untag_ptr(_res));
21812         C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_free(_res_conv);
21813 }
21814
21815 void  __attribute__((export_name("TS_CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ_free"))) TS_CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ_free(uint64_tArray _res) {
21816         LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ _res_constr;
21817         _res_constr.datalen = _res->arr_len;
21818         if (_res_constr.datalen > 0)
21819                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ), "LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ Elements");
21820         else
21821                 _res_constr.data = NULL;
21822         uint64_t* _res_vals = _res->elems;
21823         for (size_t f = 0; f < _res_constr.datalen; f++) {
21824                 uint64_t _res_conv_57 = _res_vals[f];
21825                 void* _res_conv_57_ptr = untag_ptr(_res_conv_57);
21826                 CHECK_ACCESS(_res_conv_57_ptr);
21827                 LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ _res_conv_57_conv = *(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)(_res_conv_57_ptr);
21828                 FREE(untag_ptr(_res_conv_57));
21829                 _res_constr.data[f] = _res_conv_57_conv;
21830         }
21831         FREE(_res);
21832         CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ_free(_res_constr);
21833 }
21834
21835 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint64_t o) {
21836         LDKInitFeatures o_conv;
21837         o_conv.inner = untag_ptr(o);
21838         o_conv.is_owned = ptr_is_owned(o);
21839         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21840         o_conv = InitFeatures_clone(&o_conv);
21841         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
21842         *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
21843         return tag_ptr(ret_conv, true);
21844 }
21845
21846 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_err"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint64_t e) {
21847         void* e_ptr = untag_ptr(e);
21848         CHECK_ACCESS(e_ptr);
21849         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21850         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21851         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
21852         *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
21853         return tag_ptr(ret_conv, true);
21854 }
21855
21856 jboolean  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_is_ok(uint64_t o) {
21857         LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(o);
21858         jboolean ret_conv = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
21859         return ret_conv;
21860 }
21861
21862 void  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_free"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint64_t _res) {
21863         if (!ptr_is_owned(_res)) return;
21864         void* _res_ptr = untag_ptr(_res);
21865         CHECK_ACCESS(_res_ptr);
21866         LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
21867         FREE(untag_ptr(_res));
21868         CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
21869 }
21870
21871 static inline uint64_t CResult_InitFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR arg) {
21872         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
21873         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(arg);
21874         return tag_ptr(ret_conv, true);
21875 }
21876 int64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
21877         LDKCResult_InitFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(arg);
21878         int64_t ret_conv = CResult_InitFeaturesDecodeErrorZ_clone_ptr(arg_conv);
21879         return ret_conv;
21880 }
21881
21882 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone"))) TS_CResult_InitFeaturesDecodeErrorZ_clone(uint64_t orig) {
21883         LDKCResult_InitFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(orig);
21884         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
21885         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(orig_conv);
21886         return tag_ptr(ret_conv, true);
21887 }
21888
21889 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint64_t o) {
21890         LDKChannelFeatures o_conv;
21891         o_conv.inner = untag_ptr(o);
21892         o_conv.is_owned = ptr_is_owned(o);
21893         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21894         o_conv = ChannelFeatures_clone(&o_conv);
21895         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
21896         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
21897         return tag_ptr(ret_conv, true);
21898 }
21899
21900 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_err(uint64_t e) {
21901         void* e_ptr = untag_ptr(e);
21902         CHECK_ACCESS(e_ptr);
21903         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21904         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21905         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
21906         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
21907         return tag_ptr(ret_conv, true);
21908 }
21909
21910 jboolean  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok(uint64_t o) {
21911         LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(o);
21912         jboolean ret_conv = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
21913         return ret_conv;
21914 }
21915
21916 void  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelFeaturesDecodeErrorZ_free(uint64_t _res) {
21917         if (!ptr_is_owned(_res)) return;
21918         void* _res_ptr = untag_ptr(_res);
21919         CHECK_ACCESS(_res_ptr);
21920         LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
21921         FREE(untag_ptr(_res));
21922         CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
21923 }
21924
21925 static inline uint64_t CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR arg) {
21926         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
21927         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(arg);
21928         return tag_ptr(ret_conv, true);
21929 }
21930 int64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
21931         LDKCResult_ChannelFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(arg);
21932         int64_t ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(arg_conv);
21933         return ret_conv;
21934 }
21935
21936 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone(uint64_t orig) {
21937         LDKCResult_ChannelFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(orig);
21938         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
21939         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(orig_conv);
21940         return tag_ptr(ret_conv, true);
21941 }
21942
21943 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint64_t o) {
21944         LDKNodeFeatures o_conv;
21945         o_conv.inner = untag_ptr(o);
21946         o_conv.is_owned = ptr_is_owned(o);
21947         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21948         o_conv = NodeFeatures_clone(&o_conv);
21949         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
21950         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
21951         return tag_ptr(ret_conv, true);
21952 }
21953
21954 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint64_t e) {
21955         void* e_ptr = untag_ptr(e);
21956         CHECK_ACCESS(e_ptr);
21957         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21958         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21959         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
21960         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
21961         return tag_ptr(ret_conv, true);
21962 }
21963
21964 jboolean  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_is_ok(uint64_t o) {
21965         LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(o);
21966         jboolean ret_conv = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
21967         return ret_conv;
21968 }
21969
21970 void  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_free"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint64_t _res) {
21971         if (!ptr_is_owned(_res)) return;
21972         void* _res_ptr = untag_ptr(_res);
21973         CHECK_ACCESS(_res_ptr);
21974         LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
21975         FREE(untag_ptr(_res));
21976         CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
21977 }
21978
21979 static inline uint64_t CResult_NodeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
21980         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
21981         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(arg);
21982         return tag_ptr(ret_conv, true);
21983 }
21984 int64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
21985         LDKCResult_NodeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(arg);
21986         int64_t ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
21987         return ret_conv;
21988 }
21989
21990 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone(uint64_t orig) {
21991         LDKCResult_NodeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(orig);
21992         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
21993         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(orig_conv);
21994         return tag_ptr(ret_conv, true);
21995 }
21996
21997 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(uint64_t o) {
21998         LDKBolt11InvoiceFeatures o_conv;
21999         o_conv.inner = untag_ptr(o);
22000         o_conv.is_owned = ptr_is_owned(o);
22001         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22002         o_conv = Bolt11InvoiceFeatures_clone(&o_conv);
22003         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
22004         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(o_conv);
22005         return tag_ptr(ret_conv, true);
22006 }
22007
22008 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(uint64_t e) {
22009         void* e_ptr = untag_ptr(e);
22010         CHECK_ACCESS(e_ptr);
22011         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22012         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22013         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
22014         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(e_conv);
22015         return tag_ptr(ret_conv, true);
22016 }
22017
22018 jboolean  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(uint64_t o) {
22019         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
22020         jboolean ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
22021         return ret_conv;
22022 }
22023
22024 void  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(uint64_t _res) {
22025         if (!ptr_is_owned(_res)) return;
22026         void* _res_ptr = untag_ptr(_res);
22027         CHECK_ACCESS(_res_ptr);
22028         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
22029         FREE(untag_ptr(_res));
22030         CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(_res_conv);
22031 }
22032
22033 static inline uint64_t CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
22034         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
22035         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(arg);
22036         return tag_ptr(ret_conv, true);
22037 }
22038 int64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
22039         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
22040         int64_t ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
22041         return ret_conv;
22042 }
22043
22044 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(uint64_t orig) {
22045         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
22046         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
22047         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
22048         return tag_ptr(ret_conv, true);
22049 }
22050
22051 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(uint64_t o) {
22052         LDKBolt12InvoiceFeatures o_conv;
22053         o_conv.inner = untag_ptr(o);
22054         o_conv.is_owned = ptr_is_owned(o);
22055         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22056         o_conv = Bolt12InvoiceFeatures_clone(&o_conv);
22057         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
22058         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(o_conv);
22059         return tag_ptr(ret_conv, true);
22060 }
22061
22062 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(uint64_t e) {
22063         void* e_ptr = untag_ptr(e);
22064         CHECK_ACCESS(e_ptr);
22065         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22066         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22067         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
22068         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(e_conv);
22069         return tag_ptr(ret_conv, true);
22070 }
22071
22072 jboolean  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(uint64_t o) {
22073         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
22074         jboolean ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
22075         return ret_conv;
22076 }
22077
22078 void  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(uint64_t _res) {
22079         if (!ptr_is_owned(_res)) return;
22080         void* _res_ptr = untag_ptr(_res);
22081         CHECK_ACCESS(_res_ptr);
22082         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
22083         FREE(untag_ptr(_res));
22084         CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(_res_conv);
22085 }
22086
22087 static inline uint64_t CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
22088         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
22089         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(arg);
22090         return tag_ptr(ret_conv, true);
22091 }
22092 int64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
22093         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
22094         int64_t ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
22095         return ret_conv;
22096 }
22097
22098 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(uint64_t orig) {
22099         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
22100         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
22101         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
22102         return tag_ptr(ret_conv, true);
22103 }
22104
22105 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_ok"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_ok(uint64_t o) {
22106         LDKBlindedHopFeatures o_conv;
22107         o_conv.inner = untag_ptr(o);
22108         o_conv.is_owned = ptr_is_owned(o);
22109         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22110         o_conv = BlindedHopFeatures_clone(&o_conv);
22111         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
22112         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_ok(o_conv);
22113         return tag_ptr(ret_conv, true);
22114 }
22115
22116 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_err"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_err(uint64_t e) {
22117         void* e_ptr = untag_ptr(e);
22118         CHECK_ACCESS(e_ptr);
22119         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22120         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22121         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
22122         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_err(e_conv);
22123         return tag_ptr(ret_conv, true);
22124 }
22125
22126 jboolean  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_is_ok"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(uint64_t o) {
22127         LDKCResult_BlindedHopFeaturesDecodeErrorZ* o_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(o);
22128         jboolean ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o_conv);
22129         return ret_conv;
22130 }
22131
22132 void  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_free"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_free(uint64_t _res) {
22133         if (!ptr_is_owned(_res)) return;
22134         void* _res_ptr = untag_ptr(_res);
22135         CHECK_ACCESS(_res_ptr);
22136         LDKCResult_BlindedHopFeaturesDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopFeaturesDecodeErrorZ*)(_res_ptr);
22137         FREE(untag_ptr(_res));
22138         CResult_BlindedHopFeaturesDecodeErrorZ_free(_res_conv);
22139 }
22140
22141 static inline uint64_t CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR arg) {
22142         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
22143         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(arg);
22144         return tag_ptr(ret_conv, true);
22145 }
22146 int64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
22147         LDKCResult_BlindedHopFeaturesDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(arg);
22148         int64_t ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(arg_conv);
22149         return ret_conv;
22150 }
22151
22152 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone(uint64_t orig) {
22153         LDKCResult_BlindedHopFeaturesDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(orig);
22154         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
22155         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig_conv);
22156         return tag_ptr(ret_conv, true);
22157 }
22158
22159 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok(uint64_t o) {
22160         LDKChannelTypeFeatures o_conv;
22161         o_conv.inner = untag_ptr(o);
22162         o_conv.is_owned = ptr_is_owned(o);
22163         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22164         o_conv = ChannelTypeFeatures_clone(&o_conv);
22165         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
22166         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
22167         return tag_ptr(ret_conv, true);
22168 }
22169
22170 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err(uint64_t e) {
22171         void* e_ptr = untag_ptr(e);
22172         CHECK_ACCESS(e_ptr);
22173         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22174         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22175         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
22176         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
22177         return tag_ptr(ret_conv, true);
22178 }
22179
22180 jboolean  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(uint64_t o) {
22181         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(o);
22182         jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
22183         return ret_conv;
22184 }
22185
22186 void  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free(uint64_t _res) {
22187         if (!ptr_is_owned(_res)) return;
22188         void* _res_ptr = untag_ptr(_res);
22189         CHECK_ACCESS(_res_ptr);
22190         LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
22191         FREE(untag_ptr(_res));
22192         CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
22193 }
22194
22195 static inline uint64_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
22196         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
22197         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(arg);
22198         return tag_ptr(ret_conv, true);
22199 }
22200 int64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
22201         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(arg);
22202         int64_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
22203         return ret_conv;
22204 }
22205
22206 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone(uint64_t orig) {
22207         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(orig);
22208         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
22209         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv);
22210         return tag_ptr(ret_conv, true);
22211 }
22212
22213 uint64_t  __attribute__((export_name("TS_CResult_OfferIdDecodeErrorZ_ok"))) TS_CResult_OfferIdDecodeErrorZ_ok(uint64_t o) {
22214         LDKOfferId o_conv;
22215         o_conv.inner = untag_ptr(o);
22216         o_conv.is_owned = ptr_is_owned(o);
22217         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22218         o_conv = OfferId_clone(&o_conv);
22219         LDKCResult_OfferIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferIdDecodeErrorZ), "LDKCResult_OfferIdDecodeErrorZ");
22220         *ret_conv = CResult_OfferIdDecodeErrorZ_ok(o_conv);
22221         return tag_ptr(ret_conv, true);
22222 }
22223
22224 uint64_t  __attribute__((export_name("TS_CResult_OfferIdDecodeErrorZ_err"))) TS_CResult_OfferIdDecodeErrorZ_err(uint64_t e) {
22225         void* e_ptr = untag_ptr(e);
22226         CHECK_ACCESS(e_ptr);
22227         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22228         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22229         LDKCResult_OfferIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferIdDecodeErrorZ), "LDKCResult_OfferIdDecodeErrorZ");
22230         *ret_conv = CResult_OfferIdDecodeErrorZ_err(e_conv);
22231         return tag_ptr(ret_conv, true);
22232 }
22233
22234 jboolean  __attribute__((export_name("TS_CResult_OfferIdDecodeErrorZ_is_ok"))) TS_CResult_OfferIdDecodeErrorZ_is_ok(uint64_t o) {
22235         LDKCResult_OfferIdDecodeErrorZ* o_conv = (LDKCResult_OfferIdDecodeErrorZ*)untag_ptr(o);
22236         jboolean ret_conv = CResult_OfferIdDecodeErrorZ_is_ok(o_conv);
22237         return ret_conv;
22238 }
22239
22240 void  __attribute__((export_name("TS_CResult_OfferIdDecodeErrorZ_free"))) TS_CResult_OfferIdDecodeErrorZ_free(uint64_t _res) {
22241         if (!ptr_is_owned(_res)) return;
22242         void* _res_ptr = untag_ptr(_res);
22243         CHECK_ACCESS(_res_ptr);
22244         LDKCResult_OfferIdDecodeErrorZ _res_conv = *(LDKCResult_OfferIdDecodeErrorZ*)(_res_ptr);
22245         FREE(untag_ptr(_res));
22246         CResult_OfferIdDecodeErrorZ_free(_res_conv);
22247 }
22248
22249 static inline uint64_t CResult_OfferIdDecodeErrorZ_clone_ptr(LDKCResult_OfferIdDecodeErrorZ *NONNULL_PTR arg) {
22250         LDKCResult_OfferIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferIdDecodeErrorZ), "LDKCResult_OfferIdDecodeErrorZ");
22251         *ret_conv = CResult_OfferIdDecodeErrorZ_clone(arg);
22252         return tag_ptr(ret_conv, true);
22253 }
22254 int64_t  __attribute__((export_name("TS_CResult_OfferIdDecodeErrorZ_clone_ptr"))) TS_CResult_OfferIdDecodeErrorZ_clone_ptr(uint64_t arg) {
22255         LDKCResult_OfferIdDecodeErrorZ* arg_conv = (LDKCResult_OfferIdDecodeErrorZ*)untag_ptr(arg);
22256         int64_t ret_conv = CResult_OfferIdDecodeErrorZ_clone_ptr(arg_conv);
22257         return ret_conv;
22258 }
22259
22260 uint64_t  __attribute__((export_name("TS_CResult_OfferIdDecodeErrorZ_clone"))) TS_CResult_OfferIdDecodeErrorZ_clone(uint64_t orig) {
22261         LDKCResult_OfferIdDecodeErrorZ* orig_conv = (LDKCResult_OfferIdDecodeErrorZ*)untag_ptr(orig);
22262         LDKCResult_OfferIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferIdDecodeErrorZ), "LDKCResult_OfferIdDecodeErrorZ");
22263         *ret_conv = CResult_OfferIdDecodeErrorZ_clone(orig_conv);
22264         return tag_ptr(ret_conv, true);
22265 }
22266
22267 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_ok"))) TS_CResult_NoneBolt12SemanticErrorZ_ok() {
22268         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
22269         *ret_conv = CResult_NoneBolt12SemanticErrorZ_ok();
22270         return tag_ptr(ret_conv, true);
22271 }
22272
22273 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_err"))) TS_CResult_NoneBolt12SemanticErrorZ_err(uint32_t e) {
22274         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_js(e);
22275         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
22276         *ret_conv = CResult_NoneBolt12SemanticErrorZ_err(e_conv);
22277         return tag_ptr(ret_conv, true);
22278 }
22279
22280 jboolean  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_is_ok"))) TS_CResult_NoneBolt12SemanticErrorZ_is_ok(uint64_t o) {
22281         LDKCResult_NoneBolt12SemanticErrorZ* o_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(o);
22282         jboolean ret_conv = CResult_NoneBolt12SemanticErrorZ_is_ok(o_conv);
22283         return ret_conv;
22284 }
22285
22286 void  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_free"))) TS_CResult_NoneBolt12SemanticErrorZ_free(uint64_t _res) {
22287         if (!ptr_is_owned(_res)) return;
22288         void* _res_ptr = untag_ptr(_res);
22289         CHECK_ACCESS(_res_ptr);
22290         LDKCResult_NoneBolt12SemanticErrorZ _res_conv = *(LDKCResult_NoneBolt12SemanticErrorZ*)(_res_ptr);
22291         FREE(untag_ptr(_res));
22292         CResult_NoneBolt12SemanticErrorZ_free(_res_conv);
22293 }
22294
22295 static inline uint64_t CResult_NoneBolt12SemanticErrorZ_clone_ptr(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR arg) {
22296         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
22297         *ret_conv = CResult_NoneBolt12SemanticErrorZ_clone(arg);
22298         return tag_ptr(ret_conv, true);
22299 }
22300 int64_t  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_clone_ptr"))) TS_CResult_NoneBolt12SemanticErrorZ_clone_ptr(uint64_t arg) {
22301         LDKCResult_NoneBolt12SemanticErrorZ* arg_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(arg);
22302         int64_t ret_conv = CResult_NoneBolt12SemanticErrorZ_clone_ptr(arg_conv);
22303         return ret_conv;
22304 }
22305
22306 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_clone"))) TS_CResult_NoneBolt12SemanticErrorZ_clone(uint64_t orig) {
22307         LDKCResult_NoneBolt12SemanticErrorZ* orig_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(orig);
22308         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
22309         *ret_conv = CResult_NoneBolt12SemanticErrorZ_clone(orig_conv);
22310         return tag_ptr(ret_conv, true);
22311 }
22312
22313 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12SemanticErrorZ_ok"))) TS_CResult_OfferBolt12SemanticErrorZ_ok(uint64_t o) {
22314         LDKOffer o_conv;
22315         o_conv.inner = untag_ptr(o);
22316         o_conv.is_owned = ptr_is_owned(o);
22317         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22318         o_conv = Offer_clone(&o_conv);
22319         LDKCResult_OfferBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12SemanticErrorZ), "LDKCResult_OfferBolt12SemanticErrorZ");
22320         *ret_conv = CResult_OfferBolt12SemanticErrorZ_ok(o_conv);
22321         return tag_ptr(ret_conv, true);
22322 }
22323
22324 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12SemanticErrorZ_err"))) TS_CResult_OfferBolt12SemanticErrorZ_err(uint32_t e) {
22325         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_js(e);
22326         LDKCResult_OfferBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12SemanticErrorZ), "LDKCResult_OfferBolt12SemanticErrorZ");
22327         *ret_conv = CResult_OfferBolt12SemanticErrorZ_err(e_conv);
22328         return tag_ptr(ret_conv, true);
22329 }
22330
22331 jboolean  __attribute__((export_name("TS_CResult_OfferBolt12SemanticErrorZ_is_ok"))) TS_CResult_OfferBolt12SemanticErrorZ_is_ok(uint64_t o) {
22332         LDKCResult_OfferBolt12SemanticErrorZ* o_conv = (LDKCResult_OfferBolt12SemanticErrorZ*)untag_ptr(o);
22333         jboolean ret_conv = CResult_OfferBolt12SemanticErrorZ_is_ok(o_conv);
22334         return ret_conv;
22335 }
22336
22337 void  __attribute__((export_name("TS_CResult_OfferBolt12SemanticErrorZ_free"))) TS_CResult_OfferBolt12SemanticErrorZ_free(uint64_t _res) {
22338         if (!ptr_is_owned(_res)) return;
22339         void* _res_ptr = untag_ptr(_res);
22340         CHECK_ACCESS(_res_ptr);
22341         LDKCResult_OfferBolt12SemanticErrorZ _res_conv = *(LDKCResult_OfferBolt12SemanticErrorZ*)(_res_ptr);
22342         FREE(untag_ptr(_res));
22343         CResult_OfferBolt12SemanticErrorZ_free(_res_conv);
22344 }
22345
22346 static inline uint64_t CResult_OfferBolt12SemanticErrorZ_clone_ptr(LDKCResult_OfferBolt12SemanticErrorZ *NONNULL_PTR arg) {
22347         LDKCResult_OfferBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12SemanticErrorZ), "LDKCResult_OfferBolt12SemanticErrorZ");
22348         *ret_conv = CResult_OfferBolt12SemanticErrorZ_clone(arg);
22349         return tag_ptr(ret_conv, true);
22350 }
22351 int64_t  __attribute__((export_name("TS_CResult_OfferBolt12SemanticErrorZ_clone_ptr"))) TS_CResult_OfferBolt12SemanticErrorZ_clone_ptr(uint64_t arg) {
22352         LDKCResult_OfferBolt12SemanticErrorZ* arg_conv = (LDKCResult_OfferBolt12SemanticErrorZ*)untag_ptr(arg);
22353         int64_t ret_conv = CResult_OfferBolt12SemanticErrorZ_clone_ptr(arg_conv);
22354         return ret_conv;
22355 }
22356
22357 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12SemanticErrorZ_clone"))) TS_CResult_OfferBolt12SemanticErrorZ_clone(uint64_t orig) {
22358         LDKCResult_OfferBolt12SemanticErrorZ* orig_conv = (LDKCResult_OfferBolt12SemanticErrorZ*)untag_ptr(orig);
22359         LDKCResult_OfferBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12SemanticErrorZ), "LDKCResult_OfferBolt12SemanticErrorZ");
22360         *ret_conv = CResult_OfferBolt12SemanticErrorZ_clone(orig_conv);
22361         return tag_ptr(ret_conv, true);
22362 }
22363
22364 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_ok"))) TS_CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_ok(uint64_t o) {
22365         LDKInvoiceRequestWithDerivedPayerIdBuilder o_conv;
22366         o_conv.inner = untag_ptr(o);
22367         o_conv.is_owned = ptr_is_owned(o);
22368         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22369         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithDerivedPayerIdBuilder
22370         
22371         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ");
22372         *ret_conv = CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_ok(o_conv);
22373         return tag_ptr(ret_conv, true);
22374 }
22375
22376 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_err"))) TS_CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_err(uint32_t e) {
22377         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_js(e);
22378         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ");
22379         *ret_conv = CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_err(e_conv);
22380         return tag_ptr(ret_conv, true);
22381 }
22382
22383 jboolean  __attribute__((export_name("TS_CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_is_ok"))) TS_CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_is_ok(uint64_t o) {
22384         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ* o_conv = (LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ*)untag_ptr(o);
22385         jboolean ret_conv = CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_is_ok(o_conv);
22386         return ret_conv;
22387 }
22388
22389 void  __attribute__((export_name("TS_CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_free"))) TS_CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_free(uint64_t _res) {
22390         if (!ptr_is_owned(_res)) return;
22391         void* _res_ptr = untag_ptr(_res);
22392         CHECK_ACCESS(_res_ptr);
22393         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ _res_conv = *(LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ*)(_res_ptr);
22394         FREE(untag_ptr(_res));
22395         CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_free(_res_conv);
22396 }
22397
22398 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_ok"))) TS_CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_ok(uint64_t o) {
22399         LDKInvoiceRequestWithExplicitPayerIdBuilder o_conv;
22400         o_conv.inner = untag_ptr(o);
22401         o_conv.is_owned = ptr_is_owned(o);
22402         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22403         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithExplicitPayerIdBuilder
22404         
22405         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ");
22406         *ret_conv = CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_ok(o_conv);
22407         return tag_ptr(ret_conv, true);
22408 }
22409
22410 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_err"))) TS_CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_err(uint32_t e) {
22411         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_js(e);
22412         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ");
22413         *ret_conv = CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_err(e_conv);
22414         return tag_ptr(ret_conv, true);
22415 }
22416
22417 jboolean  __attribute__((export_name("TS_CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_is_ok"))) TS_CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_is_ok(uint64_t o) {
22418         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* o_conv = (LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ*)untag_ptr(o);
22419         jboolean ret_conv = CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_is_ok(o_conv);
22420         return ret_conv;
22421 }
22422
22423 void  __attribute__((export_name("TS_CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_free"))) TS_CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_free(uint64_t _res) {
22424         if (!ptr_is_owned(_res)) return;
22425         void* _res_ptr = untag_ptr(_res);
22426         CHECK_ACCESS(_res_ptr);
22427         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ _res_conv = *(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ*)(_res_ptr);
22428         FREE(untag_ptr(_res));
22429         CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_free(_res_conv);
22430 }
22431
22432 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_ok"))) TS_CResult_OfferBolt12ParseErrorZ_ok(uint64_t o) {
22433         LDKOffer o_conv;
22434         o_conv.inner = untag_ptr(o);
22435         o_conv.is_owned = ptr_is_owned(o);
22436         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22437         o_conv = Offer_clone(&o_conv);
22438         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
22439         *ret_conv = CResult_OfferBolt12ParseErrorZ_ok(o_conv);
22440         return tag_ptr(ret_conv, true);
22441 }
22442
22443 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_err"))) TS_CResult_OfferBolt12ParseErrorZ_err(uint64_t e) {
22444         LDKBolt12ParseError e_conv;
22445         e_conv.inner = untag_ptr(e);
22446         e_conv.is_owned = ptr_is_owned(e);
22447         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22448         e_conv = Bolt12ParseError_clone(&e_conv);
22449         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
22450         *ret_conv = CResult_OfferBolt12ParseErrorZ_err(e_conv);
22451         return tag_ptr(ret_conv, true);
22452 }
22453
22454 jboolean  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_is_ok"))) TS_CResult_OfferBolt12ParseErrorZ_is_ok(uint64_t o) {
22455         LDKCResult_OfferBolt12ParseErrorZ* o_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(o);
22456         jboolean ret_conv = CResult_OfferBolt12ParseErrorZ_is_ok(o_conv);
22457         return ret_conv;
22458 }
22459
22460 void  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_free"))) TS_CResult_OfferBolt12ParseErrorZ_free(uint64_t _res) {
22461         if (!ptr_is_owned(_res)) return;
22462         void* _res_ptr = untag_ptr(_res);
22463         CHECK_ACCESS(_res_ptr);
22464         LDKCResult_OfferBolt12ParseErrorZ _res_conv = *(LDKCResult_OfferBolt12ParseErrorZ*)(_res_ptr);
22465         FREE(untag_ptr(_res));
22466         CResult_OfferBolt12ParseErrorZ_free(_res_conv);
22467 }
22468
22469 static inline uint64_t CResult_OfferBolt12ParseErrorZ_clone_ptr(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR arg) {
22470         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
22471         *ret_conv = CResult_OfferBolt12ParseErrorZ_clone(arg);
22472         return tag_ptr(ret_conv, true);
22473 }
22474 int64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_clone_ptr"))) TS_CResult_OfferBolt12ParseErrorZ_clone_ptr(uint64_t arg) {
22475         LDKCResult_OfferBolt12ParseErrorZ* arg_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(arg);
22476         int64_t ret_conv = CResult_OfferBolt12ParseErrorZ_clone_ptr(arg_conv);
22477         return ret_conv;
22478 }
22479
22480 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_clone"))) TS_CResult_OfferBolt12ParseErrorZ_clone(uint64_t orig) {
22481         LDKCResult_OfferBolt12ParseErrorZ* orig_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(orig);
22482         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
22483         *ret_conv = CResult_OfferBolt12ParseErrorZ_clone(orig_conv);
22484         return tag_ptr(ret_conv, true);
22485 }
22486
22487 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_ok"))) TS_CResult_NodeIdDecodeErrorZ_ok(uint64_t o) {
22488         LDKNodeId o_conv;
22489         o_conv.inner = untag_ptr(o);
22490         o_conv.is_owned = ptr_is_owned(o);
22491         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22492         o_conv = NodeId_clone(&o_conv);
22493         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
22494         *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
22495         return tag_ptr(ret_conv, true);
22496 }
22497
22498 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_err"))) TS_CResult_NodeIdDecodeErrorZ_err(uint64_t e) {
22499         void* e_ptr = untag_ptr(e);
22500         CHECK_ACCESS(e_ptr);
22501         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22502         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22503         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
22504         *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
22505         return tag_ptr(ret_conv, true);
22506 }
22507
22508 jboolean  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_is_ok"))) TS_CResult_NodeIdDecodeErrorZ_is_ok(uint64_t o) {
22509         LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(o);
22510         jboolean ret_conv = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
22511         return ret_conv;
22512 }
22513
22514 void  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_free"))) TS_CResult_NodeIdDecodeErrorZ_free(uint64_t _res) {
22515         if (!ptr_is_owned(_res)) return;
22516         void* _res_ptr = untag_ptr(_res);
22517         CHECK_ACCESS(_res_ptr);
22518         LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
22519         FREE(untag_ptr(_res));
22520         CResult_NodeIdDecodeErrorZ_free(_res_conv);
22521 }
22522
22523 static inline uint64_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
22524         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
22525         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
22526         return tag_ptr(ret_conv, true);
22527 }
22528 int64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone_ptr"))) TS_CResult_NodeIdDecodeErrorZ_clone_ptr(uint64_t arg) {
22529         LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(arg);
22530         int64_t ret_conv = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
22531         return ret_conv;
22532 }
22533
22534 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone"))) TS_CResult_NodeIdDecodeErrorZ_clone(uint64_t orig) {
22535         LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(orig);
22536         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
22537         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
22538         return tag_ptr(ret_conv, true);
22539 }
22540
22541 uint64_t  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_ok"))) TS_CResult_PublicKeySecp256k1ErrorZ_ok(int8_tArray o) {
22542         LDKPublicKey o_ref;
22543         CHECK(o->arr_len == 33);
22544         memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
22545         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
22546         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_ok(o_ref);
22547         return tag_ptr(ret_conv, true);
22548 }
22549
22550 uint64_t  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_err"))) TS_CResult_PublicKeySecp256k1ErrorZ_err(uint32_t e) {
22551         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
22552         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
22553         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_err(e_conv);
22554         return tag_ptr(ret_conv, true);
22555 }
22556
22557 jboolean  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_is_ok"))) TS_CResult_PublicKeySecp256k1ErrorZ_is_ok(uint64_t o) {
22558         LDKCResult_PublicKeySecp256k1ErrorZ* o_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(o);
22559         jboolean ret_conv = CResult_PublicKeySecp256k1ErrorZ_is_ok(o_conv);
22560         return ret_conv;
22561 }
22562
22563 void  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_free"))) TS_CResult_PublicKeySecp256k1ErrorZ_free(uint64_t _res) {
22564         if (!ptr_is_owned(_res)) return;
22565         void* _res_ptr = untag_ptr(_res);
22566         CHECK_ACCESS(_res_ptr);
22567         LDKCResult_PublicKeySecp256k1ErrorZ _res_conv = *(LDKCResult_PublicKeySecp256k1ErrorZ*)(_res_ptr);
22568         FREE(untag_ptr(_res));
22569         CResult_PublicKeySecp256k1ErrorZ_free(_res_conv);
22570 }
22571
22572 static inline uint64_t CResult_PublicKeySecp256k1ErrorZ_clone_ptr(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR arg) {
22573         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
22574         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone(arg);
22575         return tag_ptr(ret_conv, true);
22576 }
22577 int64_t  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_clone_ptr"))) TS_CResult_PublicKeySecp256k1ErrorZ_clone_ptr(uint64_t arg) {
22578         LDKCResult_PublicKeySecp256k1ErrorZ* arg_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(arg);
22579         int64_t ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone_ptr(arg_conv);
22580         return ret_conv;
22581 }
22582
22583 uint64_t  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_clone"))) TS_CResult_PublicKeySecp256k1ErrorZ_clone(uint64_t orig) {
22584         LDKCResult_PublicKeySecp256k1ErrorZ* orig_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(orig);
22585         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
22586         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone(orig_conv);
22587         return tag_ptr(ret_conv, true);
22588 }
22589
22590 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_some"))) TS_COption_NetworkUpdateZ_some(uint64_t o) {
22591         void* o_ptr = untag_ptr(o);
22592         CHECK_ACCESS(o_ptr);
22593         LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
22594         o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)untag_ptr(o));
22595         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
22596         *ret_copy = COption_NetworkUpdateZ_some(o_conv);
22597         uint64_t ret_ref = tag_ptr(ret_copy, true);
22598         return ret_ref;
22599 }
22600
22601 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_none"))) TS_COption_NetworkUpdateZ_none() {
22602         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
22603         *ret_copy = COption_NetworkUpdateZ_none();
22604         uint64_t ret_ref = tag_ptr(ret_copy, true);
22605         return ret_ref;
22606 }
22607
22608 void  __attribute__((export_name("TS_COption_NetworkUpdateZ_free"))) TS_COption_NetworkUpdateZ_free(uint64_t _res) {
22609         if (!ptr_is_owned(_res)) return;
22610         void* _res_ptr = untag_ptr(_res);
22611         CHECK_ACCESS(_res_ptr);
22612         LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
22613         FREE(untag_ptr(_res));
22614         COption_NetworkUpdateZ_free(_res_conv);
22615 }
22616
22617 static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
22618         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
22619         *ret_copy = COption_NetworkUpdateZ_clone(arg);
22620         uint64_t ret_ref = tag_ptr(ret_copy, true);
22621         return ret_ref;
22622 }
22623 int64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_clone_ptr"))) TS_COption_NetworkUpdateZ_clone_ptr(uint64_t arg) {
22624         LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(arg);
22625         int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv);
22626         return ret_conv;
22627 }
22628
22629 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_clone"))) TS_COption_NetworkUpdateZ_clone(uint64_t orig) {
22630         LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(orig);
22631         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
22632         *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
22633         uint64_t ret_ref = tag_ptr(ret_copy, true);
22634         return ret_ref;
22635 }
22636
22637 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok(uint64_t o) {
22638         void* o_ptr = untag_ptr(o);
22639         CHECK_ACCESS(o_ptr);
22640         LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
22641         o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(o));
22642         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
22643         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
22644         return tag_ptr(ret_conv, true);
22645 }
22646
22647 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err(uint64_t e) {
22648         void* e_ptr = untag_ptr(e);
22649         CHECK_ACCESS(e_ptr);
22650         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22651         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22652         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
22653         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
22654         return tag_ptr(ret_conv, true);
22655 }
22656
22657 jboolean  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(uint64_t o) {
22658         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(o);
22659         jboolean ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
22660         return ret_conv;
22661 }
22662
22663 void  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free(uint64_t _res) {
22664         if (!ptr_is_owned(_res)) return;
22665         void* _res_ptr = untag_ptr(_res);
22666         CHECK_ACCESS(_res_ptr);
22667         LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
22668         FREE(untag_ptr(_res));
22669         CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
22670 }
22671
22672 static inline uint64_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
22673         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
22674         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
22675         return tag_ptr(ret_conv, true);
22676 }
22677 int64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(uint64_t arg) {
22678         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(arg);
22679         int64_t ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
22680         return ret_conv;
22681 }
22682
22683 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone(uint64_t orig) {
22684         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(orig);
22685         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
22686         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
22687         return tag_ptr(ret_conv, true);
22688 }
22689
22690 uint64_t  __attribute__((export_name("TS_COption_UtxoLookupZ_some"))) TS_COption_UtxoLookupZ_some(uint64_t o) {
22691         void* o_ptr = untag_ptr(o);
22692         CHECK_ACCESS(o_ptr);
22693         LDKUtxoLookup o_conv = *(LDKUtxoLookup*)(o_ptr);
22694         if (o_conv.free == LDKUtxoLookup_JCalls_free) {
22695                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22696                 LDKUtxoLookup_JCalls_cloned(&o_conv);
22697         }
22698         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
22699         *ret_copy = COption_UtxoLookupZ_some(o_conv);
22700         uint64_t ret_ref = tag_ptr(ret_copy, true);
22701         return ret_ref;
22702 }
22703
22704 uint64_t  __attribute__((export_name("TS_COption_UtxoLookupZ_none"))) TS_COption_UtxoLookupZ_none() {
22705         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
22706         *ret_copy = COption_UtxoLookupZ_none();
22707         uint64_t ret_ref = tag_ptr(ret_copy, true);
22708         return ret_ref;
22709 }
22710
22711 void  __attribute__((export_name("TS_COption_UtxoLookupZ_free"))) TS_COption_UtxoLookupZ_free(uint64_t _res) {
22712         if (!ptr_is_owned(_res)) return;
22713         void* _res_ptr = untag_ptr(_res);
22714         CHECK_ACCESS(_res_ptr);
22715         LDKCOption_UtxoLookupZ _res_conv = *(LDKCOption_UtxoLookupZ*)(_res_ptr);
22716         FREE(untag_ptr(_res));
22717         COption_UtxoLookupZ_free(_res_conv);
22718 }
22719
22720 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_ok"))) TS_CResult_NoneLightningErrorZ_ok() {
22721         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
22722         *ret_conv = CResult_NoneLightningErrorZ_ok();
22723         return tag_ptr(ret_conv, true);
22724 }
22725
22726 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_err"))) TS_CResult_NoneLightningErrorZ_err(uint64_t e) {
22727         LDKLightningError e_conv;
22728         e_conv.inner = untag_ptr(e);
22729         e_conv.is_owned = ptr_is_owned(e);
22730         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22731         e_conv = LightningError_clone(&e_conv);
22732         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
22733         *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
22734         return tag_ptr(ret_conv, true);
22735 }
22736
22737 jboolean  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_is_ok"))) TS_CResult_NoneLightningErrorZ_is_ok(uint64_t o) {
22738         LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(o);
22739         jboolean ret_conv = CResult_NoneLightningErrorZ_is_ok(o_conv);
22740         return ret_conv;
22741 }
22742
22743 void  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_free"))) TS_CResult_NoneLightningErrorZ_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_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
22748         FREE(untag_ptr(_res));
22749         CResult_NoneLightningErrorZ_free(_res_conv);
22750 }
22751
22752 static inline uint64_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
22753         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
22754         *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
22755         return tag_ptr(ret_conv, true);
22756 }
22757 int64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone_ptr"))) TS_CResult_NoneLightningErrorZ_clone_ptr(uint64_t arg) {
22758         LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(arg);
22759         int64_t ret_conv = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
22760         return ret_conv;
22761 }
22762
22763 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone"))) TS_CResult_NoneLightningErrorZ_clone(uint64_t orig) {
22764         LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(orig);
22765         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
22766         *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
22767         return tag_ptr(ret_conv, true);
22768 }
22769
22770 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_ok"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
22771         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
22772         *ret_conv = CResult_boolLightningErrorZ_ok(o);
22773         return tag_ptr(ret_conv, true);
22774 }
22775
22776 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_err"))) TS_CResult_boolLightningErrorZ_err(uint64_t e) {
22777         LDKLightningError e_conv;
22778         e_conv.inner = untag_ptr(e);
22779         e_conv.is_owned = ptr_is_owned(e);
22780         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22781         e_conv = LightningError_clone(&e_conv);
22782         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
22783         *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
22784         return tag_ptr(ret_conv, true);
22785 }
22786
22787 jboolean  __attribute__((export_name("TS_CResult_boolLightningErrorZ_is_ok"))) TS_CResult_boolLightningErrorZ_is_ok(uint64_t o) {
22788         LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(o);
22789         jboolean ret_conv = CResult_boolLightningErrorZ_is_ok(o_conv);
22790         return ret_conv;
22791 }
22792
22793 void  __attribute__((export_name("TS_CResult_boolLightningErrorZ_free"))) TS_CResult_boolLightningErrorZ_free(uint64_t _res) {
22794         if (!ptr_is_owned(_res)) return;
22795         void* _res_ptr = untag_ptr(_res);
22796         CHECK_ACCESS(_res_ptr);
22797         LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
22798         FREE(untag_ptr(_res));
22799         CResult_boolLightningErrorZ_free(_res_conv);
22800 }
22801
22802 static inline uint64_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
22803         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
22804         *ret_conv = CResult_boolLightningErrorZ_clone(arg);
22805         return tag_ptr(ret_conv, true);
22806 }
22807 int64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone_ptr"))) TS_CResult_boolLightningErrorZ_clone_ptr(uint64_t arg) {
22808         LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(arg);
22809         int64_t ret_conv = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
22810         return ret_conv;
22811 }
22812
22813 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone"))) TS_CResult_boolLightningErrorZ_clone(uint64_t orig) {
22814         LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(orig);
22815         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
22816         *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
22817         return tag_ptr(ret_conv, true);
22818 }
22819
22820 static inline uint64_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
22821         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
22822         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
22823         return tag_ptr(ret_conv, true);
22824 }
22825 int64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(uint64_t arg) {
22826         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(arg);
22827         int64_t ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
22828         return ret_conv;
22829 }
22830
22831 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint64_t orig) {
22832         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(orig);
22833         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
22834         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
22835         return tag_ptr(ret_conv, true);
22836 }
22837
22838 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint64_t a, uint64_t b, uint64_t c) {
22839         LDKChannelAnnouncement a_conv;
22840         a_conv.inner = untag_ptr(a);
22841         a_conv.is_owned = ptr_is_owned(a);
22842         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22843         a_conv = ChannelAnnouncement_clone(&a_conv);
22844         LDKChannelUpdate b_conv;
22845         b_conv.inner = untag_ptr(b);
22846         b_conv.is_owned = ptr_is_owned(b);
22847         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
22848         b_conv = ChannelUpdate_clone(&b_conv);
22849         LDKChannelUpdate c_conv;
22850         c_conv.inner = untag_ptr(c);
22851         c_conv.is_owned = ptr_is_owned(c);
22852         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
22853         c_conv = ChannelUpdate_clone(&c_conv);
22854         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
22855         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
22856         return tag_ptr(ret_conv, true);
22857 }
22858
22859 void  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint64_t _res) {
22860         if (!ptr_is_owned(_res)) return;
22861         void* _res_ptr = untag_ptr(_res);
22862         CHECK_ACCESS(_res_ptr);
22863         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
22864         FREE(untag_ptr(_res));
22865         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
22866 }
22867
22868 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(uint64_t o) {
22869         void* o_ptr = untag_ptr(o);
22870         CHECK_ACCESS(o_ptr);
22871         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ o_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(o_ptr);
22872         o_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(o));
22873         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
22874         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o_conv);
22875         uint64_t ret_ref = tag_ptr(ret_copy, true);
22876         return ret_ref;
22877 }
22878
22879 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none() {
22880         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
22881         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none();
22882         uint64_t ret_ref = tag_ptr(ret_copy, true);
22883         return ret_ref;
22884 }
22885
22886 void  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint64_t _res) {
22887         if (!ptr_is_owned(_res)) return;
22888         void* _res_ptr = untag_ptr(_res);
22889         CHECK_ACCESS(_res_ptr);
22890         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(_res_ptr);
22891         FREE(untag_ptr(_res));
22892         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_conv);
22893 }
22894
22895 static inline uint64_t COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *NONNULL_PTR arg) {
22896         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
22897         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(arg);
22898         uint64_t ret_ref = tag_ptr(ret_copy, true);
22899         return ret_ref;
22900 }
22901 int64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(uint64_t arg) {
22902         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* arg_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(arg);
22903         int64_t ret_conv = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(arg_conv);
22904         return ret_conv;
22905 }
22906
22907 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(uint64_t orig) {
22908         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* orig_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(orig);
22909         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
22910         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig_conv);
22911         uint64_t ret_ref = tag_ptr(ret_copy, true);
22912         return ret_ref;
22913 }
22914
22915 void  __attribute__((export_name("TS_CVec_MessageSendEventZ_free"))) TS_CVec_MessageSendEventZ_free(uint64_tArray _res) {
22916         LDKCVec_MessageSendEventZ _res_constr;
22917         _res_constr.datalen = _res->arr_len;
22918         if (_res_constr.datalen > 0)
22919                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
22920         else
22921                 _res_constr.data = NULL;
22922         uint64_t* _res_vals = _res->elems;
22923         for (size_t s = 0; s < _res_constr.datalen; s++) {
22924                 uint64_t _res_conv_18 = _res_vals[s];
22925                 void* _res_conv_18_ptr = untag_ptr(_res_conv_18);
22926                 CHECK_ACCESS(_res_conv_18_ptr);
22927                 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
22928                 FREE(untag_ptr(_res_conv_18));
22929                 _res_constr.data[s] = _res_conv_18_conv;
22930         }
22931         FREE(_res);
22932         CVec_MessageSendEventZ_free(_res_constr);
22933 }
22934
22935 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok(uint64_t o) {
22936         LDKChannelUpdateInfo o_conv;
22937         o_conv.inner = untag_ptr(o);
22938         o_conv.is_owned = ptr_is_owned(o);
22939         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22940         o_conv = ChannelUpdateInfo_clone(&o_conv);
22941         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
22942         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
22943         return tag_ptr(ret_conv, true);
22944 }
22945
22946 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_err(uint64_t e) {
22947         void* e_ptr = untag_ptr(e);
22948         CHECK_ACCESS(e_ptr);
22949         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22950         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22951         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
22952         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
22953         return tag_ptr(ret_conv, true);
22954 }
22955
22956 jboolean  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(uint64_t o) {
22957         LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(o);
22958         jboolean ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
22959         return ret_conv;
22960 }
22961
22962 void  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_free"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_free(uint64_t _res) {
22963         if (!ptr_is_owned(_res)) return;
22964         void* _res_ptr = untag_ptr(_res);
22965         CHECK_ACCESS(_res_ptr);
22966         LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
22967         FREE(untag_ptr(_res));
22968         CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
22969 }
22970
22971 static inline uint64_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
22972         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
22973         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
22974         return tag_ptr(ret_conv, true);
22975 }
22976 int64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
22977         LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(arg);
22978         int64_t ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
22979         return ret_conv;
22980 }
22981
22982 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone(uint64_t orig) {
22983         LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(orig);
22984         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
22985         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
22986         return tag_ptr(ret_conv, true);
22987 }
22988
22989 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint64_t o) {
22990         LDKChannelInfo o_conv;
22991         o_conv.inner = untag_ptr(o);
22992         o_conv.is_owned = ptr_is_owned(o);
22993         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22994         o_conv = ChannelInfo_clone(&o_conv);
22995         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
22996         *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
22997         return tag_ptr(ret_conv, true);
22998 }
22999
23000 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_err"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint64_t e) {
23001         void* e_ptr = untag_ptr(e);
23002         CHECK_ACCESS(e_ptr);
23003         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23004         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23005         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
23006         *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
23007         return tag_ptr(ret_conv, true);
23008 }
23009
23010 jboolean  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_is_ok(uint64_t o) {
23011         LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(o);
23012         jboolean ret_conv = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
23013         return ret_conv;
23014 }
23015
23016 void  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_free"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint64_t _res) {
23017         if (!ptr_is_owned(_res)) return;
23018         void* _res_ptr = untag_ptr(_res);
23019         CHECK_ACCESS(_res_ptr);
23020         LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
23021         FREE(untag_ptr(_res));
23022         CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
23023 }
23024
23025 static inline uint64_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
23026         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
23027         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
23028         return tag_ptr(ret_conv, true);
23029 }
23030 int64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
23031         LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(arg);
23032         int64_t ret_conv = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
23033         return ret_conv;
23034 }
23035
23036 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint64_t orig) {
23037         LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(orig);
23038         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
23039         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
23040         return tag_ptr(ret_conv, true);
23041 }
23042
23043 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint64_t o) {
23044         LDKRoutingFees o_conv;
23045         o_conv.inner = untag_ptr(o);
23046         o_conv.is_owned = ptr_is_owned(o);
23047         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23048         o_conv = RoutingFees_clone(&o_conv);
23049         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
23050         *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
23051         return tag_ptr(ret_conv, true);
23052 }
23053
23054 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_err"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint64_t e) {
23055         void* e_ptr = untag_ptr(e);
23056         CHECK_ACCESS(e_ptr);
23057         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23058         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23059         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
23060         *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
23061         return tag_ptr(ret_conv, true);
23062 }
23063
23064 jboolean  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_is_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_is_ok(uint64_t o) {
23065         LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(o);
23066         jboolean ret_conv = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
23067         return ret_conv;
23068 }
23069
23070 void  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_free"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint64_t _res) {
23071         if (!ptr_is_owned(_res)) return;
23072         void* _res_ptr = untag_ptr(_res);
23073         CHECK_ACCESS(_res_ptr);
23074         LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
23075         FREE(untag_ptr(_res));
23076         CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
23077 }
23078
23079 static inline uint64_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
23080         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
23081         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
23082         return tag_ptr(ret_conv, true);
23083 }
23084 int64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr"))) TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr(uint64_t arg) {
23085         LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(arg);
23086         int64_t ret_conv = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
23087         return ret_conv;
23088 }
23089
23090 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint64_t orig) {
23091         LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(orig);
23092         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
23093         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
23094         return tag_ptr(ret_conv, true);
23095 }
23096
23097 void  __attribute__((export_name("TS_CVec_SocketAddressZ_free"))) TS_CVec_SocketAddressZ_free(uint64_tArray _res) {
23098         LDKCVec_SocketAddressZ _res_constr;
23099         _res_constr.datalen = _res->arr_len;
23100         if (_res_constr.datalen > 0)
23101                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
23102         else
23103                 _res_constr.data = NULL;
23104         uint64_t* _res_vals = _res->elems;
23105         for (size_t p = 0; p < _res_constr.datalen; p++) {
23106                 uint64_t _res_conv_15 = _res_vals[p];
23107                 void* _res_conv_15_ptr = untag_ptr(_res_conv_15);
23108                 CHECK_ACCESS(_res_conv_15_ptr);
23109                 LDKSocketAddress _res_conv_15_conv = *(LDKSocketAddress*)(_res_conv_15_ptr);
23110                 FREE(untag_ptr(_res_conv_15));
23111                 _res_constr.data[p] = _res_conv_15_conv;
23112         }
23113         FREE(_res);
23114         CVec_SocketAddressZ_free(_res_constr);
23115 }
23116
23117 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint64_t o) {
23118         LDKNodeAnnouncementInfo o_conv;
23119         o_conv.inner = untag_ptr(o);
23120         o_conv.is_owned = ptr_is_owned(o);
23121         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23122         o_conv = NodeAnnouncementInfo_clone(&o_conv);
23123         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
23124         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
23125         return tag_ptr(ret_conv, true);
23126 }
23127
23128 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err(uint64_t e) {
23129         void* e_ptr = untag_ptr(e);
23130         CHECK_ACCESS(e_ptr);
23131         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23132         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23133         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
23134         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
23135         return tag_ptr(ret_conv, true);
23136 }
23137
23138 jboolean  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(uint64_t o) {
23139         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(o);
23140         jboolean ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
23141         return ret_conv;
23142 }
23143
23144 void  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint64_t _res) {
23145         if (!ptr_is_owned(_res)) return;
23146         void* _res_ptr = untag_ptr(_res);
23147         CHECK_ACCESS(_res_ptr);
23148         LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
23149         FREE(untag_ptr(_res));
23150         CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
23151 }
23152
23153 static inline uint64_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
23154         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
23155         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
23156         return tag_ptr(ret_conv, true);
23157 }
23158 int64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
23159         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(arg);
23160         int64_t ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
23161         return ret_conv;
23162 }
23163
23164 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint64_t orig) {
23165         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(orig);
23166         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
23167         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
23168         return tag_ptr(ret_conv, true);
23169 }
23170
23171 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_ok"))) TS_CResult_NodeAliasDecodeErrorZ_ok(uint64_t o) {
23172         LDKNodeAlias o_conv;
23173         o_conv.inner = untag_ptr(o);
23174         o_conv.is_owned = ptr_is_owned(o);
23175         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23176         o_conv = NodeAlias_clone(&o_conv);
23177         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
23178         *ret_conv = CResult_NodeAliasDecodeErrorZ_ok(o_conv);
23179         return tag_ptr(ret_conv, true);
23180 }
23181
23182 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_err"))) TS_CResult_NodeAliasDecodeErrorZ_err(uint64_t e) {
23183         void* e_ptr = untag_ptr(e);
23184         CHECK_ACCESS(e_ptr);
23185         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23186         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23187         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
23188         *ret_conv = CResult_NodeAliasDecodeErrorZ_err(e_conv);
23189         return tag_ptr(ret_conv, true);
23190 }
23191
23192 jboolean  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_is_ok"))) TS_CResult_NodeAliasDecodeErrorZ_is_ok(uint64_t o) {
23193         LDKCResult_NodeAliasDecodeErrorZ* o_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(o);
23194         jboolean ret_conv = CResult_NodeAliasDecodeErrorZ_is_ok(o_conv);
23195         return ret_conv;
23196 }
23197
23198 void  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_free"))) TS_CResult_NodeAliasDecodeErrorZ_free(uint64_t _res) {
23199         if (!ptr_is_owned(_res)) return;
23200         void* _res_ptr = untag_ptr(_res);
23201         CHECK_ACCESS(_res_ptr);
23202         LDKCResult_NodeAliasDecodeErrorZ _res_conv = *(LDKCResult_NodeAliasDecodeErrorZ*)(_res_ptr);
23203         FREE(untag_ptr(_res));
23204         CResult_NodeAliasDecodeErrorZ_free(_res_conv);
23205 }
23206
23207 static inline uint64_t CResult_NodeAliasDecodeErrorZ_clone_ptr(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR arg) {
23208         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
23209         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(arg);
23210         return tag_ptr(ret_conv, true);
23211 }
23212 int64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAliasDecodeErrorZ_clone_ptr(uint64_t arg) {
23213         LDKCResult_NodeAliasDecodeErrorZ* arg_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(arg);
23214         int64_t ret_conv = CResult_NodeAliasDecodeErrorZ_clone_ptr(arg_conv);
23215         return ret_conv;
23216 }
23217
23218 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_clone"))) TS_CResult_NodeAliasDecodeErrorZ_clone(uint64_t orig) {
23219         LDKCResult_NodeAliasDecodeErrorZ* orig_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(orig);
23220         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
23221         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(orig_conv);
23222         return tag_ptr(ret_conv, true);
23223 }
23224
23225 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_ok"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint64_t o) {
23226         LDKNodeInfo o_conv;
23227         o_conv.inner = untag_ptr(o);
23228         o_conv.is_owned = ptr_is_owned(o);
23229         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23230         o_conv = NodeInfo_clone(&o_conv);
23231         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
23232         *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
23233         return tag_ptr(ret_conv, true);
23234 }
23235
23236 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_err"))) TS_CResult_NodeInfoDecodeErrorZ_err(uint64_t e) {
23237         void* e_ptr = untag_ptr(e);
23238         CHECK_ACCESS(e_ptr);
23239         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23240         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23241         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
23242         *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
23243         return tag_ptr(ret_conv, true);
23244 }
23245
23246 jboolean  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeInfoDecodeErrorZ_is_ok(uint64_t o) {
23247         LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(o);
23248         jboolean ret_conv = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
23249         return ret_conv;
23250 }
23251
23252 void  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_free"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint64_t _res) {
23253         if (!ptr_is_owned(_res)) return;
23254         void* _res_ptr = untag_ptr(_res);
23255         CHECK_ACCESS(_res_ptr);
23256         LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
23257         FREE(untag_ptr(_res));
23258         CResult_NodeInfoDecodeErrorZ_free(_res_conv);
23259 }
23260
23261 static inline uint64_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
23262         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
23263         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
23264         return tag_ptr(ret_conv, true);
23265 }
23266 int64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
23267         LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(arg);
23268         int64_t ret_conv = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
23269         return ret_conv;
23270 }
23271
23272 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint64_t orig) {
23273         LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(orig);
23274         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
23275         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
23276         return tag_ptr(ret_conv, true);
23277 }
23278
23279 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint64_t o) {
23280         LDKNetworkGraph o_conv;
23281         o_conv.inner = untag_ptr(o);
23282         o_conv.is_owned = ptr_is_owned(o);
23283         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23284         // WARNING: we need a move here but no clone is available for LDKNetworkGraph
23285         
23286         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
23287         *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
23288         return tag_ptr(ret_conv, true);
23289 }
23290
23291 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_err"))) TS_CResult_NetworkGraphDecodeErrorZ_err(uint64_t e) {
23292         void* e_ptr = untag_ptr(e);
23293         CHECK_ACCESS(e_ptr);
23294         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23295         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23296         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
23297         *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
23298         return tag_ptr(ret_conv, true);
23299 }
23300
23301 jboolean  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_is_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_is_ok(uint64_t o) {
23302         LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(o);
23303         jboolean ret_conv = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
23304         return ret_conv;
23305 }
23306
23307 void  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_free"))) TS_CResult_NetworkGraphDecodeErrorZ_free(uint64_t _res) {
23308         if (!ptr_is_owned(_res)) return;
23309         void* _res_ptr = untag_ptr(_res);
23310         CHECK_ACCESS(_res_ptr);
23311         LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
23312         FREE(untag_ptr(_res));
23313         CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
23314 }
23315
23316 uint64_t  __attribute__((export_name("TS_COption_CVec_SocketAddressZZ_some"))) TS_COption_CVec_SocketAddressZZ_some(uint64_tArray o) {
23317         LDKCVec_SocketAddressZ o_constr;
23318         o_constr.datalen = o->arr_len;
23319         if (o_constr.datalen > 0)
23320                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
23321         else
23322                 o_constr.data = NULL;
23323         uint64_t* o_vals = o->elems;
23324         for (size_t p = 0; p < o_constr.datalen; p++) {
23325                 uint64_t o_conv_15 = o_vals[p];
23326                 void* o_conv_15_ptr = untag_ptr(o_conv_15);
23327                 CHECK_ACCESS(o_conv_15_ptr);
23328                 LDKSocketAddress o_conv_15_conv = *(LDKSocketAddress*)(o_conv_15_ptr);
23329                 o_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o_conv_15));
23330                 o_constr.data[p] = o_conv_15_conv;
23331         }
23332         FREE(o);
23333         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
23334         *ret_copy = COption_CVec_SocketAddressZZ_some(o_constr);
23335         uint64_t ret_ref = tag_ptr(ret_copy, true);
23336         return ret_ref;
23337 }
23338
23339 uint64_t  __attribute__((export_name("TS_COption_CVec_SocketAddressZZ_none"))) TS_COption_CVec_SocketAddressZZ_none() {
23340         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
23341         *ret_copy = COption_CVec_SocketAddressZZ_none();
23342         uint64_t ret_ref = tag_ptr(ret_copy, true);
23343         return ret_ref;
23344 }
23345
23346 void  __attribute__((export_name("TS_COption_CVec_SocketAddressZZ_free"))) TS_COption_CVec_SocketAddressZZ_free(uint64_t _res) {
23347         if (!ptr_is_owned(_res)) return;
23348         void* _res_ptr = untag_ptr(_res);
23349         CHECK_ACCESS(_res_ptr);
23350         LDKCOption_CVec_SocketAddressZZ _res_conv = *(LDKCOption_CVec_SocketAddressZZ*)(_res_ptr);
23351         FREE(untag_ptr(_res));
23352         COption_CVec_SocketAddressZZ_free(_res_conv);
23353 }
23354
23355 static inline uint64_t COption_CVec_SocketAddressZZ_clone_ptr(LDKCOption_CVec_SocketAddressZZ *NONNULL_PTR arg) {
23356         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
23357         *ret_copy = COption_CVec_SocketAddressZZ_clone(arg);
23358         uint64_t ret_ref = tag_ptr(ret_copy, true);
23359         return ret_ref;
23360 }
23361 int64_t  __attribute__((export_name("TS_COption_CVec_SocketAddressZZ_clone_ptr"))) TS_COption_CVec_SocketAddressZZ_clone_ptr(uint64_t arg) {
23362         LDKCOption_CVec_SocketAddressZZ* arg_conv = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(arg);
23363         int64_t ret_conv = COption_CVec_SocketAddressZZ_clone_ptr(arg_conv);
23364         return ret_conv;
23365 }
23366
23367 uint64_t  __attribute__((export_name("TS_COption_CVec_SocketAddressZZ_clone"))) TS_COption_CVec_SocketAddressZZ_clone(uint64_t orig) {
23368         LDKCOption_CVec_SocketAddressZZ* orig_conv = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(orig);
23369         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
23370         *ret_copy = COption_CVec_SocketAddressZZ_clone(orig_conv);
23371         uint64_t ret_ref = tag_ptr(ret_copy, true);
23372         return ret_ref;
23373 }
23374
23375 uint64_t  __attribute__((export_name("TS_CResult_u64ShortChannelIdErrorZ_ok"))) TS_CResult_u64ShortChannelIdErrorZ_ok(int64_t o) {
23376         LDKCResult_u64ShortChannelIdErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u64ShortChannelIdErrorZ), "LDKCResult_u64ShortChannelIdErrorZ");
23377         *ret_conv = CResult_u64ShortChannelIdErrorZ_ok(o);
23378         return tag_ptr(ret_conv, true);
23379 }
23380
23381 uint64_t  __attribute__((export_name("TS_CResult_u64ShortChannelIdErrorZ_err"))) TS_CResult_u64ShortChannelIdErrorZ_err(uint32_t e) {
23382         LDKShortChannelIdError e_conv = LDKShortChannelIdError_from_js(e);
23383         LDKCResult_u64ShortChannelIdErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u64ShortChannelIdErrorZ), "LDKCResult_u64ShortChannelIdErrorZ");
23384         *ret_conv = CResult_u64ShortChannelIdErrorZ_err(e_conv);
23385         return tag_ptr(ret_conv, true);
23386 }
23387
23388 jboolean  __attribute__((export_name("TS_CResult_u64ShortChannelIdErrorZ_is_ok"))) TS_CResult_u64ShortChannelIdErrorZ_is_ok(uint64_t o) {
23389         LDKCResult_u64ShortChannelIdErrorZ* o_conv = (LDKCResult_u64ShortChannelIdErrorZ*)untag_ptr(o);
23390         jboolean ret_conv = CResult_u64ShortChannelIdErrorZ_is_ok(o_conv);
23391         return ret_conv;
23392 }
23393
23394 void  __attribute__((export_name("TS_CResult_u64ShortChannelIdErrorZ_free"))) TS_CResult_u64ShortChannelIdErrorZ_free(uint64_t _res) {
23395         if (!ptr_is_owned(_res)) return;
23396         void* _res_ptr = untag_ptr(_res);
23397         CHECK_ACCESS(_res_ptr);
23398         LDKCResult_u64ShortChannelIdErrorZ _res_conv = *(LDKCResult_u64ShortChannelIdErrorZ*)(_res_ptr);
23399         FREE(untag_ptr(_res));
23400         CResult_u64ShortChannelIdErrorZ_free(_res_conv);
23401 }
23402
23403 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoInboundHTLCErrZ_ok"))) TS_CResult_PendingHTLCInfoInboundHTLCErrZ_ok(uint64_t o) {
23404         LDKPendingHTLCInfo o_conv;
23405         o_conv.inner = untag_ptr(o);
23406         o_conv.is_owned = ptr_is_owned(o);
23407         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23408         o_conv = PendingHTLCInfo_clone(&o_conv);
23409         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
23410         *ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_ok(o_conv);
23411         return tag_ptr(ret_conv, true);
23412 }
23413
23414 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoInboundHTLCErrZ_err"))) TS_CResult_PendingHTLCInfoInboundHTLCErrZ_err(uint64_t e) {
23415         LDKInboundHTLCErr e_conv;
23416         e_conv.inner = untag_ptr(e);
23417         e_conv.is_owned = ptr_is_owned(e);
23418         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23419         e_conv = InboundHTLCErr_clone(&e_conv);
23420         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
23421         *ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_err(e_conv);
23422         return tag_ptr(ret_conv, true);
23423 }
23424
23425 jboolean  __attribute__((export_name("TS_CResult_PendingHTLCInfoInboundHTLCErrZ_is_ok"))) TS_CResult_PendingHTLCInfoInboundHTLCErrZ_is_ok(uint64_t o) {
23426         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* o_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(o);
23427         jboolean ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_is_ok(o_conv);
23428         return ret_conv;
23429 }
23430
23431 void  __attribute__((export_name("TS_CResult_PendingHTLCInfoInboundHTLCErrZ_free"))) TS_CResult_PendingHTLCInfoInboundHTLCErrZ_free(uint64_t _res) {
23432         if (!ptr_is_owned(_res)) return;
23433         void* _res_ptr = untag_ptr(_res);
23434         CHECK_ACCESS(_res_ptr);
23435         LDKCResult_PendingHTLCInfoInboundHTLCErrZ _res_conv = *(LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)(_res_ptr);
23436         FREE(untag_ptr(_res));
23437         CResult_PendingHTLCInfoInboundHTLCErrZ_free(_res_conv);
23438 }
23439
23440 static inline uint64_t CResult_PendingHTLCInfoInboundHTLCErrZ_clone_ptr(LDKCResult_PendingHTLCInfoInboundHTLCErrZ *NONNULL_PTR arg) {
23441         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
23442         *ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_clone(arg);
23443         return tag_ptr(ret_conv, true);
23444 }
23445 int64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoInboundHTLCErrZ_clone_ptr"))) TS_CResult_PendingHTLCInfoInboundHTLCErrZ_clone_ptr(uint64_t arg) {
23446         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* arg_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(arg);
23447         int64_t ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_clone_ptr(arg_conv);
23448         return ret_conv;
23449 }
23450
23451 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoInboundHTLCErrZ_clone"))) TS_CResult_PendingHTLCInfoInboundHTLCErrZ_clone(uint64_t orig) {
23452         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* orig_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(orig);
23453         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
23454         *ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_clone(orig_conv);
23455         return tag_ptr(ret_conv, true);
23456 }
23457
23458 void  __attribute__((export_name("TS_CVec_HTLCOutputInCommitmentZ_free"))) TS_CVec_HTLCOutputInCommitmentZ_free(uint64_tArray _res) {
23459         LDKCVec_HTLCOutputInCommitmentZ _res_constr;
23460         _res_constr.datalen = _res->arr_len;
23461         if (_res_constr.datalen > 0)
23462                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
23463         else
23464                 _res_constr.data = NULL;
23465         uint64_t* _res_vals = _res->elems;
23466         for (size_t y = 0; y < _res_constr.datalen; y++) {
23467                 uint64_t _res_conv_24 = _res_vals[y];
23468                 LDKHTLCOutputInCommitment _res_conv_24_conv;
23469                 _res_conv_24_conv.inner = untag_ptr(_res_conv_24);
23470                 _res_conv_24_conv.is_owned = ptr_is_owned(_res_conv_24);
23471                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_24_conv);
23472                 _res_constr.data[y] = _res_conv_24_conv;
23473         }
23474         FREE(_res);
23475         CVec_HTLCOutputInCommitmentZ_free(_res_constr);
23476 }
23477
23478 void  __attribute__((export_name("TS_CVec_HTLCDescriptorZ_free"))) TS_CVec_HTLCDescriptorZ_free(uint64_tArray _res) {
23479         LDKCVec_HTLCDescriptorZ _res_constr;
23480         _res_constr.datalen = _res->arr_len;
23481         if (_res_constr.datalen > 0)
23482                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKHTLCDescriptor), "LDKCVec_HTLCDescriptorZ Elements");
23483         else
23484                 _res_constr.data = NULL;
23485         uint64_t* _res_vals = _res->elems;
23486         for (size_t q = 0; q < _res_constr.datalen; q++) {
23487                 uint64_t _res_conv_16 = _res_vals[q];
23488                 LDKHTLCDescriptor _res_conv_16_conv;
23489                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
23490                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
23491                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
23492                 _res_constr.data[q] = _res_conv_16_conv;
23493         }
23494         FREE(_res);
23495         CVec_HTLCDescriptorZ_free(_res_constr);
23496 }
23497
23498 void  __attribute__((export_name("TS_CVec_UtxoZ_free"))) TS_CVec_UtxoZ_free(uint64_tArray _res) {
23499         LDKCVec_UtxoZ _res_constr;
23500         _res_constr.datalen = _res->arr_len;
23501         if (_res_constr.datalen > 0)
23502                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
23503         else
23504                 _res_constr.data = NULL;
23505         uint64_t* _res_vals = _res->elems;
23506         for (size_t g = 0; g < _res_constr.datalen; g++) {
23507                 uint64_t _res_conv_6 = _res_vals[g];
23508                 LDKUtxo _res_conv_6_conv;
23509                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
23510                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
23511                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
23512                 _res_constr.data[g] = _res_conv_6_conv;
23513         }
23514         FREE(_res);
23515         CVec_UtxoZ_free(_res_constr);
23516 }
23517
23518 uint64_t  __attribute__((export_name("TS_COption_TxOutZ_some"))) TS_COption_TxOutZ_some(uint64_t o) {
23519         void* o_ptr = untag_ptr(o);
23520         CHECK_ACCESS(o_ptr);
23521         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
23522         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
23523         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
23524         *ret_copy = COption_TxOutZ_some(o_conv);
23525         uint64_t ret_ref = tag_ptr(ret_copy, true);
23526         return ret_ref;
23527 }
23528
23529 uint64_t  __attribute__((export_name("TS_COption_TxOutZ_none"))) TS_COption_TxOutZ_none() {
23530         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
23531         *ret_copy = COption_TxOutZ_none();
23532         uint64_t ret_ref = tag_ptr(ret_copy, true);
23533         return ret_ref;
23534 }
23535
23536 void  __attribute__((export_name("TS_COption_TxOutZ_free"))) TS_COption_TxOutZ_free(uint64_t _res) {
23537         if (!ptr_is_owned(_res)) return;
23538         void* _res_ptr = untag_ptr(_res);
23539         CHECK_ACCESS(_res_ptr);
23540         LDKCOption_TxOutZ _res_conv = *(LDKCOption_TxOutZ*)(_res_ptr);
23541         FREE(untag_ptr(_res));
23542         COption_TxOutZ_free(_res_conv);
23543 }
23544
23545 static inline uint64_t COption_TxOutZ_clone_ptr(LDKCOption_TxOutZ *NONNULL_PTR arg) {
23546         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
23547         *ret_copy = COption_TxOutZ_clone(arg);
23548         uint64_t ret_ref = tag_ptr(ret_copy, true);
23549         return ret_ref;
23550 }
23551 int64_t  __attribute__((export_name("TS_COption_TxOutZ_clone_ptr"))) TS_COption_TxOutZ_clone_ptr(uint64_t arg) {
23552         LDKCOption_TxOutZ* arg_conv = (LDKCOption_TxOutZ*)untag_ptr(arg);
23553         int64_t ret_conv = COption_TxOutZ_clone_ptr(arg_conv);
23554         return ret_conv;
23555 }
23556
23557 uint64_t  __attribute__((export_name("TS_COption_TxOutZ_clone"))) TS_COption_TxOutZ_clone(uint64_t orig) {
23558         LDKCOption_TxOutZ* orig_conv = (LDKCOption_TxOutZ*)untag_ptr(orig);
23559         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
23560         *ret_copy = COption_TxOutZ_clone(orig_conv);
23561         uint64_t ret_ref = tag_ptr(ret_copy, true);
23562         return ret_ref;
23563 }
23564
23565 void  __attribute__((export_name("TS_CVec_InputZ_free"))) TS_CVec_InputZ_free(uint64_tArray _res) {
23566         LDKCVec_InputZ _res_constr;
23567         _res_constr.datalen = _res->arr_len;
23568         if (_res_constr.datalen > 0)
23569                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKInput), "LDKCVec_InputZ Elements");
23570         else
23571                 _res_constr.data = NULL;
23572         uint64_t* _res_vals = _res->elems;
23573         for (size_t h = 0; h < _res_constr.datalen; h++) {
23574                 uint64_t _res_conv_7 = _res_vals[h];
23575                 LDKInput _res_conv_7_conv;
23576                 _res_conv_7_conv.inner = untag_ptr(_res_conv_7);
23577                 _res_conv_7_conv.is_owned = ptr_is_owned(_res_conv_7);
23578                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_7_conv);
23579                 _res_constr.data[h] = _res_conv_7_conv;
23580         }
23581         FREE(_res);
23582         CVec_InputZ_free(_res_constr);
23583 }
23584
23585 uint64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_ok"))) TS_CResult_CoinSelectionNoneZ_ok(uint64_t o) {
23586         LDKCoinSelection o_conv;
23587         o_conv.inner = untag_ptr(o);
23588         o_conv.is_owned = ptr_is_owned(o);
23589         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23590         o_conv = CoinSelection_clone(&o_conv);
23591         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
23592         *ret_conv = CResult_CoinSelectionNoneZ_ok(o_conv);
23593         return tag_ptr(ret_conv, true);
23594 }
23595
23596 uint64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_err"))) TS_CResult_CoinSelectionNoneZ_err() {
23597         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
23598         *ret_conv = CResult_CoinSelectionNoneZ_err();
23599         return tag_ptr(ret_conv, true);
23600 }
23601
23602 jboolean  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_is_ok"))) TS_CResult_CoinSelectionNoneZ_is_ok(uint64_t o) {
23603         LDKCResult_CoinSelectionNoneZ* o_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(o);
23604         jboolean ret_conv = CResult_CoinSelectionNoneZ_is_ok(o_conv);
23605         return ret_conv;
23606 }
23607
23608 void  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_free"))) TS_CResult_CoinSelectionNoneZ_free(uint64_t _res) {
23609         if (!ptr_is_owned(_res)) return;
23610         void* _res_ptr = untag_ptr(_res);
23611         CHECK_ACCESS(_res_ptr);
23612         LDKCResult_CoinSelectionNoneZ _res_conv = *(LDKCResult_CoinSelectionNoneZ*)(_res_ptr);
23613         FREE(untag_ptr(_res));
23614         CResult_CoinSelectionNoneZ_free(_res_conv);
23615 }
23616
23617 static inline uint64_t CResult_CoinSelectionNoneZ_clone_ptr(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR arg) {
23618         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
23619         *ret_conv = CResult_CoinSelectionNoneZ_clone(arg);
23620         return tag_ptr(ret_conv, true);
23621 }
23622 int64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_clone_ptr"))) TS_CResult_CoinSelectionNoneZ_clone_ptr(uint64_t arg) {
23623         LDKCResult_CoinSelectionNoneZ* arg_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(arg);
23624         int64_t ret_conv = CResult_CoinSelectionNoneZ_clone_ptr(arg_conv);
23625         return ret_conv;
23626 }
23627
23628 uint64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_clone"))) TS_CResult_CoinSelectionNoneZ_clone(uint64_t orig) {
23629         LDKCResult_CoinSelectionNoneZ* orig_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(orig);
23630         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
23631         *ret_conv = CResult_CoinSelectionNoneZ_clone(orig_conv);
23632         return tag_ptr(ret_conv, true);
23633 }
23634
23635 uint64_t  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_ok"))) TS_CResult_CVec_UtxoZNoneZ_ok(uint64_tArray o) {
23636         LDKCVec_UtxoZ o_constr;
23637         o_constr.datalen = o->arr_len;
23638         if (o_constr.datalen > 0)
23639                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
23640         else
23641                 o_constr.data = NULL;
23642         uint64_t* o_vals = o->elems;
23643         for (size_t g = 0; g < o_constr.datalen; g++) {
23644                 uint64_t o_conv_6 = o_vals[g];
23645                 LDKUtxo o_conv_6_conv;
23646                 o_conv_6_conv.inner = untag_ptr(o_conv_6);
23647                 o_conv_6_conv.is_owned = ptr_is_owned(o_conv_6);
23648                 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv_6_conv);
23649                 o_conv_6_conv = Utxo_clone(&o_conv_6_conv);
23650                 o_constr.data[g] = o_conv_6_conv;
23651         }
23652         FREE(o);
23653         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
23654         *ret_conv = CResult_CVec_UtxoZNoneZ_ok(o_constr);
23655         return tag_ptr(ret_conv, true);
23656 }
23657
23658 uint64_t  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_err"))) TS_CResult_CVec_UtxoZNoneZ_err() {
23659         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
23660         *ret_conv = CResult_CVec_UtxoZNoneZ_err();
23661         return tag_ptr(ret_conv, true);
23662 }
23663
23664 jboolean  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_is_ok"))) TS_CResult_CVec_UtxoZNoneZ_is_ok(uint64_t o) {
23665         LDKCResult_CVec_UtxoZNoneZ* o_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(o);
23666         jboolean ret_conv = CResult_CVec_UtxoZNoneZ_is_ok(o_conv);
23667         return ret_conv;
23668 }
23669
23670 void  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_free"))) TS_CResult_CVec_UtxoZNoneZ_free(uint64_t _res) {
23671         if (!ptr_is_owned(_res)) return;
23672         void* _res_ptr = untag_ptr(_res);
23673         CHECK_ACCESS(_res_ptr);
23674         LDKCResult_CVec_UtxoZNoneZ _res_conv = *(LDKCResult_CVec_UtxoZNoneZ*)(_res_ptr);
23675         FREE(untag_ptr(_res));
23676         CResult_CVec_UtxoZNoneZ_free(_res_conv);
23677 }
23678
23679 static inline uint64_t CResult_CVec_UtxoZNoneZ_clone_ptr(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR arg) {
23680         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
23681         *ret_conv = CResult_CVec_UtxoZNoneZ_clone(arg);
23682         return tag_ptr(ret_conv, true);
23683 }
23684 int64_t  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_clone_ptr"))) TS_CResult_CVec_UtxoZNoneZ_clone_ptr(uint64_t arg) {
23685         LDKCResult_CVec_UtxoZNoneZ* arg_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(arg);
23686         int64_t ret_conv = CResult_CVec_UtxoZNoneZ_clone_ptr(arg_conv);
23687         return ret_conv;
23688 }
23689
23690 uint64_t  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_clone"))) TS_CResult_CVec_UtxoZNoneZ_clone(uint64_t orig) {
23691         LDKCResult_CVec_UtxoZNoneZ* orig_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(orig);
23692         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
23693         *ret_conv = CResult_CVec_UtxoZNoneZ_clone(orig_conv);
23694         return tag_ptr(ret_conv, true);
23695 }
23696
23697 uint64_t  __attribute__((export_name("TS_COption_PaymentContextZ_some"))) TS_COption_PaymentContextZ_some(uint64_t o) {
23698         void* o_ptr = untag_ptr(o);
23699         CHECK_ACCESS(o_ptr);
23700         LDKPaymentContext o_conv = *(LDKPaymentContext*)(o_ptr);
23701         o_conv = PaymentContext_clone((LDKPaymentContext*)untag_ptr(o));
23702         LDKCOption_PaymentContextZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentContextZ), "LDKCOption_PaymentContextZ");
23703         *ret_copy = COption_PaymentContextZ_some(o_conv);
23704         uint64_t ret_ref = tag_ptr(ret_copy, true);
23705         return ret_ref;
23706 }
23707
23708 uint64_t  __attribute__((export_name("TS_COption_PaymentContextZ_none"))) TS_COption_PaymentContextZ_none() {
23709         LDKCOption_PaymentContextZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentContextZ), "LDKCOption_PaymentContextZ");
23710         *ret_copy = COption_PaymentContextZ_none();
23711         uint64_t ret_ref = tag_ptr(ret_copy, true);
23712         return ret_ref;
23713 }
23714
23715 void  __attribute__((export_name("TS_COption_PaymentContextZ_free"))) TS_COption_PaymentContextZ_free(uint64_t _res) {
23716         if (!ptr_is_owned(_res)) return;
23717         void* _res_ptr = untag_ptr(_res);
23718         CHECK_ACCESS(_res_ptr);
23719         LDKCOption_PaymentContextZ _res_conv = *(LDKCOption_PaymentContextZ*)(_res_ptr);
23720         FREE(untag_ptr(_res));
23721         COption_PaymentContextZ_free(_res_conv);
23722 }
23723
23724 static inline uint64_t COption_PaymentContextZ_clone_ptr(LDKCOption_PaymentContextZ *NONNULL_PTR arg) {
23725         LDKCOption_PaymentContextZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentContextZ), "LDKCOption_PaymentContextZ");
23726         *ret_copy = COption_PaymentContextZ_clone(arg);
23727         uint64_t ret_ref = tag_ptr(ret_copy, true);
23728         return ret_ref;
23729 }
23730 int64_t  __attribute__((export_name("TS_COption_PaymentContextZ_clone_ptr"))) TS_COption_PaymentContextZ_clone_ptr(uint64_t arg) {
23731         LDKCOption_PaymentContextZ* arg_conv = (LDKCOption_PaymentContextZ*)untag_ptr(arg);
23732         int64_t ret_conv = COption_PaymentContextZ_clone_ptr(arg_conv);
23733         return ret_conv;
23734 }
23735
23736 uint64_t  __attribute__((export_name("TS_COption_PaymentContextZ_clone"))) TS_COption_PaymentContextZ_clone(uint64_t orig) {
23737         LDKCOption_PaymentContextZ* orig_conv = (LDKCOption_PaymentContextZ*)untag_ptr(orig);
23738         LDKCOption_PaymentContextZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentContextZ), "LDKCOption_PaymentContextZ");
23739         *ret_copy = COption_PaymentContextZ_clone(orig_conv);
23740         uint64_t ret_ref = tag_ptr(ret_copy, true);
23741         return ret_ref;
23742 }
23743
23744 static inline uint64_t C2Tuple_u64u16Z_clone_ptr(LDKC2Tuple_u64u16Z *NONNULL_PTR arg) {
23745         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
23746         *ret_conv = C2Tuple_u64u16Z_clone(arg);
23747         return tag_ptr(ret_conv, true);
23748 }
23749 int64_t  __attribute__((export_name("TS_C2Tuple_u64u16Z_clone_ptr"))) TS_C2Tuple_u64u16Z_clone_ptr(uint64_t arg) {
23750         LDKC2Tuple_u64u16Z* arg_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(arg);
23751         int64_t ret_conv = C2Tuple_u64u16Z_clone_ptr(arg_conv);
23752         return ret_conv;
23753 }
23754
23755 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u16Z_clone"))) TS_C2Tuple_u64u16Z_clone(uint64_t orig) {
23756         LDKC2Tuple_u64u16Z* orig_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(orig);
23757         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
23758         *ret_conv = C2Tuple_u64u16Z_clone(orig_conv);
23759         return tag_ptr(ret_conv, true);
23760 }
23761
23762 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u16Z_new"))) TS_C2Tuple_u64u16Z_new(int64_t a, int16_t b) {
23763         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
23764         *ret_conv = C2Tuple_u64u16Z_new(a, b);
23765         return tag_ptr(ret_conv, true);
23766 }
23767
23768 void  __attribute__((export_name("TS_C2Tuple_u64u16Z_free"))) TS_C2Tuple_u64u16Z_free(uint64_t _res) {
23769         if (!ptr_is_owned(_res)) return;
23770         void* _res_ptr = untag_ptr(_res);
23771         CHECK_ACCESS(_res_ptr);
23772         LDKC2Tuple_u64u16Z _res_conv = *(LDKC2Tuple_u64u16Z*)(_res_ptr);
23773         FREE(untag_ptr(_res));
23774         C2Tuple_u64u16Z_free(_res_conv);
23775 }
23776
23777 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u16ZZ_some"))) TS_COption_C2Tuple_u64u16ZZ_some(uint64_t o) {
23778         void* o_ptr = untag_ptr(o);
23779         CHECK_ACCESS(o_ptr);
23780         LDKC2Tuple_u64u16Z o_conv = *(LDKC2Tuple_u64u16Z*)(o_ptr);
23781         o_conv = C2Tuple_u64u16Z_clone((LDKC2Tuple_u64u16Z*)untag_ptr(o));
23782         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
23783         *ret_copy = COption_C2Tuple_u64u16ZZ_some(o_conv);
23784         uint64_t ret_ref = tag_ptr(ret_copy, true);
23785         return ret_ref;
23786 }
23787
23788 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u16ZZ_none"))) TS_COption_C2Tuple_u64u16ZZ_none() {
23789         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
23790         *ret_copy = COption_C2Tuple_u64u16ZZ_none();
23791         uint64_t ret_ref = tag_ptr(ret_copy, true);
23792         return ret_ref;
23793 }
23794
23795 void  __attribute__((export_name("TS_COption_C2Tuple_u64u16ZZ_free"))) TS_COption_C2Tuple_u64u16ZZ_free(uint64_t _res) {
23796         if (!ptr_is_owned(_res)) return;
23797         void* _res_ptr = untag_ptr(_res);
23798         CHECK_ACCESS(_res_ptr);
23799         LDKCOption_C2Tuple_u64u16ZZ _res_conv = *(LDKCOption_C2Tuple_u64u16ZZ*)(_res_ptr);
23800         FREE(untag_ptr(_res));
23801         COption_C2Tuple_u64u16ZZ_free(_res_conv);
23802 }
23803
23804 static inline uint64_t COption_C2Tuple_u64u16ZZ_clone_ptr(LDKCOption_C2Tuple_u64u16ZZ *NONNULL_PTR arg) {
23805         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
23806         *ret_copy = COption_C2Tuple_u64u16ZZ_clone(arg);
23807         uint64_t ret_ref = tag_ptr(ret_copy, true);
23808         return ret_ref;
23809 }
23810 int64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u16ZZ_clone_ptr"))) TS_COption_C2Tuple_u64u16ZZ_clone_ptr(uint64_t arg) {
23811         LDKCOption_C2Tuple_u64u16ZZ* arg_conv = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(arg);
23812         int64_t ret_conv = COption_C2Tuple_u64u16ZZ_clone_ptr(arg_conv);
23813         return ret_conv;
23814 }
23815
23816 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u16ZZ_clone"))) TS_COption_C2Tuple_u64u16ZZ_clone(uint64_t orig) {
23817         LDKCOption_C2Tuple_u64u16ZZ* orig_conv = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(orig);
23818         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
23819         *ret_copy = COption_C2Tuple_u64u16ZZ_clone(orig_conv);
23820         uint64_t ret_ref = tag_ptr(ret_copy, true);
23821         return ret_ref;
23822 }
23823
23824 uint64_t  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_some"))) TS_COption_ChannelShutdownStateZ_some(uint32_t o) {
23825         LDKChannelShutdownState o_conv = LDKChannelShutdownState_from_js(o);
23826         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
23827         *ret_copy = COption_ChannelShutdownStateZ_some(o_conv);
23828         uint64_t ret_ref = tag_ptr(ret_copy, true);
23829         return ret_ref;
23830 }
23831
23832 uint64_t  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_none"))) TS_COption_ChannelShutdownStateZ_none() {
23833         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
23834         *ret_copy = COption_ChannelShutdownStateZ_none();
23835         uint64_t ret_ref = tag_ptr(ret_copy, true);
23836         return ret_ref;
23837 }
23838
23839 void  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_free"))) TS_COption_ChannelShutdownStateZ_free(uint64_t _res) {
23840         if (!ptr_is_owned(_res)) return;
23841         void* _res_ptr = untag_ptr(_res);
23842         CHECK_ACCESS(_res_ptr);
23843         LDKCOption_ChannelShutdownStateZ _res_conv = *(LDKCOption_ChannelShutdownStateZ*)(_res_ptr);
23844         FREE(untag_ptr(_res));
23845         COption_ChannelShutdownStateZ_free(_res_conv);
23846 }
23847
23848 static inline uint64_t COption_ChannelShutdownStateZ_clone_ptr(LDKCOption_ChannelShutdownStateZ *NONNULL_PTR arg) {
23849         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
23850         *ret_copy = COption_ChannelShutdownStateZ_clone(arg);
23851         uint64_t ret_ref = tag_ptr(ret_copy, true);
23852         return ret_ref;
23853 }
23854 int64_t  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_clone_ptr"))) TS_COption_ChannelShutdownStateZ_clone_ptr(uint64_t arg) {
23855         LDKCOption_ChannelShutdownStateZ* arg_conv = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(arg);
23856         int64_t ret_conv = COption_ChannelShutdownStateZ_clone_ptr(arg_conv);
23857         return ret_conv;
23858 }
23859
23860 uint64_t  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_clone"))) TS_COption_ChannelShutdownStateZ_clone(uint64_t orig) {
23861         LDKCOption_ChannelShutdownStateZ* orig_conv = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(orig);
23862         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
23863         *ret_copy = COption_ChannelShutdownStateZ_clone(orig_conv);
23864         uint64_t ret_ref = tag_ptr(ret_copy, true);
23865         return ret_ref;
23866 }
23867
23868 uint64_t  __attribute__((export_name("TS_CResult_ChannelIdAPIErrorZ_ok"))) TS_CResult_ChannelIdAPIErrorZ_ok(uint64_t o) {
23869         LDKChannelId o_conv;
23870         o_conv.inner = untag_ptr(o);
23871         o_conv.is_owned = ptr_is_owned(o);
23872         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23873         o_conv = ChannelId_clone(&o_conv);
23874         LDKCResult_ChannelIdAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdAPIErrorZ), "LDKCResult_ChannelIdAPIErrorZ");
23875         *ret_conv = CResult_ChannelIdAPIErrorZ_ok(o_conv);
23876         return tag_ptr(ret_conv, true);
23877 }
23878
23879 uint64_t  __attribute__((export_name("TS_CResult_ChannelIdAPIErrorZ_err"))) TS_CResult_ChannelIdAPIErrorZ_err(uint64_t e) {
23880         void* e_ptr = untag_ptr(e);
23881         CHECK_ACCESS(e_ptr);
23882         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
23883         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
23884         LDKCResult_ChannelIdAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdAPIErrorZ), "LDKCResult_ChannelIdAPIErrorZ");
23885         *ret_conv = CResult_ChannelIdAPIErrorZ_err(e_conv);
23886         return tag_ptr(ret_conv, true);
23887 }
23888
23889 jboolean  __attribute__((export_name("TS_CResult_ChannelIdAPIErrorZ_is_ok"))) TS_CResult_ChannelIdAPIErrorZ_is_ok(uint64_t o) {
23890         LDKCResult_ChannelIdAPIErrorZ* o_conv = (LDKCResult_ChannelIdAPIErrorZ*)untag_ptr(o);
23891         jboolean ret_conv = CResult_ChannelIdAPIErrorZ_is_ok(o_conv);
23892         return ret_conv;
23893 }
23894
23895 void  __attribute__((export_name("TS_CResult_ChannelIdAPIErrorZ_free"))) TS_CResult_ChannelIdAPIErrorZ_free(uint64_t _res) {
23896         if (!ptr_is_owned(_res)) return;
23897         void* _res_ptr = untag_ptr(_res);
23898         CHECK_ACCESS(_res_ptr);
23899         LDKCResult_ChannelIdAPIErrorZ _res_conv = *(LDKCResult_ChannelIdAPIErrorZ*)(_res_ptr);
23900         FREE(untag_ptr(_res));
23901         CResult_ChannelIdAPIErrorZ_free(_res_conv);
23902 }
23903
23904 static inline uint64_t CResult_ChannelIdAPIErrorZ_clone_ptr(LDKCResult_ChannelIdAPIErrorZ *NONNULL_PTR arg) {
23905         LDKCResult_ChannelIdAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdAPIErrorZ), "LDKCResult_ChannelIdAPIErrorZ");
23906         *ret_conv = CResult_ChannelIdAPIErrorZ_clone(arg);
23907         return tag_ptr(ret_conv, true);
23908 }
23909 int64_t  __attribute__((export_name("TS_CResult_ChannelIdAPIErrorZ_clone_ptr"))) TS_CResult_ChannelIdAPIErrorZ_clone_ptr(uint64_t arg) {
23910         LDKCResult_ChannelIdAPIErrorZ* arg_conv = (LDKCResult_ChannelIdAPIErrorZ*)untag_ptr(arg);
23911         int64_t ret_conv = CResult_ChannelIdAPIErrorZ_clone_ptr(arg_conv);
23912         return ret_conv;
23913 }
23914
23915 uint64_t  __attribute__((export_name("TS_CResult_ChannelIdAPIErrorZ_clone"))) TS_CResult_ChannelIdAPIErrorZ_clone(uint64_t orig) {
23916         LDKCResult_ChannelIdAPIErrorZ* orig_conv = (LDKCResult_ChannelIdAPIErrorZ*)untag_ptr(orig);
23917         LDKCResult_ChannelIdAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdAPIErrorZ), "LDKCResult_ChannelIdAPIErrorZ");
23918         *ret_conv = CResult_ChannelIdAPIErrorZ_clone(orig_conv);
23919         return tag_ptr(ret_conv, true);
23920 }
23921
23922 void  __attribute__((export_name("TS_CVec_RecentPaymentDetailsZ_free"))) TS_CVec_RecentPaymentDetailsZ_free(uint64_tArray _res) {
23923         LDKCVec_RecentPaymentDetailsZ _res_constr;
23924         _res_constr.datalen = _res->arr_len;
23925         if (_res_constr.datalen > 0)
23926                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRecentPaymentDetails), "LDKCVec_RecentPaymentDetailsZ Elements");
23927         else
23928                 _res_constr.data = NULL;
23929         uint64_t* _res_vals = _res->elems;
23930         for (size_t w = 0; w < _res_constr.datalen; w++) {
23931                 uint64_t _res_conv_22 = _res_vals[w];
23932                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
23933                 CHECK_ACCESS(_res_conv_22_ptr);
23934                 LDKRecentPaymentDetails _res_conv_22_conv = *(LDKRecentPaymentDetails*)(_res_conv_22_ptr);
23935                 FREE(untag_ptr(_res_conv_22));
23936                 _res_constr.data[w] = _res_conv_22_conv;
23937         }
23938         FREE(_res);
23939         CVec_RecentPaymentDetailsZ_free(_res_constr);
23940 }
23941
23942 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_ok"))) TS_CResult_NonePaymentSendFailureZ_ok() {
23943         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
23944         *ret_conv = CResult_NonePaymentSendFailureZ_ok();
23945         return tag_ptr(ret_conv, true);
23946 }
23947
23948 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_err"))) TS_CResult_NonePaymentSendFailureZ_err(uint64_t e) {
23949         void* e_ptr = untag_ptr(e);
23950         CHECK_ACCESS(e_ptr);
23951         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
23952         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
23953         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
23954         *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
23955         return tag_ptr(ret_conv, true);
23956 }
23957
23958 jboolean  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_is_ok"))) TS_CResult_NonePaymentSendFailureZ_is_ok(uint64_t o) {
23959         LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(o);
23960         jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
23961         return ret_conv;
23962 }
23963
23964 void  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_free"))) TS_CResult_NonePaymentSendFailureZ_free(uint64_t _res) {
23965         if (!ptr_is_owned(_res)) return;
23966         void* _res_ptr = untag_ptr(_res);
23967         CHECK_ACCESS(_res_ptr);
23968         LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
23969         FREE(untag_ptr(_res));
23970         CResult_NonePaymentSendFailureZ_free(_res_conv);
23971 }
23972
23973 static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
23974         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
23975         *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
23976         return tag_ptr(ret_conv, true);
23977 }
23978 int64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone_ptr"))) TS_CResult_NonePaymentSendFailureZ_clone_ptr(uint64_t arg) {
23979         LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(arg);
23980         int64_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
23981         return ret_conv;
23982 }
23983
23984 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone"))) TS_CResult_NonePaymentSendFailureZ_clone(uint64_t orig) {
23985         LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(orig);
23986         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
23987         *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
23988         return tag_ptr(ret_conv, true);
23989 }
23990
23991 uint64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_ok"))) TS_CResult_NoneRetryableSendFailureZ_ok() {
23992         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
23993         *ret_conv = CResult_NoneRetryableSendFailureZ_ok();
23994         return tag_ptr(ret_conv, true);
23995 }
23996
23997 uint64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_err"))) TS_CResult_NoneRetryableSendFailureZ_err(uint32_t e) {
23998         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_js(e);
23999         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
24000         *ret_conv = CResult_NoneRetryableSendFailureZ_err(e_conv);
24001         return tag_ptr(ret_conv, true);
24002 }
24003
24004 jboolean  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_is_ok"))) TS_CResult_NoneRetryableSendFailureZ_is_ok(uint64_t o) {
24005         LDKCResult_NoneRetryableSendFailureZ* o_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(o);
24006         jboolean ret_conv = CResult_NoneRetryableSendFailureZ_is_ok(o_conv);
24007         return ret_conv;
24008 }
24009
24010 void  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_free"))) TS_CResult_NoneRetryableSendFailureZ_free(uint64_t _res) {
24011         if (!ptr_is_owned(_res)) return;
24012         void* _res_ptr = untag_ptr(_res);
24013         CHECK_ACCESS(_res_ptr);
24014         LDKCResult_NoneRetryableSendFailureZ _res_conv = *(LDKCResult_NoneRetryableSendFailureZ*)(_res_ptr);
24015         FREE(untag_ptr(_res));
24016         CResult_NoneRetryableSendFailureZ_free(_res_conv);
24017 }
24018
24019 static inline uint64_t CResult_NoneRetryableSendFailureZ_clone_ptr(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR arg) {
24020         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
24021         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(arg);
24022         return tag_ptr(ret_conv, true);
24023 }
24024 int64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_clone_ptr"))) TS_CResult_NoneRetryableSendFailureZ_clone_ptr(uint64_t arg) {
24025         LDKCResult_NoneRetryableSendFailureZ* arg_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(arg);
24026         int64_t ret_conv = CResult_NoneRetryableSendFailureZ_clone_ptr(arg_conv);
24027         return ret_conv;
24028 }
24029
24030 uint64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_clone"))) TS_CResult_NoneRetryableSendFailureZ_clone(uint64_t orig) {
24031         LDKCResult_NoneRetryableSendFailureZ* orig_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(orig);
24032         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
24033         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(orig_conv);
24034         return tag_ptr(ret_conv, true);
24035 }
24036
24037 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_ok"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(int8_tArray o) {
24038         LDKThirtyTwoBytes o_ref;
24039         CHECK(o->arr_len == 32);
24040         memcpy(o_ref.data, o->elems, 32); FREE(o);
24041         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
24042         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(o_ref);
24043         return tag_ptr(ret_conv, true);
24044 }
24045
24046 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_err"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_err(uint64_t e) {
24047         void* e_ptr = untag_ptr(e);
24048         CHECK_ACCESS(e_ptr);
24049         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
24050         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
24051         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
24052         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_err(e_conv);
24053         return tag_ptr(ret_conv, true);
24054 }
24055
24056 jboolean  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(uint64_t o) {
24057         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* o_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(o);
24058         jboolean ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(o_conv);
24059         return ret_conv;
24060 }
24061
24062 void  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_free"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_free(uint64_t _res) {
24063         if (!ptr_is_owned(_res)) return;
24064         void* _res_ptr = untag_ptr(_res);
24065         CHECK_ACCESS(_res_ptr);
24066         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ _res_conv = *(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)(_res_ptr);
24067         FREE(untag_ptr(_res));
24068         CResult_ThirtyTwoBytesPaymentSendFailureZ_free(_res_conv);
24069 }
24070
24071 static inline uint64_t CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR arg) {
24072         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
24073         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(arg);
24074         return tag_ptr(ret_conv, true);
24075 }
24076 int64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(uint64_t arg) {
24077         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* arg_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(arg);
24078         int64_t ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(arg_conv);
24079         return ret_conv;
24080 }
24081
24082 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_clone"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(uint64_t orig) {
24083         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* orig_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(orig);
24084         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
24085         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(orig_conv);
24086         return tag_ptr(ret_conv, true);
24087 }
24088
24089 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_ok"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(int8_tArray o) {
24090         LDKThirtyTwoBytes o_ref;
24091         CHECK(o->arr_len == 32);
24092         memcpy(o_ref.data, o->elems, 32); FREE(o);
24093         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
24094         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(o_ref);
24095         return tag_ptr(ret_conv, true);
24096 }
24097
24098 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_err"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_err(uint32_t e) {
24099         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_js(e);
24100         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
24101         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_err(e_conv);
24102         return tag_ptr(ret_conv, true);
24103 }
24104
24105 jboolean  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(uint64_t o) {
24106         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* o_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(o);
24107         jboolean ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(o_conv);
24108         return ret_conv;
24109 }
24110
24111 void  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_free"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_free(uint64_t _res) {
24112         if (!ptr_is_owned(_res)) return;
24113         void* _res_ptr = untag_ptr(_res);
24114         CHECK_ACCESS(_res_ptr);
24115         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ _res_conv = *(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)(_res_ptr);
24116         FREE(untag_ptr(_res));
24117         CResult_ThirtyTwoBytesRetryableSendFailureZ_free(_res_conv);
24118 }
24119
24120 static inline uint64_t CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR arg) {
24121         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
24122         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(arg);
24123         return tag_ptr(ret_conv, true);
24124 }
24125 int64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(uint64_t arg) {
24126         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* arg_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(arg);
24127         int64_t ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(arg_conv);
24128         return ret_conv;
24129 }
24130
24131 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_clone"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(uint64_t orig) {
24132         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* orig_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(orig);
24133         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
24134         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(orig_conv);
24135         return tag_ptr(ret_conv, true);
24136 }
24137
24138 static inline uint64_t C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR arg) {
24139         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
24140         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(arg);
24141         return tag_ptr(ret_conv, true);
24142 }
24143 int64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(uint64_t arg) {
24144         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(arg);
24145         int64_t ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(arg_conv);
24146         return ret_conv;
24147 }
24148
24149 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(uint64_t orig) {
24150         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(orig);
24151         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
24152         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(orig_conv);
24153         return tag_ptr(ret_conv, true);
24154 }
24155
24156 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(int8_tArray a, int8_tArray b) {
24157         LDKThirtyTwoBytes a_ref;
24158         CHECK(a->arr_len == 32);
24159         memcpy(a_ref.data, a->elems, 32); FREE(a);
24160         LDKThirtyTwoBytes b_ref;
24161         CHECK(b->arr_len == 32);
24162         memcpy(b_ref.data, b->elems, 32); FREE(b);
24163         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
24164         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(a_ref, b_ref);
24165         return tag_ptr(ret_conv, true);
24166 }
24167
24168 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(uint64_t _res) {
24169         if (!ptr_is_owned(_res)) return;
24170         void* _res_ptr = untag_ptr(_res);
24171         CHECK_ACCESS(_res_ptr);
24172         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(_res_ptr);
24173         FREE(untag_ptr(_res));
24174         C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(_res_conv);
24175 }
24176
24177 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(uint64_t o) {
24178         void* o_ptr = untag_ptr(o);
24179         CHECK_ACCESS(o_ptr);
24180         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_ptr);
24181         o_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o));
24182         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
24183         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(o_conv);
24184         return tag_ptr(ret_conv, true);
24185 }
24186
24187 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(uint64_t e) {
24188         void* e_ptr = untag_ptr(e);
24189         CHECK_ACCESS(e_ptr);
24190         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
24191         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
24192         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
24193         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(e_conv);
24194         return tag_ptr(ret_conv, true);
24195 }
24196
24197 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(uint64_t o) {
24198         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(o);
24199         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(o_conv);
24200         return ret_conv;
24201 }
24202
24203 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(uint64_t _res) {
24204         if (!ptr_is_owned(_res)) return;
24205         void* _res_ptr = untag_ptr(_res);
24206         CHECK_ACCESS(_res_ptr);
24207         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)(_res_ptr);
24208         FREE(untag_ptr(_res));
24209         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(_res_conv);
24210 }
24211
24212 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR arg) {
24213         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
24214         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(arg);
24215         return tag_ptr(ret_conv, true);
24216 }
24217 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(uint64_t arg) {
24218         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(arg);
24219         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(arg_conv);
24220         return ret_conv;
24221 }
24222
24223 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(uint64_t orig) {
24224         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(orig);
24225         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
24226         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(orig_conv);
24227         return tag_ptr(ret_conv, true);
24228 }
24229
24230 void  __attribute__((export_name("TS_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free"))) TS_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(uint64_tArray _res) {
24231         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ _res_constr;
24232         _res_constr.datalen = _res->arr_len;
24233         if (_res_constr.datalen > 0)
24234                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ Elements");
24235         else
24236                 _res_constr.data = NULL;
24237         uint64_t* _res_vals = _res->elems;
24238         for (size_t o = 0; o < _res_constr.datalen; o++) {
24239                 uint64_t _res_conv_40 = _res_vals[o];
24240                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
24241                 CHECK_ACCESS(_res_conv_40_ptr);
24242                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(_res_conv_40_ptr);
24243                 FREE(untag_ptr(_res_conv_40));
24244                 _res_constr.data[o] = _res_conv_40_conv;
24245         }
24246         FREE(_res);
24247         CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(_res_constr);
24248 }
24249
24250 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(uint64_tArray o) {
24251         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ o_constr;
24252         o_constr.datalen = o->arr_len;
24253         if (o_constr.datalen > 0)
24254                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ Elements");
24255         else
24256                 o_constr.data = NULL;
24257         uint64_t* o_vals = o->elems;
24258         for (size_t o = 0; o < o_constr.datalen; o++) {
24259                 uint64_t o_conv_40 = o_vals[o];
24260                 void* o_conv_40_ptr = untag_ptr(o_conv_40);
24261                 CHECK_ACCESS(o_conv_40_ptr);
24262                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_conv_40_ptr);
24263                 o_conv_40_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o_conv_40));
24264                 o_constr.data[o] = o_conv_40_conv;
24265         }
24266         FREE(o);
24267         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
24268         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(o_constr);
24269         return tag_ptr(ret_conv, true);
24270 }
24271
24272 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(uint64_t e) {
24273         void* e_ptr = untag_ptr(e);
24274         CHECK_ACCESS(e_ptr);
24275         LDKProbeSendFailure e_conv = *(LDKProbeSendFailure*)(e_ptr);
24276         e_conv = ProbeSendFailure_clone((LDKProbeSendFailure*)untag_ptr(e));
24277         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
24278         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(e_conv);
24279         return tag_ptr(ret_conv, true);
24280 }
24281
24282 jboolean  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(uint64_t o) {
24283         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* o_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(o);
24284         jboolean ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(o_conv);
24285         return ret_conv;
24286 }
24287
24288 void  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(uint64_t _res) {
24289         if (!ptr_is_owned(_res)) return;
24290         void* _res_ptr = untag_ptr(_res);
24291         CHECK_ACCESS(_res_ptr);
24292         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ _res_conv = *(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)(_res_ptr);
24293         FREE(untag_ptr(_res));
24294         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(_res_conv);
24295 }
24296
24297 static inline uint64_t CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR arg) {
24298         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
24299         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(arg);
24300         return tag_ptr(ret_conv, true);
24301 }
24302 int64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(uint64_t arg) {
24303         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* arg_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(arg);
24304         int64_t ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(arg_conv);
24305         return ret_conv;
24306 }
24307
24308 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(uint64_t orig) {
24309         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* orig_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(orig);
24310         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
24311         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(orig_conv);
24312         return tag_ptr(ret_conv, true);
24313 }
24314
24315 static inline uint64_t C2Tuple_ChannelIdPublicKeyZ_clone_ptr(LDKC2Tuple_ChannelIdPublicKeyZ *NONNULL_PTR arg) {
24316         LDKC2Tuple_ChannelIdPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ChannelIdPublicKeyZ), "LDKC2Tuple_ChannelIdPublicKeyZ");
24317         *ret_conv = C2Tuple_ChannelIdPublicKeyZ_clone(arg);
24318         return tag_ptr(ret_conv, true);
24319 }
24320 int64_t  __attribute__((export_name("TS_C2Tuple_ChannelIdPublicKeyZ_clone_ptr"))) TS_C2Tuple_ChannelIdPublicKeyZ_clone_ptr(uint64_t arg) {
24321         LDKC2Tuple_ChannelIdPublicKeyZ* arg_conv = (LDKC2Tuple_ChannelIdPublicKeyZ*)untag_ptr(arg);
24322         int64_t ret_conv = C2Tuple_ChannelIdPublicKeyZ_clone_ptr(arg_conv);
24323         return ret_conv;
24324 }
24325
24326 uint64_t  __attribute__((export_name("TS_C2Tuple_ChannelIdPublicKeyZ_clone"))) TS_C2Tuple_ChannelIdPublicKeyZ_clone(uint64_t orig) {
24327         LDKC2Tuple_ChannelIdPublicKeyZ* orig_conv = (LDKC2Tuple_ChannelIdPublicKeyZ*)untag_ptr(orig);
24328         LDKC2Tuple_ChannelIdPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ChannelIdPublicKeyZ), "LDKC2Tuple_ChannelIdPublicKeyZ");
24329         *ret_conv = C2Tuple_ChannelIdPublicKeyZ_clone(orig_conv);
24330         return tag_ptr(ret_conv, true);
24331 }
24332
24333 uint64_t  __attribute__((export_name("TS_C2Tuple_ChannelIdPublicKeyZ_new"))) TS_C2Tuple_ChannelIdPublicKeyZ_new(uint64_t a, int8_tArray b) {
24334         LDKChannelId a_conv;
24335         a_conv.inner = untag_ptr(a);
24336         a_conv.is_owned = ptr_is_owned(a);
24337         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24338         a_conv = ChannelId_clone(&a_conv);
24339         LDKPublicKey b_ref;
24340         CHECK(b->arr_len == 33);
24341         memcpy(b_ref.compressed_form, b->elems, 33); FREE(b);
24342         LDKC2Tuple_ChannelIdPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ChannelIdPublicKeyZ), "LDKC2Tuple_ChannelIdPublicKeyZ");
24343         *ret_conv = C2Tuple_ChannelIdPublicKeyZ_new(a_conv, b_ref);
24344         return tag_ptr(ret_conv, true);
24345 }
24346
24347 void  __attribute__((export_name("TS_C2Tuple_ChannelIdPublicKeyZ_free"))) TS_C2Tuple_ChannelIdPublicKeyZ_free(uint64_t _res) {
24348         if (!ptr_is_owned(_res)) return;
24349         void* _res_ptr = untag_ptr(_res);
24350         CHECK_ACCESS(_res_ptr);
24351         LDKC2Tuple_ChannelIdPublicKeyZ _res_conv = *(LDKC2Tuple_ChannelIdPublicKeyZ*)(_res_ptr);
24352         FREE(untag_ptr(_res));
24353         C2Tuple_ChannelIdPublicKeyZ_free(_res_conv);
24354 }
24355
24356 void  __attribute__((export_name("TS_CVec_C2Tuple_ChannelIdPublicKeyZZ_free"))) TS_CVec_C2Tuple_ChannelIdPublicKeyZZ_free(uint64_tArray _res) {
24357         LDKCVec_C2Tuple_ChannelIdPublicKeyZZ _res_constr;
24358         _res_constr.datalen = _res->arr_len;
24359         if (_res_constr.datalen > 0)
24360                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ChannelIdPublicKeyZ), "LDKCVec_C2Tuple_ChannelIdPublicKeyZZ Elements");
24361         else
24362                 _res_constr.data = NULL;
24363         uint64_t* _res_vals = _res->elems;
24364         for (size_t e = 0; e < _res_constr.datalen; e++) {
24365                 uint64_t _res_conv_30 = _res_vals[e];
24366                 void* _res_conv_30_ptr = untag_ptr(_res_conv_30);
24367                 CHECK_ACCESS(_res_conv_30_ptr);
24368                 LDKC2Tuple_ChannelIdPublicKeyZ _res_conv_30_conv = *(LDKC2Tuple_ChannelIdPublicKeyZ*)(_res_conv_30_ptr);
24369                 FREE(untag_ptr(_res_conv_30));
24370                 _res_constr.data[e] = _res_conv_30_conv;
24371         }
24372         FREE(_res);
24373         CVec_C2Tuple_ChannelIdPublicKeyZZ_free(_res_constr);
24374 }
24375
24376 void  __attribute__((export_name("TS_CVec_ChannelIdZ_free"))) TS_CVec_ChannelIdZ_free(uint64_tArray _res) {
24377         LDKCVec_ChannelIdZ _res_constr;
24378         _res_constr.datalen = _res->arr_len;
24379         if (_res_constr.datalen > 0)
24380                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelId), "LDKCVec_ChannelIdZ Elements");
24381         else
24382                 _res_constr.data = NULL;
24383         uint64_t* _res_vals = _res->elems;
24384         for (size_t l = 0; l < _res_constr.datalen; l++) {
24385                 uint64_t _res_conv_11 = _res_vals[l];
24386                 LDKChannelId _res_conv_11_conv;
24387                 _res_conv_11_conv.inner = untag_ptr(_res_conv_11);
24388                 _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11);
24389                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
24390                 _res_constr.data[l] = _res_conv_11_conv;
24391         }
24392         FREE(_res);
24393         CVec_ChannelIdZ_free(_res_constr);
24394 }
24395
24396 uint64_t  __attribute__((export_name("TS_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_ok"))) TS_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_ok(uint64_t o) {
24397         LDKOfferWithDerivedMetadataBuilder o_conv;
24398         o_conv.inner = untag_ptr(o);
24399         o_conv.is_owned = ptr_is_owned(o);
24400         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24401         o_conv = OfferWithDerivedMetadataBuilder_clone(&o_conv);
24402         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ");
24403         *ret_conv = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_ok(o_conv);
24404         return tag_ptr(ret_conv, true);
24405 }
24406
24407 uint64_t  __attribute__((export_name("TS_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_err"))) TS_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_err(uint32_t e) {
24408         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_js(e);
24409         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ");
24410         *ret_conv = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_err(e_conv);
24411         return tag_ptr(ret_conv, true);
24412 }
24413
24414 jboolean  __attribute__((export_name("TS_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_is_ok"))) TS_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_is_ok(uint64_t o) {
24415         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* o_conv = (LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(o);
24416         jboolean ret_conv = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_is_ok(o_conv);
24417         return ret_conv;
24418 }
24419
24420 void  __attribute__((export_name("TS_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_free"))) TS_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_free(uint64_t _res) {
24421         if (!ptr_is_owned(_res)) return;
24422         void* _res_ptr = untag_ptr(_res);
24423         CHECK_ACCESS(_res_ptr);
24424         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ _res_conv = *(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ*)(_res_ptr);
24425         FREE(untag_ptr(_res));
24426         CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_free(_res_conv);
24427 }
24428
24429 static inline uint64_t CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone_ptr(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR arg) {
24430         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ");
24431         *ret_conv = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(arg);
24432         return tag_ptr(ret_conv, true);
24433 }
24434 int64_t  __attribute__((export_name("TS_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone_ptr"))) TS_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone_ptr(uint64_t arg) {
24435         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* arg_conv = (LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(arg);
24436         int64_t ret_conv = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone_ptr(arg_conv);
24437         return ret_conv;
24438 }
24439
24440 uint64_t  __attribute__((export_name("TS_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone"))) TS_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(uint64_t orig) {
24441         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* orig_conv = (LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(orig);
24442         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ");
24443         *ret_conv = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(orig_conv);
24444         return tag_ptr(ret_conv, true);
24445 }
24446
24447 uint64_t  __attribute__((export_name("TS_COption_StrZ_some"))) TS_COption_StrZ_some(jstring o) {
24448         LDKStr o_conv = str_ref_to_owned_c(o);
24449         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
24450         *ret_copy = COption_StrZ_some(o_conv);
24451         uint64_t ret_ref = tag_ptr(ret_copy, true);
24452         return ret_ref;
24453 }
24454
24455 uint64_t  __attribute__((export_name("TS_COption_StrZ_none"))) TS_COption_StrZ_none() {
24456         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
24457         *ret_copy = COption_StrZ_none();
24458         uint64_t ret_ref = tag_ptr(ret_copy, true);
24459         return ret_ref;
24460 }
24461
24462 void  __attribute__((export_name("TS_COption_StrZ_free"))) TS_COption_StrZ_free(uint64_t _res) {
24463         if (!ptr_is_owned(_res)) return;
24464         void* _res_ptr = untag_ptr(_res);
24465         CHECK_ACCESS(_res_ptr);
24466         LDKCOption_StrZ _res_conv = *(LDKCOption_StrZ*)(_res_ptr);
24467         FREE(untag_ptr(_res));
24468         COption_StrZ_free(_res_conv);
24469 }
24470
24471 static inline uint64_t COption_StrZ_clone_ptr(LDKCOption_StrZ *NONNULL_PTR arg) {
24472         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
24473         *ret_copy = COption_StrZ_clone(arg);
24474         uint64_t ret_ref = tag_ptr(ret_copy, true);
24475         return ret_ref;
24476 }
24477 int64_t  __attribute__((export_name("TS_COption_StrZ_clone_ptr"))) TS_COption_StrZ_clone_ptr(uint64_t arg) {
24478         LDKCOption_StrZ* arg_conv = (LDKCOption_StrZ*)untag_ptr(arg);
24479         int64_t ret_conv = COption_StrZ_clone_ptr(arg_conv);
24480         return ret_conv;
24481 }
24482
24483 uint64_t  __attribute__((export_name("TS_COption_StrZ_clone"))) TS_COption_StrZ_clone(uint64_t orig) {
24484         LDKCOption_StrZ* orig_conv = (LDKCOption_StrZ*)untag_ptr(orig);
24485         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
24486         *ret_copy = COption_StrZ_clone(orig_conv);
24487         uint64_t ret_ref = tag_ptr(ret_copy, true);
24488         return ret_ref;
24489 }
24490
24491 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(uint64_t o) {
24492         void* o_ptr = untag_ptr(o);
24493         CHECK_ACCESS(o_ptr);
24494         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_ptr);
24495         o_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o));
24496         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
24497         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(o_conv);
24498         return tag_ptr(ret_conv, true);
24499 }
24500
24501 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err() {
24502         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
24503         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err();
24504         return tag_ptr(ret_conv, true);
24505 }
24506
24507 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(uint64_t o) {
24508         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(o);
24509         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(o_conv);
24510         return ret_conv;
24511 }
24512
24513 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(uint64_t _res) {
24514         if (!ptr_is_owned(_res)) return;
24515         void* _res_ptr = untag_ptr(_res);
24516         CHECK_ACCESS(_res_ptr);
24517         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)(_res_ptr);
24518         FREE(untag_ptr(_res));
24519         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(_res_conv);
24520 }
24521
24522 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR arg) {
24523         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
24524         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(arg);
24525         return tag_ptr(ret_conv, true);
24526 }
24527 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(uint64_t arg) {
24528         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(arg);
24529         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(arg_conv);
24530         return ret_conv;
24531 }
24532
24533 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(uint64_t orig) {
24534         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(orig);
24535         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
24536         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(orig_conv);
24537         return tag_ptr(ret_conv, true);
24538 }
24539
24540 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_ok"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_ok(int8_tArray o) {
24541         LDKThirtyTwoBytes o_ref;
24542         CHECK(o->arr_len == 32);
24543         memcpy(o_ref.data, o->elems, 32); FREE(o);
24544         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
24545         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_ok(o_ref);
24546         return tag_ptr(ret_conv, true);
24547 }
24548
24549 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_err"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_err(uint64_t e) {
24550         void* e_ptr = untag_ptr(e);
24551         CHECK_ACCESS(e_ptr);
24552         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
24553         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
24554         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
24555         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_err(e_conv);
24556         return tag_ptr(ret_conv, true);
24557 }
24558
24559 jboolean  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_is_ok"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_is_ok(uint64_t o) {
24560         LDKCResult_ThirtyTwoBytesAPIErrorZ* o_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(o);
24561         jboolean ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_is_ok(o_conv);
24562         return ret_conv;
24563 }
24564
24565 void  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_free"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_free(uint64_t _res) {
24566         if (!ptr_is_owned(_res)) return;
24567         void* _res_ptr = untag_ptr(_res);
24568         CHECK_ACCESS(_res_ptr);
24569         LDKCResult_ThirtyTwoBytesAPIErrorZ _res_conv = *(LDKCResult_ThirtyTwoBytesAPIErrorZ*)(_res_ptr);
24570         FREE(untag_ptr(_res));
24571         CResult_ThirtyTwoBytesAPIErrorZ_free(_res_conv);
24572 }
24573
24574 static inline uint64_t CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR arg) {
24575         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
24576         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone(arg);
24577         return tag_ptr(ret_conv, true);
24578 }
24579 int64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(uint64_t arg) {
24580         LDKCResult_ThirtyTwoBytesAPIErrorZ* arg_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(arg);
24581         int64_t ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(arg_conv);
24582         return ret_conv;
24583 }
24584
24585 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_clone"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_clone(uint64_t orig) {
24586         LDKCResult_ThirtyTwoBytesAPIErrorZ* orig_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(orig);
24587         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
24588         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone(orig_conv);
24589         return tag_ptr(ret_conv, true);
24590 }
24591
24592 uint64_t  __attribute__((export_name("TS_COption_OffersMessageZ_some"))) TS_COption_OffersMessageZ_some(uint64_t o) {
24593         void* o_ptr = untag_ptr(o);
24594         CHECK_ACCESS(o_ptr);
24595         LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr);
24596         o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o));
24597         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
24598         *ret_copy = COption_OffersMessageZ_some(o_conv);
24599         uint64_t ret_ref = tag_ptr(ret_copy, true);
24600         return ret_ref;
24601 }
24602
24603 uint64_t  __attribute__((export_name("TS_COption_OffersMessageZ_none"))) TS_COption_OffersMessageZ_none() {
24604         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
24605         *ret_copy = COption_OffersMessageZ_none();
24606         uint64_t ret_ref = tag_ptr(ret_copy, true);
24607         return ret_ref;
24608 }
24609
24610 void  __attribute__((export_name("TS_COption_OffersMessageZ_free"))) TS_COption_OffersMessageZ_free(uint64_t _res) {
24611         if (!ptr_is_owned(_res)) return;
24612         void* _res_ptr = untag_ptr(_res);
24613         CHECK_ACCESS(_res_ptr);
24614         LDKCOption_OffersMessageZ _res_conv = *(LDKCOption_OffersMessageZ*)(_res_ptr);
24615         FREE(untag_ptr(_res));
24616         COption_OffersMessageZ_free(_res_conv);
24617 }
24618
24619 static inline uint64_t COption_OffersMessageZ_clone_ptr(LDKCOption_OffersMessageZ *NONNULL_PTR arg) {
24620         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
24621         *ret_copy = COption_OffersMessageZ_clone(arg);
24622         uint64_t ret_ref = tag_ptr(ret_copy, true);
24623         return ret_ref;
24624 }
24625 int64_t  __attribute__((export_name("TS_COption_OffersMessageZ_clone_ptr"))) TS_COption_OffersMessageZ_clone_ptr(uint64_t arg) {
24626         LDKCOption_OffersMessageZ* arg_conv = (LDKCOption_OffersMessageZ*)untag_ptr(arg);
24627         int64_t ret_conv = COption_OffersMessageZ_clone_ptr(arg_conv);
24628         return ret_conv;
24629 }
24630
24631 uint64_t  __attribute__((export_name("TS_COption_OffersMessageZ_clone"))) TS_COption_OffersMessageZ_clone(uint64_t orig) {
24632         LDKCOption_OffersMessageZ* orig_conv = (LDKCOption_OffersMessageZ*)untag_ptr(orig);
24633         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
24634         *ret_copy = COption_OffersMessageZ_clone(orig_conv);
24635         uint64_t ret_ref = tag_ptr(ret_copy, true);
24636         return ret_ref;
24637 }
24638
24639 static inline uint64_t C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR arg) {
24640         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
24641         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(arg);
24642         return tag_ptr(ret_conv, true);
24643 }
24644 int64_t  __attribute__((export_name("TS_C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr"))) TS_C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr(uint64_t arg) {
24645         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* arg_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(arg);
24646         int64_t ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr(arg_conv);
24647         return ret_conv;
24648 }
24649
24650 uint64_t  __attribute__((export_name("TS_C3Tuple_OffersMessageDestinationBlindedPathZ_clone"))) TS_C3Tuple_OffersMessageDestinationBlindedPathZ_clone(uint64_t orig) {
24651         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* orig_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(orig);
24652         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
24653         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(orig_conv);
24654         return tag_ptr(ret_conv, true);
24655 }
24656
24657 uint64_t  __attribute__((export_name("TS_C3Tuple_OffersMessageDestinationBlindedPathZ_new"))) TS_C3Tuple_OffersMessageDestinationBlindedPathZ_new(uint64_t a, uint64_t b, uint64_t c) {
24658         void* a_ptr = untag_ptr(a);
24659         CHECK_ACCESS(a_ptr);
24660         LDKOffersMessage a_conv = *(LDKOffersMessage*)(a_ptr);
24661         a_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(a));
24662         void* b_ptr = untag_ptr(b);
24663         CHECK_ACCESS(b_ptr);
24664         LDKDestination b_conv = *(LDKDestination*)(b_ptr);
24665         b_conv = Destination_clone((LDKDestination*)untag_ptr(b));
24666         LDKBlindedPath c_conv;
24667         c_conv.inner = untag_ptr(c);
24668         c_conv.is_owned = ptr_is_owned(c);
24669         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
24670         c_conv = BlindedPath_clone(&c_conv);
24671         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
24672         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_new(a_conv, b_conv, c_conv);
24673         return tag_ptr(ret_conv, true);
24674 }
24675
24676 void  __attribute__((export_name("TS_C3Tuple_OffersMessageDestinationBlindedPathZ_free"))) TS_C3Tuple_OffersMessageDestinationBlindedPathZ_free(uint64_t _res) {
24677         if (!ptr_is_owned(_res)) return;
24678         void* _res_ptr = untag_ptr(_res);
24679         CHECK_ACCESS(_res_ptr);
24680         LDKC3Tuple_OffersMessageDestinationBlindedPathZ _res_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(_res_ptr);
24681         FREE(untag_ptr(_res));
24682         C3Tuple_OffersMessageDestinationBlindedPathZ_free(_res_conv);
24683 }
24684
24685 void  __attribute__((export_name("TS_CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free"))) TS_CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free(uint64_tArray _res) {
24686         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ _res_constr;
24687         _res_constr.datalen = _res->arr_len;
24688         if (_res_constr.datalen > 0)
24689                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ Elements");
24690         else
24691                 _res_constr.data = NULL;
24692         uint64_t* _res_vals = _res->elems;
24693         for (size_t x = 0; x < _res_constr.datalen; x++) {
24694                 uint64_t _res_conv_49 = _res_vals[x];
24695                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
24696                 CHECK_ACCESS(_res_conv_49_ptr);
24697                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ _res_conv_49_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(_res_conv_49_ptr);
24698                 FREE(untag_ptr(_res_conv_49));
24699                 _res_constr.data[x] = _res_conv_49_conv;
24700         }
24701         FREE(_res);
24702         CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free(_res_constr);
24703 }
24704
24705 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(uint64_t o) {
24706         LDKCounterpartyForwardingInfo o_conv;
24707         o_conv.inner = untag_ptr(o);
24708         o_conv.is_owned = ptr_is_owned(o);
24709         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24710         o_conv = CounterpartyForwardingInfo_clone(&o_conv);
24711         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
24712         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
24713         return tag_ptr(ret_conv, true);
24714 }
24715
24716 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err(uint64_t e) {
24717         void* e_ptr = untag_ptr(e);
24718         CHECK_ACCESS(e_ptr);
24719         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24720         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24721         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
24722         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
24723         return tag_ptr(ret_conv, true);
24724 }
24725
24726 jboolean  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(uint64_t o) {
24727         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(o);
24728         jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
24729         return ret_conv;
24730 }
24731
24732 void  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free(uint64_t _res) {
24733         if (!ptr_is_owned(_res)) return;
24734         void* _res_ptr = untag_ptr(_res);
24735         CHECK_ACCESS(_res_ptr);
24736         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
24737         FREE(untag_ptr(_res));
24738         CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
24739 }
24740
24741 static inline uint64_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
24742         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
24743         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
24744         return tag_ptr(ret_conv, true);
24745 }
24746 int64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
24747         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(arg);
24748         int64_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
24749         return ret_conv;
24750 }
24751
24752 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(uint64_t orig) {
24753         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(orig);
24754         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
24755         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
24756         return tag_ptr(ret_conv, true);
24757 }
24758
24759 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_ok(uint64_t o) {
24760         LDKChannelCounterparty o_conv;
24761         o_conv.inner = untag_ptr(o);
24762         o_conv.is_owned = ptr_is_owned(o);
24763         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24764         o_conv = ChannelCounterparty_clone(&o_conv);
24765         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
24766         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
24767         return tag_ptr(ret_conv, true);
24768 }
24769
24770 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_err(uint64_t e) {
24771         void* e_ptr = untag_ptr(e);
24772         CHECK_ACCESS(e_ptr);
24773         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24774         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24775         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
24776         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
24777         return tag_ptr(ret_conv, true);
24778 }
24779
24780 jboolean  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok(uint64_t o) {
24781         LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(o);
24782         jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
24783         return ret_conv;
24784 }
24785
24786 void  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_free"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_free(uint64_t _res) {
24787         if (!ptr_is_owned(_res)) return;
24788         void* _res_ptr = untag_ptr(_res);
24789         CHECK_ACCESS(_res_ptr);
24790         LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
24791         FREE(untag_ptr(_res));
24792         CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
24793 }
24794
24795 static inline uint64_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
24796         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
24797         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
24798         return tag_ptr(ret_conv, true);
24799 }
24800 int64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(uint64_t arg) {
24801         LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(arg);
24802         int64_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
24803         return ret_conv;
24804 }
24805
24806 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone(uint64_t orig) {
24807         LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(orig);
24808         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
24809         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
24810         return tag_ptr(ret_conv, true);
24811 }
24812
24813 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_ok(uint64_t o) {
24814         LDKChannelDetails o_conv;
24815         o_conv.inner = untag_ptr(o);
24816         o_conv.is_owned = ptr_is_owned(o);
24817         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24818         o_conv = ChannelDetails_clone(&o_conv);
24819         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
24820         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
24821         return tag_ptr(ret_conv, true);
24822 }
24823
24824 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_err(uint64_t e) {
24825         void* e_ptr = untag_ptr(e);
24826         CHECK_ACCESS(e_ptr);
24827         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24828         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24829         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
24830         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
24831         return tag_ptr(ret_conv, true);
24832 }
24833
24834 jboolean  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_is_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_is_ok(uint64_t o) {
24835         LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(o);
24836         jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
24837         return ret_conv;
24838 }
24839
24840 void  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_free"))) TS_CResult_ChannelDetailsDecodeErrorZ_free(uint64_t _res) {
24841         if (!ptr_is_owned(_res)) return;
24842         void* _res_ptr = untag_ptr(_res);
24843         CHECK_ACCESS(_res_ptr);
24844         LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
24845         FREE(untag_ptr(_res));
24846         CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
24847 }
24848
24849 static inline uint64_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
24850         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
24851         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
24852         return tag_ptr(ret_conv, true);
24853 }
24854 int64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr(uint64_t arg) {
24855         LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(arg);
24856         int64_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
24857         return ret_conv;
24858 }
24859
24860 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone(uint64_t orig) {
24861         LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(orig);
24862         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
24863         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
24864         return tag_ptr(ret_conv, true);
24865 }
24866
24867 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_ok(uint64_t o) {
24868         LDKPhantomRouteHints o_conv;
24869         o_conv.inner = untag_ptr(o);
24870         o_conv.is_owned = ptr_is_owned(o);
24871         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24872         o_conv = PhantomRouteHints_clone(&o_conv);
24873         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
24874         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
24875         return tag_ptr(ret_conv, true);
24876 }
24877
24878 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_err(uint64_t e) {
24879         void* e_ptr = untag_ptr(e);
24880         CHECK_ACCESS(e_ptr);
24881         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24882         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24883         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
24884         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
24885         return tag_ptr(ret_conv, true);
24886 }
24887
24888 jboolean  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok(uint64_t o) {
24889         LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(o);
24890         jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
24891         return ret_conv;
24892 }
24893
24894 void  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_free"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_free(uint64_t _res) {
24895         if (!ptr_is_owned(_res)) return;
24896         void* _res_ptr = untag_ptr(_res);
24897         CHECK_ACCESS(_res_ptr);
24898         LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
24899         FREE(untag_ptr(_res));
24900         CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
24901 }
24902
24903 static inline uint64_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
24904         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
24905         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
24906         return tag_ptr(ret_conv, true);
24907 }
24908 int64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(uint64_t arg) {
24909         LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(arg);
24910         int64_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
24911         return ret_conv;
24912 }
24913
24914 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone(uint64_t orig) {
24915         LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(orig);
24916         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
24917         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
24918         return tag_ptr(ret_conv, true);
24919 }
24920
24921 uint64_t  __attribute__((export_name("TS_CResult_BlindedForwardDecodeErrorZ_ok"))) TS_CResult_BlindedForwardDecodeErrorZ_ok(uint64_t o) {
24922         LDKBlindedForward o_conv;
24923         o_conv.inner = untag_ptr(o);
24924         o_conv.is_owned = ptr_is_owned(o);
24925         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24926         o_conv = BlindedForward_clone(&o_conv);
24927         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
24928         *ret_conv = CResult_BlindedForwardDecodeErrorZ_ok(o_conv);
24929         return tag_ptr(ret_conv, true);
24930 }
24931
24932 uint64_t  __attribute__((export_name("TS_CResult_BlindedForwardDecodeErrorZ_err"))) TS_CResult_BlindedForwardDecodeErrorZ_err(uint64_t e) {
24933         void* e_ptr = untag_ptr(e);
24934         CHECK_ACCESS(e_ptr);
24935         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24936         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24937         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
24938         *ret_conv = CResult_BlindedForwardDecodeErrorZ_err(e_conv);
24939         return tag_ptr(ret_conv, true);
24940 }
24941
24942 jboolean  __attribute__((export_name("TS_CResult_BlindedForwardDecodeErrorZ_is_ok"))) TS_CResult_BlindedForwardDecodeErrorZ_is_ok(uint64_t o) {
24943         LDKCResult_BlindedForwardDecodeErrorZ* o_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(o);
24944         jboolean ret_conv = CResult_BlindedForwardDecodeErrorZ_is_ok(o_conv);
24945         return ret_conv;
24946 }
24947
24948 void  __attribute__((export_name("TS_CResult_BlindedForwardDecodeErrorZ_free"))) TS_CResult_BlindedForwardDecodeErrorZ_free(uint64_t _res) {
24949         if (!ptr_is_owned(_res)) return;
24950         void* _res_ptr = untag_ptr(_res);
24951         CHECK_ACCESS(_res_ptr);
24952         LDKCResult_BlindedForwardDecodeErrorZ _res_conv = *(LDKCResult_BlindedForwardDecodeErrorZ*)(_res_ptr);
24953         FREE(untag_ptr(_res));
24954         CResult_BlindedForwardDecodeErrorZ_free(_res_conv);
24955 }
24956
24957 static inline uint64_t CResult_BlindedForwardDecodeErrorZ_clone_ptr(LDKCResult_BlindedForwardDecodeErrorZ *NONNULL_PTR arg) {
24958         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
24959         *ret_conv = CResult_BlindedForwardDecodeErrorZ_clone(arg);
24960         return tag_ptr(ret_conv, true);
24961 }
24962 int64_t  __attribute__((export_name("TS_CResult_BlindedForwardDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedForwardDecodeErrorZ_clone_ptr(uint64_t arg) {
24963         LDKCResult_BlindedForwardDecodeErrorZ* arg_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(arg);
24964         int64_t ret_conv = CResult_BlindedForwardDecodeErrorZ_clone_ptr(arg_conv);
24965         return ret_conv;
24966 }
24967
24968 uint64_t  __attribute__((export_name("TS_CResult_BlindedForwardDecodeErrorZ_clone"))) TS_CResult_BlindedForwardDecodeErrorZ_clone(uint64_t orig) {
24969         LDKCResult_BlindedForwardDecodeErrorZ* orig_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(orig);
24970         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
24971         *ret_conv = CResult_BlindedForwardDecodeErrorZ_clone(orig_conv);
24972         return tag_ptr(ret_conv, true);
24973 }
24974
24975 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCRoutingDecodeErrorZ_ok"))) TS_CResult_PendingHTLCRoutingDecodeErrorZ_ok(uint64_t o) {
24976         void* o_ptr = untag_ptr(o);
24977         CHECK_ACCESS(o_ptr);
24978         LDKPendingHTLCRouting o_conv = *(LDKPendingHTLCRouting*)(o_ptr);
24979         o_conv = PendingHTLCRouting_clone((LDKPendingHTLCRouting*)untag_ptr(o));
24980         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
24981         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_ok(o_conv);
24982         return tag_ptr(ret_conv, true);
24983 }
24984
24985 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCRoutingDecodeErrorZ_err"))) TS_CResult_PendingHTLCRoutingDecodeErrorZ_err(uint64_t e) {
24986         void* e_ptr = untag_ptr(e);
24987         CHECK_ACCESS(e_ptr);
24988         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24989         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24990         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
24991         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_err(e_conv);
24992         return tag_ptr(ret_conv, true);
24993 }
24994
24995 jboolean  __attribute__((export_name("TS_CResult_PendingHTLCRoutingDecodeErrorZ_is_ok"))) TS_CResult_PendingHTLCRoutingDecodeErrorZ_is_ok(uint64_t o) {
24996         LDKCResult_PendingHTLCRoutingDecodeErrorZ* o_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(o);
24997         jboolean ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_is_ok(o_conv);
24998         return ret_conv;
24999 }
25000
25001 void  __attribute__((export_name("TS_CResult_PendingHTLCRoutingDecodeErrorZ_free"))) TS_CResult_PendingHTLCRoutingDecodeErrorZ_free(uint64_t _res) {
25002         if (!ptr_is_owned(_res)) return;
25003         void* _res_ptr = untag_ptr(_res);
25004         CHECK_ACCESS(_res_ptr);
25005         LDKCResult_PendingHTLCRoutingDecodeErrorZ _res_conv = *(LDKCResult_PendingHTLCRoutingDecodeErrorZ*)(_res_ptr);
25006         FREE(untag_ptr(_res));
25007         CResult_PendingHTLCRoutingDecodeErrorZ_free(_res_conv);
25008 }
25009
25010 static inline uint64_t CResult_PendingHTLCRoutingDecodeErrorZ_clone_ptr(LDKCResult_PendingHTLCRoutingDecodeErrorZ *NONNULL_PTR arg) {
25011         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
25012         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_clone(arg);
25013         return tag_ptr(ret_conv, true);
25014 }
25015 int64_t  __attribute__((export_name("TS_CResult_PendingHTLCRoutingDecodeErrorZ_clone_ptr"))) TS_CResult_PendingHTLCRoutingDecodeErrorZ_clone_ptr(uint64_t arg) {
25016         LDKCResult_PendingHTLCRoutingDecodeErrorZ* arg_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(arg);
25017         int64_t ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_clone_ptr(arg_conv);
25018         return ret_conv;
25019 }
25020
25021 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCRoutingDecodeErrorZ_clone"))) TS_CResult_PendingHTLCRoutingDecodeErrorZ_clone(uint64_t orig) {
25022         LDKCResult_PendingHTLCRoutingDecodeErrorZ* orig_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(orig);
25023         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
25024         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_clone(orig_conv);
25025         return tag_ptr(ret_conv, true);
25026 }
25027
25028 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoDecodeErrorZ_ok"))) TS_CResult_PendingHTLCInfoDecodeErrorZ_ok(uint64_t o) {
25029         LDKPendingHTLCInfo o_conv;
25030         o_conv.inner = untag_ptr(o);
25031         o_conv.is_owned = ptr_is_owned(o);
25032         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25033         o_conv = PendingHTLCInfo_clone(&o_conv);
25034         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
25035         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_ok(o_conv);
25036         return tag_ptr(ret_conv, true);
25037 }
25038
25039 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoDecodeErrorZ_err"))) TS_CResult_PendingHTLCInfoDecodeErrorZ_err(uint64_t e) {
25040         void* e_ptr = untag_ptr(e);
25041         CHECK_ACCESS(e_ptr);
25042         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25043         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25044         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
25045         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_err(e_conv);
25046         return tag_ptr(ret_conv, true);
25047 }
25048
25049 jboolean  __attribute__((export_name("TS_CResult_PendingHTLCInfoDecodeErrorZ_is_ok"))) TS_CResult_PendingHTLCInfoDecodeErrorZ_is_ok(uint64_t o) {
25050         LDKCResult_PendingHTLCInfoDecodeErrorZ* o_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(o);
25051         jboolean ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_is_ok(o_conv);
25052         return ret_conv;
25053 }
25054
25055 void  __attribute__((export_name("TS_CResult_PendingHTLCInfoDecodeErrorZ_free"))) TS_CResult_PendingHTLCInfoDecodeErrorZ_free(uint64_t _res) {
25056         if (!ptr_is_owned(_res)) return;
25057         void* _res_ptr = untag_ptr(_res);
25058         CHECK_ACCESS(_res_ptr);
25059         LDKCResult_PendingHTLCInfoDecodeErrorZ _res_conv = *(LDKCResult_PendingHTLCInfoDecodeErrorZ*)(_res_ptr);
25060         FREE(untag_ptr(_res));
25061         CResult_PendingHTLCInfoDecodeErrorZ_free(_res_conv);
25062 }
25063
25064 static inline uint64_t CResult_PendingHTLCInfoDecodeErrorZ_clone_ptr(LDKCResult_PendingHTLCInfoDecodeErrorZ *NONNULL_PTR arg) {
25065         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
25066         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_clone(arg);
25067         return tag_ptr(ret_conv, true);
25068 }
25069 int64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoDecodeErrorZ_clone_ptr"))) TS_CResult_PendingHTLCInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
25070         LDKCResult_PendingHTLCInfoDecodeErrorZ* arg_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(arg);
25071         int64_t ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_clone_ptr(arg_conv);
25072         return ret_conv;
25073 }
25074
25075 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoDecodeErrorZ_clone"))) TS_CResult_PendingHTLCInfoDecodeErrorZ_clone(uint64_t orig) {
25076         LDKCResult_PendingHTLCInfoDecodeErrorZ* orig_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(orig);
25077         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
25078         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_clone(orig_conv);
25079         return tag_ptr(ret_conv, true);
25080 }
25081
25082 uint64_t  __attribute__((export_name("TS_CResult_BlindedFailureDecodeErrorZ_ok"))) TS_CResult_BlindedFailureDecodeErrorZ_ok(uint32_t o) {
25083         LDKBlindedFailure o_conv = LDKBlindedFailure_from_js(o);
25084         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
25085         *ret_conv = CResult_BlindedFailureDecodeErrorZ_ok(o_conv);
25086         return tag_ptr(ret_conv, true);
25087 }
25088
25089 uint64_t  __attribute__((export_name("TS_CResult_BlindedFailureDecodeErrorZ_err"))) TS_CResult_BlindedFailureDecodeErrorZ_err(uint64_t e) {
25090         void* e_ptr = untag_ptr(e);
25091         CHECK_ACCESS(e_ptr);
25092         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25093         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25094         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
25095         *ret_conv = CResult_BlindedFailureDecodeErrorZ_err(e_conv);
25096         return tag_ptr(ret_conv, true);
25097 }
25098
25099 jboolean  __attribute__((export_name("TS_CResult_BlindedFailureDecodeErrorZ_is_ok"))) TS_CResult_BlindedFailureDecodeErrorZ_is_ok(uint64_t o) {
25100         LDKCResult_BlindedFailureDecodeErrorZ* o_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(o);
25101         jboolean ret_conv = CResult_BlindedFailureDecodeErrorZ_is_ok(o_conv);
25102         return ret_conv;
25103 }
25104
25105 void  __attribute__((export_name("TS_CResult_BlindedFailureDecodeErrorZ_free"))) TS_CResult_BlindedFailureDecodeErrorZ_free(uint64_t _res) {
25106         if (!ptr_is_owned(_res)) return;
25107         void* _res_ptr = untag_ptr(_res);
25108         CHECK_ACCESS(_res_ptr);
25109         LDKCResult_BlindedFailureDecodeErrorZ _res_conv = *(LDKCResult_BlindedFailureDecodeErrorZ*)(_res_ptr);
25110         FREE(untag_ptr(_res));
25111         CResult_BlindedFailureDecodeErrorZ_free(_res_conv);
25112 }
25113
25114 static inline uint64_t CResult_BlindedFailureDecodeErrorZ_clone_ptr(LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR arg) {
25115         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
25116         *ret_conv = CResult_BlindedFailureDecodeErrorZ_clone(arg);
25117         return tag_ptr(ret_conv, true);
25118 }
25119 int64_t  __attribute__((export_name("TS_CResult_BlindedFailureDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedFailureDecodeErrorZ_clone_ptr(uint64_t arg) {
25120         LDKCResult_BlindedFailureDecodeErrorZ* arg_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(arg);
25121         int64_t ret_conv = CResult_BlindedFailureDecodeErrorZ_clone_ptr(arg_conv);
25122         return ret_conv;
25123 }
25124
25125 uint64_t  __attribute__((export_name("TS_CResult_BlindedFailureDecodeErrorZ_clone"))) TS_CResult_BlindedFailureDecodeErrorZ_clone(uint64_t orig) {
25126         LDKCResult_BlindedFailureDecodeErrorZ* orig_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(orig);
25127         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
25128         *ret_conv = CResult_BlindedFailureDecodeErrorZ_clone(orig_conv);
25129         return tag_ptr(ret_conv, true);
25130 }
25131
25132 uint64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_ok"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_ok(uint32_t o) {
25133         LDKChannelShutdownState o_conv = LDKChannelShutdownState_from_js(o);
25134         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
25135         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_ok(o_conv);
25136         return tag_ptr(ret_conv, true);
25137 }
25138
25139 uint64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_err"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_err(uint64_t e) {
25140         void* e_ptr = untag_ptr(e);
25141         CHECK_ACCESS(e_ptr);
25142         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25143         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25144         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
25145         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_err(e_conv);
25146         return tag_ptr(ret_conv, true);
25147 }
25148
25149 jboolean  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_is_ok"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_is_ok(uint64_t o) {
25150         LDKCResult_ChannelShutdownStateDecodeErrorZ* o_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(o);
25151         jboolean ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_is_ok(o_conv);
25152         return ret_conv;
25153 }
25154
25155 void  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_free"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_free(uint64_t _res) {
25156         if (!ptr_is_owned(_res)) return;
25157         void* _res_ptr = untag_ptr(_res);
25158         CHECK_ACCESS(_res_ptr);
25159         LDKCResult_ChannelShutdownStateDecodeErrorZ _res_conv = *(LDKCResult_ChannelShutdownStateDecodeErrorZ*)(_res_ptr);
25160         FREE(untag_ptr(_res));
25161         CResult_ChannelShutdownStateDecodeErrorZ_free(_res_conv);
25162 }
25163
25164 static inline uint64_t CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR arg) {
25165         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
25166         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone(arg);
25167         return tag_ptr(ret_conv, true);
25168 }
25169 int64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(uint64_t arg) {
25170         LDKCResult_ChannelShutdownStateDecodeErrorZ* arg_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(arg);
25171         int64_t ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(arg_conv);
25172         return ret_conv;
25173 }
25174
25175 uint64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_clone"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_clone(uint64_t orig) {
25176         LDKCResult_ChannelShutdownStateDecodeErrorZ* orig_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(orig);
25177         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
25178         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone(orig_conv);
25179         return tag_ptr(ret_conv, true);
25180 }
25181
25182 void  __attribute__((export_name("TS_CVec_ChannelMonitorZ_free"))) TS_CVec_ChannelMonitorZ_free(uint64_tArray _res) {
25183         LDKCVec_ChannelMonitorZ _res_constr;
25184         _res_constr.datalen = _res->arr_len;
25185         if (_res_constr.datalen > 0)
25186                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
25187         else
25188                 _res_constr.data = NULL;
25189         uint64_t* _res_vals = _res->elems;
25190         for (size_t q = 0; q < _res_constr.datalen; q++) {
25191                 uint64_t _res_conv_16 = _res_vals[q];
25192                 LDKChannelMonitor _res_conv_16_conv;
25193                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
25194                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
25195                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
25196                 _res_constr.data[q] = _res_conv_16_conv;
25197         }
25198         FREE(_res);
25199         CVec_ChannelMonitorZ_free(_res_constr);
25200 }
25201
25202 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_new"))) TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_new(int8_tArray a, uint64_t b) {
25203         LDKThirtyTwoBytes a_ref;
25204         CHECK(a->arr_len == 32);
25205         memcpy(a_ref.data, a->elems, 32); FREE(a);
25206         LDKChannelManager b_conv;
25207         b_conv.inner = untag_ptr(b);
25208         b_conv.is_owned = ptr_is_owned(b);
25209         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
25210         // WARNING: we need a move here but no clone is available for LDKChannelManager
25211         
25212         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ), "LDKC2Tuple_ThirtyTwoBytesChannelManagerZ");
25213         *ret_conv = C2Tuple_ThirtyTwoBytesChannelManagerZ_new(a_ref, b_conv);
25214         return tag_ptr(ret_conv, true);
25215 }
25216
25217 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_free"))) TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_free(uint64_t _res) {
25218         if (!ptr_is_owned(_res)) return;
25219         void* _res_ptr = untag_ptr(_res);
25220         CHECK_ACCESS(_res_ptr);
25221         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)(_res_ptr);
25222         FREE(untag_ptr(_res));
25223         C2Tuple_ThirtyTwoBytesChannelManagerZ_free(_res_conv);
25224 }
25225
25226 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(uint64_t o) {
25227         void* o_ptr = untag_ptr(o);
25228         CHECK_ACCESS(o_ptr);
25229         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)(o_ptr);
25230         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_ThirtyTwoBytesChannelManagerZ
25231         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
25232         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(o_conv);
25233         return tag_ptr(ret_conv, true);
25234 }
25235
25236 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(uint64_t e) {
25237         void* e_ptr = untag_ptr(e);
25238         CHECK_ACCESS(e_ptr);
25239         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25240         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25241         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
25242         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(e_conv);
25243         return tag_ptr(ret_conv, true);
25244 }
25245
25246 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(uint64_t o) {
25247         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(o);
25248         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(o_conv);
25249         return ret_conv;
25250 }
25251
25252 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(uint64_t _res) {
25253         if (!ptr_is_owned(_res)) return;
25254         void* _res_ptr = untag_ptr(_res);
25255         CHECK_ACCESS(_res_ptr);
25256         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)(_res_ptr);
25257         FREE(untag_ptr(_res));
25258         CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(_res_conv);
25259 }
25260
25261 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_ok"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_ok(uint64_t o) {
25262         void* o_ptr = untag_ptr(o);
25263         CHECK_ACCESS(o_ptr);
25264         LDKMaxDustHTLCExposure o_conv = *(LDKMaxDustHTLCExposure*)(o_ptr);
25265         o_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(o));
25266         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
25267         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_ok(o_conv);
25268         return tag_ptr(ret_conv, true);
25269 }
25270
25271 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_err"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_err(uint64_t e) {
25272         void* e_ptr = untag_ptr(e);
25273         CHECK_ACCESS(e_ptr);
25274         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25275         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25276         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
25277         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_err(e_conv);
25278         return tag_ptr(ret_conv, true);
25279 }
25280
25281 jboolean  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(uint64_t o) {
25282         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* o_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(o);
25283         jboolean ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(o_conv);
25284         return ret_conv;
25285 }
25286
25287 void  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_free"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_free(uint64_t _res) {
25288         if (!ptr_is_owned(_res)) return;
25289         void* _res_ptr = untag_ptr(_res);
25290         CHECK_ACCESS(_res_ptr);
25291         LDKCResult_MaxDustHTLCExposureDecodeErrorZ _res_conv = *(LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)(_res_ptr);
25292         FREE(untag_ptr(_res));
25293         CResult_MaxDustHTLCExposureDecodeErrorZ_free(_res_conv);
25294 }
25295
25296 static inline uint64_t CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR arg) {
25297         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
25298         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone(arg);
25299         return tag_ptr(ret_conv, true);
25300 }
25301 int64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(uint64_t arg) {
25302         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* arg_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(arg);
25303         int64_t ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(arg_conv);
25304         return ret_conv;
25305 }
25306
25307 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_clone"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_clone(uint64_t orig) {
25308         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* orig_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(orig);
25309         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
25310         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone(orig_conv);
25311         return tag_ptr(ret_conv, true);
25312 }
25313
25314 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint64_t o) {
25315         LDKChannelConfig o_conv;
25316         o_conv.inner = untag_ptr(o);
25317         o_conv.is_owned = ptr_is_owned(o);
25318         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25319         o_conv = ChannelConfig_clone(&o_conv);
25320         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
25321         *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
25322         return tag_ptr(ret_conv, true);
25323 }
25324
25325 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_err"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint64_t e) {
25326         void* e_ptr = untag_ptr(e);
25327         CHECK_ACCESS(e_ptr);
25328         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25329         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25330         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
25331         *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
25332         return tag_ptr(ret_conv, true);
25333 }
25334
25335 jboolean  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_is_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_is_ok(uint64_t o) {
25336         LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(o);
25337         jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
25338         return ret_conv;
25339 }
25340
25341 void  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_free"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint64_t _res) {
25342         if (!ptr_is_owned(_res)) return;
25343         void* _res_ptr = untag_ptr(_res);
25344         CHECK_ACCESS(_res_ptr);
25345         LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
25346         FREE(untag_ptr(_res));
25347         CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
25348 }
25349
25350 static inline uint64_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
25351         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
25352         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
25353         return tag_ptr(ret_conv, true);
25354 }
25355 int64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr(uint64_t arg) {
25356         LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(arg);
25357         int64_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
25358         return ret_conv;
25359 }
25360
25361 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint64_t orig) {
25362         LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(orig);
25363         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
25364         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
25365         return tag_ptr(ret_conv, true);
25366 }
25367
25368 uint64_t  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_some"))) TS_COption_MaxDustHTLCExposureZ_some(uint64_t o) {
25369         void* o_ptr = untag_ptr(o);
25370         CHECK_ACCESS(o_ptr);
25371         LDKMaxDustHTLCExposure o_conv = *(LDKMaxDustHTLCExposure*)(o_ptr);
25372         o_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(o));
25373         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
25374         *ret_copy = COption_MaxDustHTLCExposureZ_some(o_conv);
25375         uint64_t ret_ref = tag_ptr(ret_copy, true);
25376         return ret_ref;
25377 }
25378
25379 uint64_t  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_none"))) TS_COption_MaxDustHTLCExposureZ_none() {
25380         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
25381         *ret_copy = COption_MaxDustHTLCExposureZ_none();
25382         uint64_t ret_ref = tag_ptr(ret_copy, true);
25383         return ret_ref;
25384 }
25385
25386 void  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_free"))) TS_COption_MaxDustHTLCExposureZ_free(uint64_t _res) {
25387         if (!ptr_is_owned(_res)) return;
25388         void* _res_ptr = untag_ptr(_res);
25389         CHECK_ACCESS(_res_ptr);
25390         LDKCOption_MaxDustHTLCExposureZ _res_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(_res_ptr);
25391         FREE(untag_ptr(_res));
25392         COption_MaxDustHTLCExposureZ_free(_res_conv);
25393 }
25394
25395 static inline uint64_t COption_MaxDustHTLCExposureZ_clone_ptr(LDKCOption_MaxDustHTLCExposureZ *NONNULL_PTR arg) {
25396         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
25397         *ret_copy = COption_MaxDustHTLCExposureZ_clone(arg);
25398         uint64_t ret_ref = tag_ptr(ret_copy, true);
25399         return ret_ref;
25400 }
25401 int64_t  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_clone_ptr"))) TS_COption_MaxDustHTLCExposureZ_clone_ptr(uint64_t arg) {
25402         LDKCOption_MaxDustHTLCExposureZ* arg_conv = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(arg);
25403         int64_t ret_conv = COption_MaxDustHTLCExposureZ_clone_ptr(arg_conv);
25404         return ret_conv;
25405 }
25406
25407 uint64_t  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_clone"))) TS_COption_MaxDustHTLCExposureZ_clone(uint64_t orig) {
25408         LDKCOption_MaxDustHTLCExposureZ* orig_conv = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(orig);
25409         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
25410         *ret_copy = COption_MaxDustHTLCExposureZ_clone(orig_conv);
25411         uint64_t ret_ref = tag_ptr(ret_copy, true);
25412         return ret_ref;
25413 }
25414
25415 uint64_t  __attribute__((export_name("TS_COption_APIErrorZ_some"))) TS_COption_APIErrorZ_some(uint64_t o) {
25416         void* o_ptr = untag_ptr(o);
25417         CHECK_ACCESS(o_ptr);
25418         LDKAPIError o_conv = *(LDKAPIError*)(o_ptr);
25419         o_conv = APIError_clone((LDKAPIError*)untag_ptr(o));
25420         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
25421         *ret_copy = COption_APIErrorZ_some(o_conv);
25422         uint64_t ret_ref = tag_ptr(ret_copy, true);
25423         return ret_ref;
25424 }
25425
25426 uint64_t  __attribute__((export_name("TS_COption_APIErrorZ_none"))) TS_COption_APIErrorZ_none() {
25427         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
25428         *ret_copy = COption_APIErrorZ_none();
25429         uint64_t ret_ref = tag_ptr(ret_copy, true);
25430         return ret_ref;
25431 }
25432
25433 void  __attribute__((export_name("TS_COption_APIErrorZ_free"))) TS_COption_APIErrorZ_free(uint64_t _res) {
25434         if (!ptr_is_owned(_res)) return;
25435         void* _res_ptr = untag_ptr(_res);
25436         CHECK_ACCESS(_res_ptr);
25437         LDKCOption_APIErrorZ _res_conv = *(LDKCOption_APIErrorZ*)(_res_ptr);
25438         FREE(untag_ptr(_res));
25439         COption_APIErrorZ_free(_res_conv);
25440 }
25441
25442 static inline uint64_t COption_APIErrorZ_clone_ptr(LDKCOption_APIErrorZ *NONNULL_PTR arg) {
25443         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
25444         *ret_copy = COption_APIErrorZ_clone(arg);
25445         uint64_t ret_ref = tag_ptr(ret_copy, true);
25446         return ret_ref;
25447 }
25448 int64_t  __attribute__((export_name("TS_COption_APIErrorZ_clone_ptr"))) TS_COption_APIErrorZ_clone_ptr(uint64_t arg) {
25449         LDKCOption_APIErrorZ* arg_conv = (LDKCOption_APIErrorZ*)untag_ptr(arg);
25450         int64_t ret_conv = COption_APIErrorZ_clone_ptr(arg_conv);
25451         return ret_conv;
25452 }
25453
25454 uint64_t  __attribute__((export_name("TS_COption_APIErrorZ_clone"))) TS_COption_APIErrorZ_clone(uint64_t orig) {
25455         LDKCOption_APIErrorZ* orig_conv = (LDKCOption_APIErrorZ*)untag_ptr(orig);
25456         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
25457         *ret_copy = COption_APIErrorZ_clone(orig_conv);
25458         uint64_t ret_ref = tag_ptr(ret_copy, true);
25459         return ret_ref;
25460 }
25461
25462 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_ok"))) TS_CResult_COption_APIErrorZDecodeErrorZ_ok(uint64_t o) {
25463         void* o_ptr = untag_ptr(o);
25464         CHECK_ACCESS(o_ptr);
25465         LDKCOption_APIErrorZ o_conv = *(LDKCOption_APIErrorZ*)(o_ptr);
25466         o_conv = COption_APIErrorZ_clone((LDKCOption_APIErrorZ*)untag_ptr(o));
25467         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
25468         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_ok(o_conv);
25469         return tag_ptr(ret_conv, true);
25470 }
25471
25472 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_err"))) TS_CResult_COption_APIErrorZDecodeErrorZ_err(uint64_t e) {
25473         void* e_ptr = untag_ptr(e);
25474         CHECK_ACCESS(e_ptr);
25475         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25476         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25477         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
25478         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_err(e_conv);
25479         return tag_ptr(ret_conv, true);
25480 }
25481
25482 jboolean  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_is_ok"))) TS_CResult_COption_APIErrorZDecodeErrorZ_is_ok(uint64_t o) {
25483         LDKCResult_COption_APIErrorZDecodeErrorZ* o_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(o);
25484         jboolean ret_conv = CResult_COption_APIErrorZDecodeErrorZ_is_ok(o_conv);
25485         return ret_conv;
25486 }
25487
25488 void  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_free"))) TS_CResult_COption_APIErrorZDecodeErrorZ_free(uint64_t _res) {
25489         if (!ptr_is_owned(_res)) return;
25490         void* _res_ptr = untag_ptr(_res);
25491         CHECK_ACCESS(_res_ptr);
25492         LDKCResult_COption_APIErrorZDecodeErrorZ _res_conv = *(LDKCResult_COption_APIErrorZDecodeErrorZ*)(_res_ptr);
25493         FREE(untag_ptr(_res));
25494         CResult_COption_APIErrorZDecodeErrorZ_free(_res_conv);
25495 }
25496
25497 static inline uint64_t CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR arg) {
25498         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
25499         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(arg);
25500         return tag_ptr(ret_conv, true);
25501 }
25502 int64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(uint64_t arg) {
25503         LDKCResult_COption_APIErrorZDecodeErrorZ* arg_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(arg);
25504         int64_t ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(arg_conv);
25505         return ret_conv;
25506 }
25507
25508 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_clone"))) TS_CResult_COption_APIErrorZDecodeErrorZ_clone(uint64_t orig) {
25509         LDKCResult_COption_APIErrorZDecodeErrorZ* orig_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(orig);
25510         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
25511         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(orig_conv);
25512         return tag_ptr(ret_conv, true);
25513 }
25514
25515 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint64_t o) {
25516         LDKChannelMonitorUpdate o_conv;
25517         o_conv.inner = untag_ptr(o);
25518         o_conv.is_owned = ptr_is_owned(o);
25519         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25520         o_conv = ChannelMonitorUpdate_clone(&o_conv);
25521         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
25522         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
25523         return tag_ptr(ret_conv, true);
25524 }
25525
25526 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint64_t e) {
25527         void* e_ptr = untag_ptr(e);
25528         CHECK_ACCESS(e_ptr);
25529         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25530         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25531         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
25532         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
25533         return tag_ptr(ret_conv, true);
25534 }
25535
25536 jboolean  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(uint64_t o) {
25537         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(o);
25538         jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
25539         return ret_conv;
25540 }
25541
25542 void  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint64_t _res) {
25543         if (!ptr_is_owned(_res)) return;
25544         void* _res_ptr = untag_ptr(_res);
25545         CHECK_ACCESS(_res_ptr);
25546         LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
25547         FREE(untag_ptr(_res));
25548         CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
25549 }
25550
25551 static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
25552         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
25553         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
25554         return tag_ptr(ret_conv, true);
25555 }
25556 int64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
25557         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(arg);
25558         int64_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
25559         return ret_conv;
25560 }
25561
25562 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint64_t orig) {
25563         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(orig);
25564         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
25565         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
25566         return tag_ptr(ret_conv, true);
25567 }
25568
25569 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_some"))) TS_COption_MonitorEventZ_some(uint64_t o) {
25570         void* o_ptr = untag_ptr(o);
25571         CHECK_ACCESS(o_ptr);
25572         LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
25573         o_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(o));
25574         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
25575         *ret_copy = COption_MonitorEventZ_some(o_conv);
25576         uint64_t ret_ref = tag_ptr(ret_copy, true);
25577         return ret_ref;
25578 }
25579
25580 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_none"))) TS_COption_MonitorEventZ_none() {
25581         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
25582         *ret_copy = COption_MonitorEventZ_none();
25583         uint64_t ret_ref = tag_ptr(ret_copy, true);
25584         return ret_ref;
25585 }
25586
25587 void  __attribute__((export_name("TS_COption_MonitorEventZ_free"))) TS_COption_MonitorEventZ_free(uint64_t _res) {
25588         if (!ptr_is_owned(_res)) return;
25589         void* _res_ptr = untag_ptr(_res);
25590         CHECK_ACCESS(_res_ptr);
25591         LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
25592         FREE(untag_ptr(_res));
25593         COption_MonitorEventZ_free(_res_conv);
25594 }
25595
25596 static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
25597         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
25598         *ret_copy = COption_MonitorEventZ_clone(arg);
25599         uint64_t ret_ref = tag_ptr(ret_copy, true);
25600         return ret_ref;
25601 }
25602 int64_t  __attribute__((export_name("TS_COption_MonitorEventZ_clone_ptr"))) TS_COption_MonitorEventZ_clone_ptr(uint64_t arg) {
25603         LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)untag_ptr(arg);
25604         int64_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
25605         return ret_conv;
25606 }
25607
25608 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_clone"))) TS_COption_MonitorEventZ_clone(uint64_t orig) {
25609         LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)untag_ptr(orig);
25610         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
25611         *ret_copy = COption_MonitorEventZ_clone(orig_conv);
25612         uint64_t ret_ref = tag_ptr(ret_copy, true);
25613         return ret_ref;
25614 }
25615
25616 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_ok(uint64_t o) {
25617         void* o_ptr = untag_ptr(o);
25618         CHECK_ACCESS(o_ptr);
25619         LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
25620         o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)untag_ptr(o));
25621         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
25622         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
25623         return tag_ptr(ret_conv, true);
25624 }
25625
25626 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_err(uint64_t e) {
25627         void* e_ptr = untag_ptr(e);
25628         CHECK_ACCESS(e_ptr);
25629         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25630         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25631         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
25632         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
25633         return tag_ptr(ret_conv, true);
25634 }
25635
25636 jboolean  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok(uint64_t o) {
25637         LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(o);
25638         jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
25639         return ret_conv;
25640 }
25641
25642 void  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_free"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_free(uint64_t _res) {
25643         if (!ptr_is_owned(_res)) return;
25644         void* _res_ptr = untag_ptr(_res);
25645         CHECK_ACCESS(_res_ptr);
25646         LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
25647         FREE(untag_ptr(_res));
25648         CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
25649 }
25650
25651 static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
25652         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
25653         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
25654         return tag_ptr(ret_conv, true);
25655 }
25656 int64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(uint64_t arg) {
25657         LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(arg);
25658         int64_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
25659         return ret_conv;
25660 }
25661
25662 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone(uint64_t orig) {
25663         LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(orig);
25664         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
25665         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
25666         return tag_ptr(ret_conv, true);
25667 }
25668
25669 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint64_t o) {
25670         LDKHTLCUpdate o_conv;
25671         o_conv.inner = untag_ptr(o);
25672         o_conv.is_owned = ptr_is_owned(o);
25673         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25674         o_conv = HTLCUpdate_clone(&o_conv);
25675         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
25676         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
25677         return tag_ptr(ret_conv, true);
25678 }
25679
25680 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint64_t e) {
25681         void* e_ptr = untag_ptr(e);
25682         CHECK_ACCESS(e_ptr);
25683         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25684         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25685         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
25686         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
25687         return tag_ptr(ret_conv, true);
25688 }
25689
25690 jboolean  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_is_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_is_ok(uint64_t o) {
25691         LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(o);
25692         jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
25693         return ret_conv;
25694 }
25695
25696 void  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_free"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint64_t _res) {
25697         if (!ptr_is_owned(_res)) return;
25698         void* _res_ptr = untag_ptr(_res);
25699         CHECK_ACCESS(_res_ptr);
25700         LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
25701         FREE(untag_ptr(_res));
25702         CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
25703 }
25704
25705 static inline uint64_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
25706         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
25707         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
25708         return tag_ptr(ret_conv, true);
25709 }
25710 int64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
25711         LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(arg);
25712         int64_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
25713         return ret_conv;
25714 }
25715
25716 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint64_t orig) {
25717         LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(orig);
25718         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
25719         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
25720         return tag_ptr(ret_conv, true);
25721 }
25722
25723 static inline uint64_t C2Tuple_OutPointCVec_u8ZZ_clone_ptr(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR arg) {
25724         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
25725         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone(arg);
25726         return tag_ptr(ret_conv, true);
25727 }
25728 int64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_clone_ptr"))) TS_C2Tuple_OutPointCVec_u8ZZ_clone_ptr(uint64_t arg) {
25729         LDKC2Tuple_OutPointCVec_u8ZZ* arg_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(arg);
25730         int64_t ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone_ptr(arg_conv);
25731         return ret_conv;
25732 }
25733
25734 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_clone"))) TS_C2Tuple_OutPointCVec_u8ZZ_clone(uint64_t orig) {
25735         LDKC2Tuple_OutPointCVec_u8ZZ* orig_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(orig);
25736         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
25737         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone(orig_conv);
25738         return tag_ptr(ret_conv, true);
25739 }
25740
25741 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_new"))) TS_C2Tuple_OutPointCVec_u8ZZ_new(uint64_t a, int8_tArray b) {
25742         LDKOutPoint a_conv;
25743         a_conv.inner = untag_ptr(a);
25744         a_conv.is_owned = ptr_is_owned(a);
25745         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25746         a_conv = OutPoint_clone(&a_conv);
25747         LDKCVec_u8Z b_ref;
25748         b_ref.datalen = b->arr_len;
25749         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
25750         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
25751         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
25752         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_new(a_conv, b_ref);
25753         return tag_ptr(ret_conv, true);
25754 }
25755
25756 void  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_free"))) TS_C2Tuple_OutPointCVec_u8ZZ_free(uint64_t _res) {
25757         if (!ptr_is_owned(_res)) return;
25758         void* _res_ptr = untag_ptr(_res);
25759         CHECK_ACCESS(_res_ptr);
25760         LDKC2Tuple_OutPointCVec_u8ZZ _res_conv = *(LDKC2Tuple_OutPointCVec_u8ZZ*)(_res_ptr);
25761         FREE(untag_ptr(_res));
25762         C2Tuple_OutPointCVec_u8ZZ_free(_res_conv);
25763 }
25764
25765 static inline uint64_t C2Tuple_u32CVec_u8ZZ_clone_ptr(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR arg) {
25766         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
25767         *ret_conv = C2Tuple_u32CVec_u8ZZ_clone(arg);
25768         return tag_ptr(ret_conv, true);
25769 }
25770 int64_t  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_clone_ptr"))) TS_C2Tuple_u32CVec_u8ZZ_clone_ptr(uint64_t arg) {
25771         LDKC2Tuple_u32CVec_u8ZZ* arg_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(arg);
25772         int64_t ret_conv = C2Tuple_u32CVec_u8ZZ_clone_ptr(arg_conv);
25773         return ret_conv;
25774 }
25775
25776 uint64_t  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_clone"))) TS_C2Tuple_u32CVec_u8ZZ_clone(uint64_t orig) {
25777         LDKC2Tuple_u32CVec_u8ZZ* orig_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(orig);
25778         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
25779         *ret_conv = C2Tuple_u32CVec_u8ZZ_clone(orig_conv);
25780         return tag_ptr(ret_conv, true);
25781 }
25782
25783 uint64_t  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_new"))) TS_C2Tuple_u32CVec_u8ZZ_new(int32_t a, int8_tArray b) {
25784         LDKCVec_u8Z b_ref;
25785         b_ref.datalen = b->arr_len;
25786         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
25787         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
25788         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
25789         *ret_conv = C2Tuple_u32CVec_u8ZZ_new(a, b_ref);
25790         return tag_ptr(ret_conv, true);
25791 }
25792
25793 void  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_free"))) TS_C2Tuple_u32CVec_u8ZZ_free(uint64_t _res) {
25794         if (!ptr_is_owned(_res)) return;
25795         void* _res_ptr = untag_ptr(_res);
25796         CHECK_ACCESS(_res_ptr);
25797         LDKC2Tuple_u32CVec_u8ZZ _res_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(_res_ptr);
25798         FREE(untag_ptr(_res));
25799         C2Tuple_u32CVec_u8ZZ_free(_res_conv);
25800 }
25801
25802 void  __attribute__((export_name("TS_CVec_C2Tuple_u32CVec_u8ZZZ_free"))) TS_CVec_C2Tuple_u32CVec_u8ZZZ_free(uint64_tArray _res) {
25803         LDKCVec_C2Tuple_u32CVec_u8ZZZ _res_constr;
25804         _res_constr.datalen = _res->arr_len;
25805         if (_res_constr.datalen > 0)
25806                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKCVec_C2Tuple_u32CVec_u8ZZZ Elements");
25807         else
25808                 _res_constr.data = NULL;
25809         uint64_t* _res_vals = _res->elems;
25810         for (size_t x = 0; x < _res_constr.datalen; x++) {
25811                 uint64_t _res_conv_23 = _res_vals[x];
25812                 void* _res_conv_23_ptr = untag_ptr(_res_conv_23);
25813                 CHECK_ACCESS(_res_conv_23_ptr);
25814                 LDKC2Tuple_u32CVec_u8ZZ _res_conv_23_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(_res_conv_23_ptr);
25815                 FREE(untag_ptr(_res_conv_23));
25816                 _res_constr.data[x] = _res_conv_23_conv;
25817         }
25818         FREE(_res);
25819         CVec_C2Tuple_u32CVec_u8ZZZ_free(_res_constr);
25820 }
25821
25822 static inline uint64_t C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR arg) {
25823         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
25824         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(arg);
25825         return tag_ptr(ret_conv, true);
25826 }
25827 int64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(uint64_t arg) {
25828         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(arg);
25829         int64_t ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(arg_conv);
25830         return ret_conv;
25831 }
25832
25833 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(uint64_t orig) {
25834         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(orig);
25835         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
25836         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(orig_conv);
25837         return tag_ptr(ret_conv, true);
25838 }
25839
25840 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) {
25841         LDKThirtyTwoBytes a_ref;
25842         CHECK(a->arr_len == 32);
25843         memcpy(a_ref.data, a->elems, 32); FREE(a);
25844         LDKCVec_C2Tuple_u32CVec_u8ZZZ b_constr;
25845         b_constr.datalen = b->arr_len;
25846         if (b_constr.datalen > 0)
25847                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKCVec_C2Tuple_u32CVec_u8ZZZ Elements");
25848         else
25849                 b_constr.data = NULL;
25850         uint64_t* b_vals = b->elems;
25851         for (size_t x = 0; x < b_constr.datalen; x++) {
25852                 uint64_t b_conv_23 = b_vals[x];
25853                 void* b_conv_23_ptr = untag_ptr(b_conv_23);
25854                 CHECK_ACCESS(b_conv_23_ptr);
25855                 LDKC2Tuple_u32CVec_u8ZZ b_conv_23_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(b_conv_23_ptr);
25856                 b_conv_23_conv = C2Tuple_u32CVec_u8ZZ_clone((LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(b_conv_23));
25857                 b_constr.data[x] = b_conv_23_conv;
25858         }
25859         FREE(b);
25860         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
25861         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_new(a_ref, b_constr);
25862         return tag_ptr(ret_conv, true);
25863 }
25864
25865 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(uint64_t _res) {
25866         if (!ptr_is_owned(_res)) return;
25867         void* _res_ptr = untag_ptr(_res);
25868         CHECK_ACCESS(_res_ptr);
25869         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)(_res_ptr);
25870         FREE(untag_ptr(_res));
25871         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(_res_conv);
25872 }
25873
25874 void  __attribute__((export_name("TS_CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free"))) TS_CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(uint64_tArray _res) {
25875         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ _res_constr;
25876         _res_constr.datalen = _res->arr_len;
25877         if (_res_constr.datalen > 0)
25878                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ Elements");
25879         else
25880                 _res_constr.data = NULL;
25881         uint64_t* _res_vals = _res->elems;
25882         for (size_t a = 0; a < _res_constr.datalen; a++) {
25883                 uint64_t _res_conv_52 = _res_vals[a];
25884                 void* _res_conv_52_ptr = untag_ptr(_res_conv_52);
25885                 CHECK_ACCESS(_res_conv_52_ptr);
25886                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ _res_conv_52_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)(_res_conv_52_ptr);
25887                 FREE(untag_ptr(_res_conv_52));
25888                 _res_constr.data[a] = _res_conv_52_conv;
25889         }
25890         FREE(_res);
25891         CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(_res_constr);
25892 }
25893
25894 void  __attribute__((export_name("TS_CVec_CommitmentTransactionZ_free"))) TS_CVec_CommitmentTransactionZ_free(uint64_tArray _res) {
25895         LDKCVec_CommitmentTransactionZ _res_constr;
25896         _res_constr.datalen = _res->arr_len;
25897         if (_res_constr.datalen > 0)
25898                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCommitmentTransaction), "LDKCVec_CommitmentTransactionZ Elements");
25899         else
25900                 _res_constr.data = NULL;
25901         uint64_t* _res_vals = _res->elems;
25902         for (size_t x = 0; x < _res_constr.datalen; x++) {
25903                 uint64_t _res_conv_23 = _res_vals[x];
25904                 LDKCommitmentTransaction _res_conv_23_conv;
25905                 _res_conv_23_conv.inner = untag_ptr(_res_conv_23);
25906                 _res_conv_23_conv.is_owned = ptr_is_owned(_res_conv_23);
25907                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_23_conv);
25908                 _res_constr.data[x] = _res_conv_23_conv;
25909         }
25910         FREE(_res);
25911         CVec_CommitmentTransactionZ_free(_res_constr);
25912 }
25913
25914 static inline uint64_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
25915         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
25916         *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
25917         return tag_ptr(ret_conv, true);
25918 }
25919 int64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone_ptr"))) TS_C2Tuple_u32TxOutZ_clone_ptr(uint64_t arg) {
25920         LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(arg);
25921         int64_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
25922         return ret_conv;
25923 }
25924
25925 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone"))) TS_C2Tuple_u32TxOutZ_clone(uint64_t orig) {
25926         LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(orig);
25927         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
25928         *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
25929         return tag_ptr(ret_conv, true);
25930 }
25931
25932 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_new"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint64_t b) {
25933         void* b_ptr = untag_ptr(b);
25934         CHECK_ACCESS(b_ptr);
25935         LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
25936         b_conv = TxOut_clone((LDKTxOut*)untag_ptr(b));
25937         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
25938         *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
25939         return tag_ptr(ret_conv, true);
25940 }
25941
25942 void  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_free"))) TS_C2Tuple_u32TxOutZ_free(uint64_t _res) {
25943         if (!ptr_is_owned(_res)) return;
25944         void* _res_ptr = untag_ptr(_res);
25945         CHECK_ACCESS(_res_ptr);
25946         LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
25947         FREE(untag_ptr(_res));
25948         C2Tuple_u32TxOutZ_free(_res_conv);
25949 }
25950
25951 void  __attribute__((export_name("TS_CVec_C2Tuple_u32TxOutZZ_free"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint64_tArray _res) {
25952         LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
25953         _res_constr.datalen = _res->arr_len;
25954         if (_res_constr.datalen > 0)
25955                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
25956         else
25957                 _res_constr.data = NULL;
25958         uint64_t* _res_vals = _res->elems;
25959         for (size_t u = 0; u < _res_constr.datalen; u++) {
25960                 uint64_t _res_conv_20 = _res_vals[u];
25961                 void* _res_conv_20_ptr = untag_ptr(_res_conv_20);
25962                 CHECK_ACCESS(_res_conv_20_ptr);
25963                 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
25964                 FREE(untag_ptr(_res_conv_20));
25965                 _res_constr.data[u] = _res_conv_20_conv;
25966         }
25967         FREE(_res);
25968         CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
25969 }
25970
25971 static inline uint64_t C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
25972         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
25973         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(arg);
25974         return tag_ptr(ret_conv, true);
25975 }
25976 int64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(uint64_t arg) {
25977         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(arg);
25978         int64_t ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
25979         return ret_conv;
25980 }
25981
25982 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(uint64_t orig) {
25983         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(orig);
25984         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
25985         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
25986         return tag_ptr(ret_conv, true);
25987 }
25988
25989 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint64_tArray b) {
25990         LDKThirtyTwoBytes a_ref;
25991         CHECK(a->arr_len == 32);
25992         memcpy(a_ref.data, a->elems, 32); FREE(a);
25993         LDKCVec_C2Tuple_u32TxOutZZ b_constr;
25994         b_constr.datalen = b->arr_len;
25995         if (b_constr.datalen > 0)
25996                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
25997         else
25998                 b_constr.data = NULL;
25999         uint64_t* b_vals = b->elems;
26000         for (size_t u = 0; u < b_constr.datalen; u++) {
26001                 uint64_t b_conv_20 = b_vals[u];
26002                 void* b_conv_20_ptr = untag_ptr(b_conv_20);
26003                 CHECK_ACCESS(b_conv_20_ptr);
26004                 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
26005                 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)untag_ptr(b_conv_20));
26006                 b_constr.data[u] = b_conv_20_conv;
26007         }
26008         FREE(b);
26009         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
26010         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
26011         return tag_ptr(ret_conv, true);
26012 }
26013
26014 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(uint64_t _res) {
26015         if (!ptr_is_owned(_res)) return;
26016         void* _res_ptr = untag_ptr(_res);
26017         CHECK_ACCESS(_res_ptr);
26018         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
26019         FREE(untag_ptr(_res));
26020         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
26021 }
26022
26023 void  __attribute__((export_name("TS_CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free"))) TS_CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free(uint64_tArray _res) {
26024         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ _res_constr;
26025         _res_constr.datalen = _res->arr_len;
26026         if (_res_constr.datalen > 0)
26027                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ Elements");
26028         else
26029                 _res_constr.data = NULL;
26030         uint64_t* _res_vals = _res->elems;
26031         for (size_t x = 0; x < _res_constr.datalen; x++) {
26032                 uint64_t _res_conv_49 = _res_vals[x];
26033                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
26034                 CHECK_ACCESS(_res_conv_49_ptr);
26035                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ _res_conv_49_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_49_ptr);
26036                 FREE(untag_ptr(_res_conv_49));
26037                 _res_constr.data[x] = _res_conv_49_conv;
26038         }
26039         FREE(_res);
26040         CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
26041 }
26042
26043 void  __attribute__((export_name("TS_CVec_BalanceZ_free"))) TS_CVec_BalanceZ_free(uint64_tArray _res) {
26044         LDKCVec_BalanceZ _res_constr;
26045         _res_constr.datalen = _res->arr_len;
26046         if (_res_constr.datalen > 0)
26047                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
26048         else
26049                 _res_constr.data = NULL;
26050         uint64_t* _res_vals = _res->elems;
26051         for (size_t j = 0; j < _res_constr.datalen; j++) {
26052                 uint64_t _res_conv_9 = _res_vals[j];
26053                 void* _res_conv_9_ptr = untag_ptr(_res_conv_9);
26054                 CHECK_ACCESS(_res_conv_9_ptr);
26055                 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
26056                 FREE(untag_ptr(_res_conv_9));
26057                 _res_constr.data[j] = _res_conv_9_conv;
26058         }
26059         FREE(_res);
26060         CVec_BalanceZ_free(_res_constr);
26061 }
26062
26063 static inline uint64_t C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR arg) {
26064         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
26065         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(arg);
26066         return tag_ptr(ret_conv, true);
26067 }
26068 int64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(uint64_t arg) {
26069         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(arg);
26070         int64_t ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(arg_conv);
26071         return ret_conv;
26072 }
26073
26074 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(uint64_t orig) {
26075         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(orig);
26076         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
26077         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(orig_conv);
26078         return tag_ptr(ret_conv, true);
26079 }
26080
26081 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_new"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(int8_tArray a, uint64_t b) {
26082         LDKThirtyTwoBytes a_ref;
26083         CHECK(a->arr_len == 32);
26084         memcpy(a_ref.data, a->elems, 32); FREE(a);
26085         LDKChannelMonitor b_conv;
26086         b_conv.inner = untag_ptr(b);
26087         b_conv.is_owned = ptr_is_owned(b);
26088         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
26089         b_conv = ChannelMonitor_clone(&b_conv);
26090         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
26091         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(a_ref, b_conv);
26092         return tag_ptr(ret_conv, true);
26093 }
26094
26095 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_free"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(uint64_t _res) {
26096         if (!ptr_is_owned(_res)) return;
26097         void* _res_ptr = untag_ptr(_res);
26098         CHECK_ACCESS(_res_ptr);
26099         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(_res_ptr);
26100         FREE(untag_ptr(_res));
26101         C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(_res_conv);
26102 }
26103
26104 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(uint64_t o) {
26105         void* o_ptr = untag_ptr(o);
26106         CHECK_ACCESS(o_ptr);
26107         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_ptr);
26108         o_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o));
26109         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
26110         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(o_conv);
26111         return tag_ptr(ret_conv, true);
26112 }
26113
26114 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(uint64_t e) {
26115         void* e_ptr = untag_ptr(e);
26116         CHECK_ACCESS(e_ptr);
26117         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26118         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26119         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
26120         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(e_conv);
26121         return tag_ptr(ret_conv, true);
26122 }
26123
26124 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(uint64_t o) {
26125         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(o);
26126         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(o_conv);
26127         return ret_conv;
26128 }
26129
26130 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(uint64_t _res) {
26131         if (!ptr_is_owned(_res)) return;
26132         void* _res_ptr = untag_ptr(_res);
26133         CHECK_ACCESS(_res_ptr);
26134         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)(_res_ptr);
26135         FREE(untag_ptr(_res));
26136         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(_res_conv);
26137 }
26138
26139 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
26140         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
26141         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(arg);
26142         return tag_ptr(ret_conv, true);
26143 }
26144 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(uint64_t arg) {
26145         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(arg);
26146         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
26147         return ret_conv;
26148 }
26149
26150 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(uint64_t orig) {
26151         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(orig);
26152         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
26153         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(orig_conv);
26154         return tag_ptr(ret_conv, true);
26155 }
26156
26157 static inline uint64_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
26158         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
26159         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
26160         return tag_ptr(ret_conv, true);
26161 }
26162 int64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone_ptr"))) TS_C2Tuple_PublicKeyTypeZ_clone_ptr(uint64_t arg) {
26163         LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(arg);
26164         int64_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
26165         return ret_conv;
26166 }
26167
26168 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone"))) TS_C2Tuple_PublicKeyTypeZ_clone(uint64_t orig) {
26169         LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(orig);
26170         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
26171         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
26172         return tag_ptr(ret_conv, true);
26173 }
26174
26175 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_new"))) TS_C2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint64_t b) {
26176         LDKPublicKey a_ref;
26177         CHECK(a->arr_len == 33);
26178         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
26179         void* b_ptr = untag_ptr(b);
26180         CHECK_ACCESS(b_ptr);
26181         LDKType b_conv = *(LDKType*)(b_ptr);
26182         if (b_conv.free == LDKType_JCalls_free) {
26183                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26184                 LDKType_JCalls_cloned(&b_conv);
26185         }
26186         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
26187         *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
26188         return tag_ptr(ret_conv, true);
26189 }
26190
26191 void  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_free"))) TS_C2Tuple_PublicKeyTypeZ_free(uint64_t _res) {
26192         if (!ptr_is_owned(_res)) return;
26193         void* _res_ptr = untag_ptr(_res);
26194         CHECK_ACCESS(_res_ptr);
26195         LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
26196         FREE(untag_ptr(_res));
26197         C2Tuple_PublicKeyTypeZ_free(_res_conv);
26198 }
26199
26200 void  __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyTypeZZ_free"))) TS_CVec_C2Tuple_PublicKeyTypeZZ_free(uint64_tArray _res) {
26201         LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
26202         _res_constr.datalen = _res->arr_len;
26203         if (_res_constr.datalen > 0)
26204                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
26205         else
26206                 _res_constr.data = NULL;
26207         uint64_t* _res_vals = _res->elems;
26208         for (size_t z = 0; z < _res_constr.datalen; z++) {
26209                 uint64_t _res_conv_25 = _res_vals[z];
26210                 void* _res_conv_25_ptr = untag_ptr(_res_conv_25);
26211                 CHECK_ACCESS(_res_conv_25_ptr);
26212                 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
26213                 FREE(untag_ptr(_res_conv_25));
26214                 _res_constr.data[z] = _res_conv_25_conv;
26215         }
26216         FREE(_res);
26217         CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
26218 }
26219
26220 static inline uint64_t C2Tuple_PublicKeyCVec_SocketAddressZZ_clone_ptr(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ *NONNULL_PTR arg) {
26221         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
26222         *ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(arg);
26223         return tag_ptr(ret_conv, true);
26224 }
26225 int64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_clone_ptr"))) TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_clone_ptr(uint64_t arg) {
26226         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* arg_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(arg);
26227         int64_t ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone_ptr(arg_conv);
26228         return ret_conv;
26229 }
26230
26231 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_clone"))) TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(uint64_t orig) {
26232         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* orig_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(orig);
26233         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
26234         *ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(orig_conv);
26235         return tag_ptr(ret_conv, true);
26236 }
26237
26238 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_new"))) TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_new(int8_tArray a, uint64_tArray b) {
26239         LDKPublicKey a_ref;
26240         CHECK(a->arr_len == 33);
26241         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
26242         LDKCVec_SocketAddressZ b_constr;
26243         b_constr.datalen = b->arr_len;
26244         if (b_constr.datalen > 0)
26245                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
26246         else
26247                 b_constr.data = NULL;
26248         uint64_t* b_vals = b->elems;
26249         for (size_t p = 0; p < b_constr.datalen; p++) {
26250                 uint64_t b_conv_15 = b_vals[p];
26251                 void* b_conv_15_ptr = untag_ptr(b_conv_15);
26252                 CHECK_ACCESS(b_conv_15_ptr);
26253                 LDKSocketAddress b_conv_15_conv = *(LDKSocketAddress*)(b_conv_15_ptr);
26254                 b_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(b_conv_15));
26255                 b_constr.data[p] = b_conv_15_conv;
26256         }
26257         FREE(b);
26258         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
26259         *ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_new(a_ref, b_constr);
26260         return tag_ptr(ret_conv, true);
26261 }
26262
26263 void  __attribute__((export_name("TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_free"))) TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_free(uint64_t _res) {
26264         if (!ptr_is_owned(_res)) return;
26265         void* _res_ptr = untag_ptr(_res);
26266         CHECK_ACCESS(_res_ptr);
26267         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ _res_conv = *(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)(_res_ptr);
26268         FREE(untag_ptr(_res));
26269         C2Tuple_PublicKeyCVec_SocketAddressZZ_free(_res_conv);
26270 }
26271
26272 void  __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_free"))) TS_CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_free(uint64_tArray _res) {
26273         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ _res_constr;
26274         _res_constr.datalen = _res->arr_len;
26275         if (_res_constr.datalen > 0)
26276                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ Elements");
26277         else
26278                 _res_constr.data = NULL;
26279         uint64_t* _res_vals = _res->elems;
26280         for (size_t o = 0; o < _res_constr.datalen; o++) {
26281                 uint64_t _res_conv_40 = _res_vals[o];
26282                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
26283                 CHECK_ACCESS(_res_conv_40_ptr);
26284                 LDKC2Tuple_PublicKeyCVec_SocketAddressZZ _res_conv_40_conv = *(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)(_res_conv_40_ptr);
26285                 FREE(untag_ptr(_res_conv_40));
26286                 _res_constr.data[o] = _res_conv_40_conv;
26287         }
26288         FREE(_res);
26289         CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_free(_res_constr);
26290 }
26291
26292 uint64_t  __attribute__((export_name("TS_COption_OnionMessageContentsZ_some"))) TS_COption_OnionMessageContentsZ_some(uint64_t o) {
26293         void* o_ptr = untag_ptr(o);
26294         CHECK_ACCESS(o_ptr);
26295         LDKOnionMessageContents o_conv = *(LDKOnionMessageContents*)(o_ptr);
26296         if (o_conv.free == LDKOnionMessageContents_JCalls_free) {
26297                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26298                 LDKOnionMessageContents_JCalls_cloned(&o_conv);
26299         }
26300         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
26301         *ret_copy = COption_OnionMessageContentsZ_some(o_conv);
26302         uint64_t ret_ref = tag_ptr(ret_copy, true);
26303         return ret_ref;
26304 }
26305
26306 uint64_t  __attribute__((export_name("TS_COption_OnionMessageContentsZ_none"))) TS_COption_OnionMessageContentsZ_none() {
26307         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
26308         *ret_copy = COption_OnionMessageContentsZ_none();
26309         uint64_t ret_ref = tag_ptr(ret_copy, true);
26310         return ret_ref;
26311 }
26312
26313 void  __attribute__((export_name("TS_COption_OnionMessageContentsZ_free"))) TS_COption_OnionMessageContentsZ_free(uint64_t _res) {
26314         if (!ptr_is_owned(_res)) return;
26315         void* _res_ptr = untag_ptr(_res);
26316         CHECK_ACCESS(_res_ptr);
26317         LDKCOption_OnionMessageContentsZ _res_conv = *(LDKCOption_OnionMessageContentsZ*)(_res_ptr);
26318         FREE(untag_ptr(_res));
26319         COption_OnionMessageContentsZ_free(_res_conv);
26320 }
26321
26322 static inline uint64_t COption_OnionMessageContentsZ_clone_ptr(LDKCOption_OnionMessageContentsZ *NONNULL_PTR arg) {
26323         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
26324         *ret_copy = COption_OnionMessageContentsZ_clone(arg);
26325         uint64_t ret_ref = tag_ptr(ret_copy, true);
26326         return ret_ref;
26327 }
26328 int64_t  __attribute__((export_name("TS_COption_OnionMessageContentsZ_clone_ptr"))) TS_COption_OnionMessageContentsZ_clone_ptr(uint64_t arg) {
26329         LDKCOption_OnionMessageContentsZ* arg_conv = (LDKCOption_OnionMessageContentsZ*)untag_ptr(arg);
26330         int64_t ret_conv = COption_OnionMessageContentsZ_clone_ptr(arg_conv);
26331         return ret_conv;
26332 }
26333
26334 uint64_t  __attribute__((export_name("TS_COption_OnionMessageContentsZ_clone"))) TS_COption_OnionMessageContentsZ_clone(uint64_t orig) {
26335         LDKCOption_OnionMessageContentsZ* orig_conv = (LDKCOption_OnionMessageContentsZ*)untag_ptr(orig);
26336         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
26337         *ret_copy = COption_OnionMessageContentsZ_clone(orig_conv);
26338         uint64_t ret_ref = tag_ptr(ret_copy, true);
26339         return ret_ref;
26340 }
26341
26342 uint64_t  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_ok"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(uint64_t o) {
26343         void* o_ptr = untag_ptr(o);
26344         CHECK_ACCESS(o_ptr);
26345         LDKCOption_OnionMessageContentsZ o_conv = *(LDKCOption_OnionMessageContentsZ*)(o_ptr);
26346         o_conv = COption_OnionMessageContentsZ_clone((LDKCOption_OnionMessageContentsZ*)untag_ptr(o));
26347         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
26348         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(o_conv);
26349         return tag_ptr(ret_conv, true);
26350 }
26351
26352 uint64_t  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_err"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_err(uint64_t e) {
26353         void* e_ptr = untag_ptr(e);
26354         CHECK_ACCESS(e_ptr);
26355         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26356         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26357         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
26358         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_err(e_conv);
26359         return tag_ptr(ret_conv, true);
26360 }
26361
26362 jboolean  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(uint64_t o) {
26363         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* o_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(o);
26364         jboolean ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(o_conv);
26365         return ret_conv;
26366 }
26367
26368 void  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_free"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_free(uint64_t _res) {
26369         if (!ptr_is_owned(_res)) return;
26370         void* _res_ptr = untag_ptr(_res);
26371         CHECK_ACCESS(_res_ptr);
26372         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ _res_conv = *(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)(_res_ptr);
26373         FREE(untag_ptr(_res));
26374         CResult_COption_OnionMessageContentsZDecodeErrorZ_free(_res_conv);
26375 }
26376
26377 static inline uint64_t CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR arg) {
26378         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
26379         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(arg);
26380         return tag_ptr(ret_conv, true);
26381 }
26382 int64_t  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr(uint64_t arg) {
26383         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* arg_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(arg);
26384         int64_t ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr(arg_conv);
26385         return ret_conv;
26386 }
26387
26388 uint64_t  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_clone"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(uint64_t orig) {
26389         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* orig_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(orig);
26390         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
26391         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(orig_conv);
26392         return tag_ptr(ret_conv, true);
26393 }
26394
26395 static inline uint64_t C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR arg) {
26396         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
26397         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(arg);
26398         return tag_ptr(ret_conv, true);
26399 }
26400 int64_t  __attribute__((export_name("TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr"))) TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr(uint64_t arg) {
26401         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* arg_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(arg);
26402         int64_t ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr(arg_conv);
26403         return ret_conv;
26404 }
26405
26406 uint64_t  __attribute__((export_name("TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone"))) TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(uint64_t orig) {
26407         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* orig_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(orig);
26408         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
26409         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(orig_conv);
26410         return tag_ptr(ret_conv, true);
26411 }
26412
26413 uint64_t  __attribute__((export_name("TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new"))) TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new(uint64_t a, uint64_t b, uint64_t c) {
26414         void* a_ptr = untag_ptr(a);
26415         CHECK_ACCESS(a_ptr);
26416         LDKOnionMessageContents a_conv = *(LDKOnionMessageContents*)(a_ptr);
26417         if (a_conv.free == LDKOnionMessageContents_JCalls_free) {
26418                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26419                 LDKOnionMessageContents_JCalls_cloned(&a_conv);
26420         }
26421         void* b_ptr = untag_ptr(b);
26422         CHECK_ACCESS(b_ptr);
26423         LDKDestination b_conv = *(LDKDestination*)(b_ptr);
26424         b_conv = Destination_clone((LDKDestination*)untag_ptr(b));
26425         LDKBlindedPath c_conv;
26426         c_conv.inner = untag_ptr(c);
26427         c_conv.is_owned = ptr_is_owned(c);
26428         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
26429         c_conv = BlindedPath_clone(&c_conv);
26430         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
26431         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new(a_conv, b_conv, c_conv);
26432         return tag_ptr(ret_conv, true);
26433 }
26434
26435 void  __attribute__((export_name("TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free"))) TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free(uint64_t _res) {
26436         if (!ptr_is_owned(_res)) return;
26437         void* _res_ptr = untag_ptr(_res);
26438         CHECK_ACCESS(_res_ptr);
26439         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ _res_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(_res_ptr);
26440         FREE(untag_ptr(_res));
26441         C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free(_res_conv);
26442 }
26443
26444 void  __attribute__((export_name("TS_CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free"))) TS_CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free(uint64_tArray _res) {
26445         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ _res_constr;
26446         _res_constr.datalen = _res->arr_len;
26447         if (_res_constr.datalen > 0)
26448                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ Elements");
26449         else
26450                 _res_constr.data = NULL;
26451         uint64_t* _res_vals = _res->elems;
26452         for (size_t e = 0; e < _res_constr.datalen; e++) {
26453                 uint64_t _res_conv_56 = _res_vals[e];
26454                 void* _res_conv_56_ptr = untag_ptr(_res_conv_56);
26455                 CHECK_ACCESS(_res_conv_56_ptr);
26456                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ _res_conv_56_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(_res_conv_56_ptr);
26457                 FREE(untag_ptr(_res_conv_56));
26458                 _res_constr.data[e] = _res_conv_56_conv;
26459         }
26460         FREE(_res);
26461         CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free(_res_constr);
26462 }
26463
26464 uint64_t  __attribute__((export_name("TS_COption_TypeZ_some"))) TS_COption_TypeZ_some(uint64_t o) {
26465         void* o_ptr = untag_ptr(o);
26466         CHECK_ACCESS(o_ptr);
26467         LDKType o_conv = *(LDKType*)(o_ptr);
26468         if (o_conv.free == LDKType_JCalls_free) {
26469                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26470                 LDKType_JCalls_cloned(&o_conv);
26471         }
26472         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
26473         *ret_copy = COption_TypeZ_some(o_conv);
26474         uint64_t ret_ref = tag_ptr(ret_copy, true);
26475         return ret_ref;
26476 }
26477
26478 uint64_t  __attribute__((export_name("TS_COption_TypeZ_none"))) TS_COption_TypeZ_none() {
26479         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
26480         *ret_copy = COption_TypeZ_none();
26481         uint64_t ret_ref = tag_ptr(ret_copy, true);
26482         return ret_ref;
26483 }
26484
26485 void  __attribute__((export_name("TS_COption_TypeZ_free"))) TS_COption_TypeZ_free(uint64_t _res) {
26486         if (!ptr_is_owned(_res)) return;
26487         void* _res_ptr = untag_ptr(_res);
26488         CHECK_ACCESS(_res_ptr);
26489         LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
26490         FREE(untag_ptr(_res));
26491         COption_TypeZ_free(_res_conv);
26492 }
26493
26494 static inline uint64_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
26495         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
26496         *ret_copy = COption_TypeZ_clone(arg);
26497         uint64_t ret_ref = tag_ptr(ret_copy, true);
26498         return ret_ref;
26499 }
26500 int64_t  __attribute__((export_name("TS_COption_TypeZ_clone_ptr"))) TS_COption_TypeZ_clone_ptr(uint64_t arg) {
26501         LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)untag_ptr(arg);
26502         int64_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
26503         return ret_conv;
26504 }
26505
26506 uint64_t  __attribute__((export_name("TS_COption_TypeZ_clone"))) TS_COption_TypeZ_clone(uint64_t orig) {
26507         LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)untag_ptr(orig);
26508         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
26509         *ret_copy = COption_TypeZ_clone(orig_conv);
26510         uint64_t ret_ref = tag_ptr(ret_copy, true);
26511         return ret_ref;
26512 }
26513
26514 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_ok(uint64_t o) {
26515         void* o_ptr = untag_ptr(o);
26516         CHECK_ACCESS(o_ptr);
26517         LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
26518         o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)untag_ptr(o));
26519         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
26520         *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
26521         return tag_ptr(ret_conv, true);
26522 }
26523
26524 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_err"))) TS_CResult_COption_TypeZDecodeErrorZ_err(uint64_t e) {
26525         void* e_ptr = untag_ptr(e);
26526         CHECK_ACCESS(e_ptr);
26527         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26528         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26529         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
26530         *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
26531         return tag_ptr(ret_conv, true);
26532 }
26533
26534 jboolean  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_is_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_is_ok(uint64_t o) {
26535         LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(o);
26536         jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
26537         return ret_conv;
26538 }
26539
26540 void  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_free"))) TS_CResult_COption_TypeZDecodeErrorZ_free(uint64_t _res) {
26541         if (!ptr_is_owned(_res)) return;
26542         void* _res_ptr = untag_ptr(_res);
26543         CHECK_ACCESS(_res_ptr);
26544         LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
26545         FREE(untag_ptr(_res));
26546         CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
26547 }
26548
26549 static inline uint64_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
26550         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
26551         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
26552         return tag_ptr(ret_conv, true);
26553 }
26554 int64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr(uint64_t arg) {
26555         LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(arg);
26556         int64_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
26557         return ret_conv;
26558 }
26559
26560 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone"))) TS_CResult_COption_TypeZDecodeErrorZ_clone(uint64_t orig) {
26561         LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(orig);
26562         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
26563         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
26564         return tag_ptr(ret_conv, true);
26565 }
26566
26567 uint64_t  __attribute__((export_name("TS_COption_SocketAddressZ_some"))) TS_COption_SocketAddressZ_some(uint64_t o) {
26568         void* o_ptr = untag_ptr(o);
26569         CHECK_ACCESS(o_ptr);
26570         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
26571         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
26572         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
26573         *ret_copy = COption_SocketAddressZ_some(o_conv);
26574         uint64_t ret_ref = tag_ptr(ret_copy, true);
26575         return ret_ref;
26576 }
26577
26578 uint64_t  __attribute__((export_name("TS_COption_SocketAddressZ_none"))) TS_COption_SocketAddressZ_none() {
26579         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
26580         *ret_copy = COption_SocketAddressZ_none();
26581         uint64_t ret_ref = tag_ptr(ret_copy, true);
26582         return ret_ref;
26583 }
26584
26585 void  __attribute__((export_name("TS_COption_SocketAddressZ_free"))) TS_COption_SocketAddressZ_free(uint64_t _res) {
26586         if (!ptr_is_owned(_res)) return;
26587         void* _res_ptr = untag_ptr(_res);
26588         CHECK_ACCESS(_res_ptr);
26589         LDKCOption_SocketAddressZ _res_conv = *(LDKCOption_SocketAddressZ*)(_res_ptr);
26590         FREE(untag_ptr(_res));
26591         COption_SocketAddressZ_free(_res_conv);
26592 }
26593
26594 static inline uint64_t COption_SocketAddressZ_clone_ptr(LDKCOption_SocketAddressZ *NONNULL_PTR arg) {
26595         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
26596         *ret_copy = COption_SocketAddressZ_clone(arg);
26597         uint64_t ret_ref = tag_ptr(ret_copy, true);
26598         return ret_ref;
26599 }
26600 int64_t  __attribute__((export_name("TS_COption_SocketAddressZ_clone_ptr"))) TS_COption_SocketAddressZ_clone_ptr(uint64_t arg) {
26601         LDKCOption_SocketAddressZ* arg_conv = (LDKCOption_SocketAddressZ*)untag_ptr(arg);
26602         int64_t ret_conv = COption_SocketAddressZ_clone_ptr(arg_conv);
26603         return ret_conv;
26604 }
26605
26606 uint64_t  __attribute__((export_name("TS_COption_SocketAddressZ_clone"))) TS_COption_SocketAddressZ_clone(uint64_t orig) {
26607         LDKCOption_SocketAddressZ* orig_conv = (LDKCOption_SocketAddressZ*)untag_ptr(orig);
26608         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
26609         *ret_copy = COption_SocketAddressZ_clone(orig_conv);
26610         uint64_t ret_ref = tag_ptr(ret_copy, true);
26611         return ret_ref;
26612 }
26613
26614 void  __attribute__((export_name("TS_CVec_PeerDetailsZ_free"))) TS_CVec_PeerDetailsZ_free(uint64_tArray _res) {
26615         LDKCVec_PeerDetailsZ _res_constr;
26616         _res_constr.datalen = _res->arr_len;
26617         if (_res_constr.datalen > 0)
26618                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPeerDetails), "LDKCVec_PeerDetailsZ Elements");
26619         else
26620                 _res_constr.data = NULL;
26621         uint64_t* _res_vals = _res->elems;
26622         for (size_t n = 0; n < _res_constr.datalen; n++) {
26623                 uint64_t _res_conv_13 = _res_vals[n];
26624                 LDKPeerDetails _res_conv_13_conv;
26625                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
26626                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
26627                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
26628                 _res_constr.data[n] = _res_conv_13_conv;
26629         }
26630         FREE(_res);
26631         CVec_PeerDetailsZ_free(_res_constr);
26632 }
26633
26634 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
26635         LDKCVec_u8Z o_ref;
26636         o_ref.datalen = o->arr_len;
26637         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
26638         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
26639         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
26640         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
26641         return tag_ptr(ret_conv, true);
26642 }
26643
26644 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint64_t e) {
26645         LDKPeerHandleError e_conv;
26646         e_conv.inner = untag_ptr(e);
26647         e_conv.is_owned = ptr_is_owned(e);
26648         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
26649         e_conv = PeerHandleError_clone(&e_conv);
26650         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
26651         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
26652         return tag_ptr(ret_conv, true);
26653 }
26654
26655 jboolean  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok(uint64_t o) {
26656         LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(o);
26657         jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
26658         return ret_conv;
26659 }
26660
26661 void  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_free"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint64_t _res) {
26662         if (!ptr_is_owned(_res)) return;
26663         void* _res_ptr = untag_ptr(_res);
26664         CHECK_ACCESS(_res_ptr);
26665         LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
26666         FREE(untag_ptr(_res));
26667         CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
26668 }
26669
26670 static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
26671         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
26672         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
26673         return tag_ptr(ret_conv, true);
26674 }
26675 int64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(uint64_t arg) {
26676         LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(arg);
26677         int64_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
26678         return ret_conv;
26679 }
26680
26681 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint64_t orig) {
26682         LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(orig);
26683         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
26684         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
26685         return tag_ptr(ret_conv, true);
26686 }
26687
26688 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_ok"))) TS_CResult_NonePeerHandleErrorZ_ok() {
26689         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
26690         *ret_conv = CResult_NonePeerHandleErrorZ_ok();
26691         return tag_ptr(ret_conv, true);
26692 }
26693
26694 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_err"))) TS_CResult_NonePeerHandleErrorZ_err(uint64_t e) {
26695         LDKPeerHandleError e_conv;
26696         e_conv.inner = untag_ptr(e);
26697         e_conv.is_owned = ptr_is_owned(e);
26698         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
26699         e_conv = PeerHandleError_clone(&e_conv);
26700         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
26701         *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
26702         return tag_ptr(ret_conv, true);
26703 }
26704
26705 jboolean  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_is_ok"))) TS_CResult_NonePeerHandleErrorZ_is_ok(uint64_t o) {
26706         LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(o);
26707         jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
26708         return ret_conv;
26709 }
26710
26711 void  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_free"))) TS_CResult_NonePeerHandleErrorZ_free(uint64_t _res) {
26712         if (!ptr_is_owned(_res)) return;
26713         void* _res_ptr = untag_ptr(_res);
26714         CHECK_ACCESS(_res_ptr);
26715         LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
26716         FREE(untag_ptr(_res));
26717         CResult_NonePeerHandleErrorZ_free(_res_conv);
26718 }
26719
26720 static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
26721         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
26722         *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
26723         return tag_ptr(ret_conv, true);
26724 }
26725 int64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone_ptr"))) TS_CResult_NonePeerHandleErrorZ_clone_ptr(uint64_t arg) {
26726         LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(arg);
26727         int64_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
26728         return ret_conv;
26729 }
26730
26731 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone"))) TS_CResult_NonePeerHandleErrorZ_clone(uint64_t orig) {
26732         LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(orig);
26733         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
26734         *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
26735         return tag_ptr(ret_conv, true);
26736 }
26737
26738 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_ok"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
26739         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
26740         *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
26741         return tag_ptr(ret_conv, true);
26742 }
26743
26744 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_err"))) TS_CResult_boolPeerHandleErrorZ_err(uint64_t e) {
26745         LDKPeerHandleError e_conv;
26746         e_conv.inner = untag_ptr(e);
26747         e_conv.is_owned = ptr_is_owned(e);
26748         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
26749         e_conv = PeerHandleError_clone(&e_conv);
26750         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
26751         *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
26752         return tag_ptr(ret_conv, true);
26753 }
26754
26755 jboolean  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_is_ok"))) TS_CResult_boolPeerHandleErrorZ_is_ok(uint64_t o) {
26756         LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(o);
26757         jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
26758         return ret_conv;
26759 }
26760
26761 void  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_free"))) TS_CResult_boolPeerHandleErrorZ_free(uint64_t _res) {
26762         if (!ptr_is_owned(_res)) return;
26763         void* _res_ptr = untag_ptr(_res);
26764         CHECK_ACCESS(_res_ptr);
26765         LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
26766         FREE(untag_ptr(_res));
26767         CResult_boolPeerHandleErrorZ_free(_res_conv);
26768 }
26769
26770 static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
26771         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
26772         *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
26773         return tag_ptr(ret_conv, true);
26774 }
26775 int64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone_ptr"))) TS_CResult_boolPeerHandleErrorZ_clone_ptr(uint64_t arg) {
26776         LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(arg);
26777         int64_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
26778         return ret_conv;
26779 }
26780
26781 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone"))) TS_CResult_boolPeerHandleErrorZ_clone(uint64_t orig) {
26782         LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(orig);
26783         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
26784         *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
26785         return tag_ptr(ret_conv, true);
26786 }
26787
26788 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_ok"))) TS_CResult_u32GraphSyncErrorZ_ok(int32_t o) {
26789         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
26790         *ret_conv = CResult_u32GraphSyncErrorZ_ok(o);
26791         return tag_ptr(ret_conv, true);
26792 }
26793
26794 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_err"))) TS_CResult_u32GraphSyncErrorZ_err(uint64_t e) {
26795         void* e_ptr = untag_ptr(e);
26796         CHECK_ACCESS(e_ptr);
26797         LDKGraphSyncError e_conv = *(LDKGraphSyncError*)(e_ptr);
26798         e_conv = GraphSyncError_clone((LDKGraphSyncError*)untag_ptr(e));
26799         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
26800         *ret_conv = CResult_u32GraphSyncErrorZ_err(e_conv);
26801         return tag_ptr(ret_conv, true);
26802 }
26803
26804 jboolean  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_is_ok"))) TS_CResult_u32GraphSyncErrorZ_is_ok(uint64_t o) {
26805         LDKCResult_u32GraphSyncErrorZ* o_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(o);
26806         jboolean ret_conv = CResult_u32GraphSyncErrorZ_is_ok(o_conv);
26807         return ret_conv;
26808 }
26809
26810 void  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_free"))) TS_CResult_u32GraphSyncErrorZ_free(uint64_t _res) {
26811         if (!ptr_is_owned(_res)) return;
26812         void* _res_ptr = untag_ptr(_res);
26813         CHECK_ACCESS(_res_ptr);
26814         LDKCResult_u32GraphSyncErrorZ _res_conv = *(LDKCResult_u32GraphSyncErrorZ*)(_res_ptr);
26815         FREE(untag_ptr(_res));
26816         CResult_u32GraphSyncErrorZ_free(_res_conv);
26817 }
26818
26819 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_ok"))) TS_CResult_CVec_u8ZIOErrorZ_ok(int8_tArray o) {
26820         LDKCVec_u8Z o_ref;
26821         o_ref.datalen = o->arr_len;
26822         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
26823         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
26824         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
26825         *ret_conv = CResult_CVec_u8ZIOErrorZ_ok(o_ref);
26826         return tag_ptr(ret_conv, true);
26827 }
26828
26829 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_err"))) TS_CResult_CVec_u8ZIOErrorZ_err(uint32_t e) {
26830         LDKIOError e_conv = LDKIOError_from_js(e);
26831         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
26832         *ret_conv = CResult_CVec_u8ZIOErrorZ_err(e_conv);
26833         return tag_ptr(ret_conv, true);
26834 }
26835
26836 jboolean  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_is_ok"))) TS_CResult_CVec_u8ZIOErrorZ_is_ok(uint64_t o) {
26837         LDKCResult_CVec_u8ZIOErrorZ* o_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(o);
26838         jboolean ret_conv = CResult_CVec_u8ZIOErrorZ_is_ok(o_conv);
26839         return ret_conv;
26840 }
26841
26842 void  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_free"))) TS_CResult_CVec_u8ZIOErrorZ_free(uint64_t _res) {
26843         if (!ptr_is_owned(_res)) return;
26844         void* _res_ptr = untag_ptr(_res);
26845         CHECK_ACCESS(_res_ptr);
26846         LDKCResult_CVec_u8ZIOErrorZ _res_conv = *(LDKCResult_CVec_u8ZIOErrorZ*)(_res_ptr);
26847         FREE(untag_ptr(_res));
26848         CResult_CVec_u8ZIOErrorZ_free(_res_conv);
26849 }
26850
26851 static inline uint64_t CResult_CVec_u8ZIOErrorZ_clone_ptr(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR arg) {
26852         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
26853         *ret_conv = CResult_CVec_u8ZIOErrorZ_clone(arg);
26854         return tag_ptr(ret_conv, true);
26855 }
26856 int64_t  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_clone_ptr"))) TS_CResult_CVec_u8ZIOErrorZ_clone_ptr(uint64_t arg) {
26857         LDKCResult_CVec_u8ZIOErrorZ* arg_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(arg);
26858         int64_t ret_conv = CResult_CVec_u8ZIOErrorZ_clone_ptr(arg_conv);
26859         return ret_conv;
26860 }
26861
26862 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_clone"))) TS_CResult_CVec_u8ZIOErrorZ_clone(uint64_t orig) {
26863         LDKCResult_CVec_u8ZIOErrorZ* orig_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(orig);
26864         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
26865         *ret_conv = CResult_CVec_u8ZIOErrorZ_clone(orig_conv);
26866         return tag_ptr(ret_conv, true);
26867 }
26868
26869 uint64_t  __attribute__((export_name("TS_CResult_NoneIOErrorZ_ok"))) TS_CResult_NoneIOErrorZ_ok() {
26870         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
26871         *ret_conv = CResult_NoneIOErrorZ_ok();
26872         return tag_ptr(ret_conv, true);
26873 }
26874
26875 uint64_t  __attribute__((export_name("TS_CResult_NoneIOErrorZ_err"))) TS_CResult_NoneIOErrorZ_err(uint32_t e) {
26876         LDKIOError e_conv = LDKIOError_from_js(e);
26877         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
26878         *ret_conv = CResult_NoneIOErrorZ_err(e_conv);
26879         return tag_ptr(ret_conv, true);
26880 }
26881
26882 jboolean  __attribute__((export_name("TS_CResult_NoneIOErrorZ_is_ok"))) TS_CResult_NoneIOErrorZ_is_ok(uint64_t o) {
26883         LDKCResult_NoneIOErrorZ* o_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(o);
26884         jboolean ret_conv = CResult_NoneIOErrorZ_is_ok(o_conv);
26885         return ret_conv;
26886 }
26887
26888 void  __attribute__((export_name("TS_CResult_NoneIOErrorZ_free"))) TS_CResult_NoneIOErrorZ_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_NoneIOErrorZ _res_conv = *(LDKCResult_NoneIOErrorZ*)(_res_ptr);
26893         FREE(untag_ptr(_res));
26894         CResult_NoneIOErrorZ_free(_res_conv);
26895 }
26896
26897 static inline uint64_t CResult_NoneIOErrorZ_clone_ptr(LDKCResult_NoneIOErrorZ *NONNULL_PTR arg) {
26898         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
26899         *ret_conv = CResult_NoneIOErrorZ_clone(arg);
26900         return tag_ptr(ret_conv, true);
26901 }
26902 int64_t  __attribute__((export_name("TS_CResult_NoneIOErrorZ_clone_ptr"))) TS_CResult_NoneIOErrorZ_clone_ptr(uint64_t arg) {
26903         LDKCResult_NoneIOErrorZ* arg_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(arg);
26904         int64_t ret_conv = CResult_NoneIOErrorZ_clone_ptr(arg_conv);
26905         return ret_conv;
26906 }
26907
26908 uint64_t  __attribute__((export_name("TS_CResult_NoneIOErrorZ_clone"))) TS_CResult_NoneIOErrorZ_clone(uint64_t orig) {
26909         LDKCResult_NoneIOErrorZ* orig_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(orig);
26910         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
26911         *ret_conv = CResult_NoneIOErrorZ_clone(orig_conv);
26912         return tag_ptr(ret_conv, true);
26913 }
26914
26915 void  __attribute__((export_name("TS_CVec_StrZ_free"))) TS_CVec_StrZ_free(ptrArray _res) {
26916         LDKCVec_StrZ _res_constr;
26917         _res_constr.datalen = _res->arr_len;
26918         if (_res_constr.datalen > 0)
26919                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKStr), "LDKCVec_StrZ Elements");
26920         else
26921                 _res_constr.data = NULL;
26922         jstring* _res_vals = (void*) _res->elems;
26923         for (size_t i = 0; i < _res_constr.datalen; i++) {
26924                 jstring _res_conv_8 = _res_vals[i];
26925                 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
26926                 _res_constr.data[i] = dummy;
26927         }
26928         FREE(_res);
26929         CVec_StrZ_free(_res_constr);
26930 }
26931
26932 uint64_t  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_ok"))) TS_CResult_CVec_StrZIOErrorZ_ok(ptrArray o) {
26933         LDKCVec_StrZ o_constr;
26934         o_constr.datalen = o->arr_len;
26935         if (o_constr.datalen > 0)
26936                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKStr), "LDKCVec_StrZ Elements");
26937         else
26938                 o_constr.data = NULL;
26939         jstring* o_vals = (void*) o->elems;
26940         for (size_t i = 0; i < o_constr.datalen; i++) {
26941                 jstring o_conv_8 = o_vals[i];
26942                 LDKStr o_conv_8_conv = str_ref_to_owned_c(o_conv_8);
26943                 o_constr.data[i] = o_conv_8_conv;
26944         }
26945         FREE(o);
26946         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
26947         *ret_conv = CResult_CVec_StrZIOErrorZ_ok(o_constr);
26948         return tag_ptr(ret_conv, true);
26949 }
26950
26951 uint64_t  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_err"))) TS_CResult_CVec_StrZIOErrorZ_err(uint32_t e) {
26952         LDKIOError e_conv = LDKIOError_from_js(e);
26953         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
26954         *ret_conv = CResult_CVec_StrZIOErrorZ_err(e_conv);
26955         return tag_ptr(ret_conv, true);
26956 }
26957
26958 jboolean  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_is_ok"))) TS_CResult_CVec_StrZIOErrorZ_is_ok(uint64_t o) {
26959         LDKCResult_CVec_StrZIOErrorZ* o_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(o);
26960         jboolean ret_conv = CResult_CVec_StrZIOErrorZ_is_ok(o_conv);
26961         return ret_conv;
26962 }
26963
26964 void  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_free"))) TS_CResult_CVec_StrZIOErrorZ_free(uint64_t _res) {
26965         if (!ptr_is_owned(_res)) return;
26966         void* _res_ptr = untag_ptr(_res);
26967         CHECK_ACCESS(_res_ptr);
26968         LDKCResult_CVec_StrZIOErrorZ _res_conv = *(LDKCResult_CVec_StrZIOErrorZ*)(_res_ptr);
26969         FREE(untag_ptr(_res));
26970         CResult_CVec_StrZIOErrorZ_free(_res_conv);
26971 }
26972
26973 static inline uint64_t CResult_CVec_StrZIOErrorZ_clone_ptr(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR arg) {
26974         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
26975         *ret_conv = CResult_CVec_StrZIOErrorZ_clone(arg);
26976         return tag_ptr(ret_conv, true);
26977 }
26978 int64_t  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_clone_ptr"))) TS_CResult_CVec_StrZIOErrorZ_clone_ptr(uint64_t arg) {
26979         LDKCResult_CVec_StrZIOErrorZ* arg_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(arg);
26980         int64_t ret_conv = CResult_CVec_StrZIOErrorZ_clone_ptr(arg_conv);
26981         return ret_conv;
26982 }
26983
26984 uint64_t  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_clone"))) TS_CResult_CVec_StrZIOErrorZ_clone(uint64_t orig) {
26985         LDKCResult_CVec_StrZIOErrorZ* orig_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(orig);
26986         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
26987         *ret_conv = CResult_CVec_StrZIOErrorZ_clone(orig_conv);
26988         return tag_ptr(ret_conv, true);
26989 }
26990
26991 void  __attribute__((export_name("TS_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free"))) TS_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(uint64_tArray _res) {
26992         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ _res_constr;
26993         _res_constr.datalen = _res->arr_len;
26994         if (_res_constr.datalen > 0)
26995                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ Elements");
26996         else
26997                 _res_constr.data = NULL;
26998         uint64_t* _res_vals = _res->elems;
26999         for (size_t o = 0; o < _res_constr.datalen; o++) {
27000                 uint64_t _res_conv_40 = _res_vals[o];
27001                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
27002                 CHECK_ACCESS(_res_conv_40_ptr);
27003                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ _res_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(_res_conv_40_ptr);
27004                 FREE(untag_ptr(_res_conv_40));
27005                 _res_constr.data[o] = _res_conv_40_conv;
27006         }
27007         FREE(_res);
27008         CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(_res_constr);
27009 }
27010
27011 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(uint64_tArray o) {
27012         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ o_constr;
27013         o_constr.datalen = o->arr_len;
27014         if (o_constr.datalen > 0)
27015                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ Elements");
27016         else
27017                 o_constr.data = NULL;
27018         uint64_t* o_vals = o->elems;
27019         for (size_t o = 0; o < o_constr.datalen; o++) {
27020                 uint64_t o_conv_40 = o_vals[o];
27021                 void* o_conv_40_ptr = untag_ptr(o_conv_40);
27022                 CHECK_ACCESS(o_conv_40_ptr);
27023                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_conv_40_ptr);
27024                 o_conv_40_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o_conv_40));
27025                 o_constr.data[o] = o_conv_40_conv;
27026         }
27027         FREE(o);
27028         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
27029         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(o_constr);
27030         return tag_ptr(ret_conv, true);
27031 }
27032
27033 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(uint32_t e) {
27034         LDKIOError e_conv = LDKIOError_from_js(e);
27035         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
27036         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(e_conv);
27037         return tag_ptr(ret_conv, true);
27038 }
27039
27040 jboolean  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(uint64_t o) {
27041         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* o_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(o);
27042         jboolean ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(o_conv);
27043         return ret_conv;
27044 }
27045
27046 void  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(uint64_t _res) {
27047         if (!ptr_is_owned(_res)) return;
27048         void* _res_ptr = untag_ptr(_res);
27049         CHECK_ACCESS(_res_ptr);
27050         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)(_res_ptr);
27051         FREE(untag_ptr(_res));
27052         CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(_res_conv);
27053 }
27054
27055 static inline uint64_t CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR arg) {
27056         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
27057         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(arg);
27058         return tag_ptr(ret_conv, true);
27059 }
27060 int64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(uint64_t arg) {
27061         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* arg_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(arg);
27062         int64_t ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(arg_conv);
27063         return ret_conv;
27064 }
27065
27066 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(uint64_t orig) {
27067         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(orig);
27068         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
27069         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(orig_conv);
27070         return tag_ptr(ret_conv, true);
27071 }
27072
27073 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(uint64_t o) {
27074         void* o_ptr = untag_ptr(o);
27075         CHECK_ACCESS(o_ptr);
27076         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_ptr);
27077         o_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o));
27078         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
27079         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(o_conv);
27080         return tag_ptr(ret_conv, true);
27081 }
27082
27083 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(uint32_t e) {
27084         LDKIOError e_conv = LDKIOError_from_js(e);
27085         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
27086         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(e_conv);
27087         return tag_ptr(ret_conv, true);
27088 }
27089
27090 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(uint64_t o) {
27091         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(o);
27092         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(o_conv);
27093         return ret_conv;
27094 }
27095
27096 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(uint64_t _res) {
27097         if (!ptr_is_owned(_res)) return;
27098         void* _res_ptr = untag_ptr(_res);
27099         CHECK_ACCESS(_res_ptr);
27100         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)(_res_ptr);
27101         FREE(untag_ptr(_res));
27102         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(_res_conv);
27103 }
27104
27105 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR arg) {
27106         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
27107         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(arg);
27108         return tag_ptr(ret_conv, true);
27109 }
27110 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(uint64_t arg) {
27111         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(arg);
27112         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(arg_conv);
27113         return ret_conv;
27114 }
27115
27116 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(uint64_t orig) {
27117         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(orig);
27118         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
27119         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(orig_conv);
27120         return tag_ptr(ret_conv, true);
27121 }
27122
27123 uint64_t  __attribute__((export_name("TS_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_ok"))) TS_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_ok(uint64_t o) {
27124         LDKUnsignedInvoiceRequest o_conv;
27125         o_conv.inner = untag_ptr(o);
27126         o_conv.is_owned = ptr_is_owned(o);
27127         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27128         o_conv = UnsignedInvoiceRequest_clone(&o_conv);
27129         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ), "LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ");
27130         *ret_conv = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_ok(o_conv);
27131         return tag_ptr(ret_conv, true);
27132 }
27133
27134 uint64_t  __attribute__((export_name("TS_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_err"))) TS_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_err(uint32_t e) {
27135         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_js(e);
27136         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ), "LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ");
27137         *ret_conv = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_err(e_conv);
27138         return tag_ptr(ret_conv, true);
27139 }
27140
27141 jboolean  __attribute__((export_name("TS_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_is_ok"))) TS_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_is_ok(uint64_t o) {
27142         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* o_conv = (LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ*)untag_ptr(o);
27143         jboolean ret_conv = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_is_ok(o_conv);
27144         return ret_conv;
27145 }
27146
27147 void  __attribute__((export_name("TS_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_free"))) TS_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_free(uint64_t _res) {
27148         if (!ptr_is_owned(_res)) return;
27149         void* _res_ptr = untag_ptr(_res);
27150         CHECK_ACCESS(_res_ptr);
27151         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ _res_conv = *(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ*)(_res_ptr);
27152         FREE(untag_ptr(_res));
27153         CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_free(_res_conv);
27154 }
27155
27156 static inline uint64_t CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone_ptr(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR arg) {
27157         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ), "LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ");
27158         *ret_conv = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone(arg);
27159         return tag_ptr(ret_conv, true);
27160 }
27161 int64_t  __attribute__((export_name("TS_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone_ptr"))) TS_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone_ptr(uint64_t arg) {
27162         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* arg_conv = (LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ*)untag_ptr(arg);
27163         int64_t ret_conv = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone_ptr(arg_conv);
27164         return ret_conv;
27165 }
27166
27167 uint64_t  __attribute__((export_name("TS_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone"))) TS_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone(uint64_t orig) {
27168         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* orig_conv = (LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ*)untag_ptr(orig);
27169         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ), "LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ");
27170         *ret_conv = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone(orig_conv);
27171         return tag_ptr(ret_conv, true);
27172 }
27173
27174 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestBolt12SemanticErrorZ_ok"))) TS_CResult_InvoiceRequestBolt12SemanticErrorZ_ok(uint64_t o) {
27175         LDKInvoiceRequest o_conv;
27176         o_conv.inner = untag_ptr(o);
27177         o_conv.is_owned = ptr_is_owned(o);
27178         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27179         o_conv = InvoiceRequest_clone(&o_conv);
27180         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestBolt12SemanticErrorZ");
27181         *ret_conv = CResult_InvoiceRequestBolt12SemanticErrorZ_ok(o_conv);
27182         return tag_ptr(ret_conv, true);
27183 }
27184
27185 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestBolt12SemanticErrorZ_err"))) TS_CResult_InvoiceRequestBolt12SemanticErrorZ_err(uint32_t e) {
27186         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_js(e);
27187         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestBolt12SemanticErrorZ");
27188         *ret_conv = CResult_InvoiceRequestBolt12SemanticErrorZ_err(e_conv);
27189         return tag_ptr(ret_conv, true);
27190 }
27191
27192 jboolean  __attribute__((export_name("TS_CResult_InvoiceRequestBolt12SemanticErrorZ_is_ok"))) TS_CResult_InvoiceRequestBolt12SemanticErrorZ_is_ok(uint64_t o) {
27193         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* o_conv = (LDKCResult_InvoiceRequestBolt12SemanticErrorZ*)untag_ptr(o);
27194         jboolean ret_conv = CResult_InvoiceRequestBolt12SemanticErrorZ_is_ok(o_conv);
27195         return ret_conv;
27196 }
27197
27198 void  __attribute__((export_name("TS_CResult_InvoiceRequestBolt12SemanticErrorZ_free"))) TS_CResult_InvoiceRequestBolt12SemanticErrorZ_free(uint64_t _res) {
27199         if (!ptr_is_owned(_res)) return;
27200         void* _res_ptr = untag_ptr(_res);
27201         CHECK_ACCESS(_res_ptr);
27202         LDKCResult_InvoiceRequestBolt12SemanticErrorZ _res_conv = *(LDKCResult_InvoiceRequestBolt12SemanticErrorZ*)(_res_ptr);
27203         FREE(untag_ptr(_res));
27204         CResult_InvoiceRequestBolt12SemanticErrorZ_free(_res_conv);
27205 }
27206
27207 static inline uint64_t CResult_InvoiceRequestBolt12SemanticErrorZ_clone_ptr(LDKCResult_InvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR arg) {
27208         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestBolt12SemanticErrorZ");
27209         *ret_conv = CResult_InvoiceRequestBolt12SemanticErrorZ_clone(arg);
27210         return tag_ptr(ret_conv, true);
27211 }
27212 int64_t  __attribute__((export_name("TS_CResult_InvoiceRequestBolt12SemanticErrorZ_clone_ptr"))) TS_CResult_InvoiceRequestBolt12SemanticErrorZ_clone_ptr(uint64_t arg) {
27213         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* arg_conv = (LDKCResult_InvoiceRequestBolt12SemanticErrorZ*)untag_ptr(arg);
27214         int64_t ret_conv = CResult_InvoiceRequestBolt12SemanticErrorZ_clone_ptr(arg_conv);
27215         return ret_conv;
27216 }
27217
27218 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestBolt12SemanticErrorZ_clone"))) TS_CResult_InvoiceRequestBolt12SemanticErrorZ_clone(uint64_t orig) {
27219         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* orig_conv = (LDKCResult_InvoiceRequestBolt12SemanticErrorZ*)untag_ptr(orig);
27220         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestBolt12SemanticErrorZ");
27221         *ret_conv = CResult_InvoiceRequestBolt12SemanticErrorZ_clone(orig_conv);
27222         return tag_ptr(ret_conv, true);
27223 }
27224
27225 uint64_t  __attribute__((export_name("TS_COption_SecretKeyZ_some"))) TS_COption_SecretKeyZ_some(int8_tArray o) {
27226         LDKSecretKey o_ref;
27227         CHECK(o->arr_len == 32);
27228         memcpy(o_ref.bytes, o->elems, 32); FREE(o);
27229         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
27230         *ret_copy = COption_SecretKeyZ_some(o_ref);
27231         uint64_t ret_ref = tag_ptr(ret_copy, true);
27232         return ret_ref;
27233 }
27234
27235 uint64_t  __attribute__((export_name("TS_COption_SecretKeyZ_none"))) TS_COption_SecretKeyZ_none() {
27236         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
27237         *ret_copy = COption_SecretKeyZ_none();
27238         uint64_t ret_ref = tag_ptr(ret_copy, true);
27239         return ret_ref;
27240 }
27241
27242 void  __attribute__((export_name("TS_COption_SecretKeyZ_free"))) TS_COption_SecretKeyZ_free(uint64_t _res) {
27243         if (!ptr_is_owned(_res)) return;
27244         void* _res_ptr = untag_ptr(_res);
27245         CHECK_ACCESS(_res_ptr);
27246         LDKCOption_SecretKeyZ _res_conv = *(LDKCOption_SecretKeyZ*)(_res_ptr);
27247         FREE(untag_ptr(_res));
27248         COption_SecretKeyZ_free(_res_conv);
27249 }
27250
27251 static inline uint64_t COption_SecretKeyZ_clone_ptr(LDKCOption_SecretKeyZ *NONNULL_PTR arg) {
27252         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
27253         *ret_copy = COption_SecretKeyZ_clone(arg);
27254         uint64_t ret_ref = tag_ptr(ret_copy, true);
27255         return ret_ref;
27256 }
27257 int64_t  __attribute__((export_name("TS_COption_SecretKeyZ_clone_ptr"))) TS_COption_SecretKeyZ_clone_ptr(uint64_t arg) {
27258         LDKCOption_SecretKeyZ* arg_conv = (LDKCOption_SecretKeyZ*)untag_ptr(arg);
27259         int64_t ret_conv = COption_SecretKeyZ_clone_ptr(arg_conv);
27260         return ret_conv;
27261 }
27262
27263 uint64_t  __attribute__((export_name("TS_COption_SecretKeyZ_clone"))) TS_COption_SecretKeyZ_clone(uint64_t orig) {
27264         LDKCOption_SecretKeyZ* orig_conv = (LDKCOption_SecretKeyZ*)untag_ptr(orig);
27265         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
27266         *ret_copy = COption_SecretKeyZ_clone(orig_conv);
27267         uint64_t ret_ref = tag_ptr(ret_copy, true);
27268         return ret_ref;
27269 }
27270
27271 uint64_t  __attribute__((export_name("TS_CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_ok"))) TS_CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_ok(uint64_t o) {
27272         LDKInvoiceWithExplicitSigningPubkeyBuilder o_conv;
27273         o_conv.inner = untag_ptr(o);
27274         o_conv.is_owned = ptr_is_owned(o);
27275         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27276         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
27277         
27278         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ");
27279         *ret_conv = CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_ok(o_conv);
27280         return tag_ptr(ret_conv, true);
27281 }
27282
27283 uint64_t  __attribute__((export_name("TS_CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_err"))) TS_CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_err(uint32_t e) {
27284         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_js(e);
27285         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ");
27286         *ret_conv = CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_err(e_conv);
27287         return tag_ptr(ret_conv, true);
27288 }
27289
27290 jboolean  __attribute__((export_name("TS_CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok"))) TS_CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(uint64_t o) {
27291         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* o_conv = (LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ*)untag_ptr(o);
27292         jboolean ret_conv = CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(o_conv);
27293         return ret_conv;
27294 }
27295
27296 void  __attribute__((export_name("TS_CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_free"))) TS_CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_free(uint64_t _res) {
27297         if (!ptr_is_owned(_res)) return;
27298         void* _res_ptr = untag_ptr(_res);
27299         CHECK_ACCESS(_res_ptr);
27300         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ _res_conv = *(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ*)(_res_ptr);
27301         FREE(untag_ptr(_res));
27302         CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_free(_res_conv);
27303 }
27304
27305 uint64_t  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_ok"))) TS_CResult_VerifiedInvoiceRequestNoneZ_ok(uint64_t o) {
27306         LDKVerifiedInvoiceRequest o_conv;
27307         o_conv.inner = untag_ptr(o);
27308         o_conv.is_owned = ptr_is_owned(o);
27309         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27310         o_conv = VerifiedInvoiceRequest_clone(&o_conv);
27311         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
27312         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_ok(o_conv);
27313         return tag_ptr(ret_conv, true);
27314 }
27315
27316 uint64_t  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_err"))) TS_CResult_VerifiedInvoiceRequestNoneZ_err() {
27317         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
27318         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_err();
27319         return tag_ptr(ret_conv, true);
27320 }
27321
27322 jboolean  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_is_ok"))) TS_CResult_VerifiedInvoiceRequestNoneZ_is_ok(uint64_t o) {
27323         LDKCResult_VerifiedInvoiceRequestNoneZ* o_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(o);
27324         jboolean ret_conv = CResult_VerifiedInvoiceRequestNoneZ_is_ok(o_conv);
27325         return ret_conv;
27326 }
27327
27328 void  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_free"))) TS_CResult_VerifiedInvoiceRequestNoneZ_free(uint64_t _res) {
27329         if (!ptr_is_owned(_res)) return;
27330         void* _res_ptr = untag_ptr(_res);
27331         CHECK_ACCESS(_res_ptr);
27332         LDKCResult_VerifiedInvoiceRequestNoneZ _res_conv = *(LDKCResult_VerifiedInvoiceRequestNoneZ*)(_res_ptr);
27333         FREE(untag_ptr(_res));
27334         CResult_VerifiedInvoiceRequestNoneZ_free(_res_conv);
27335 }
27336
27337 static inline uint64_t CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR arg) {
27338         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
27339         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone(arg);
27340         return tag_ptr(ret_conv, true);
27341 }
27342 int64_t  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_clone_ptr"))) TS_CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(uint64_t arg) {
27343         LDKCResult_VerifiedInvoiceRequestNoneZ* arg_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(arg);
27344         int64_t ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(arg_conv);
27345         return ret_conv;
27346 }
27347
27348 uint64_t  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_clone"))) TS_CResult_VerifiedInvoiceRequestNoneZ_clone(uint64_t orig) {
27349         LDKCResult_VerifiedInvoiceRequestNoneZ* orig_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(orig);
27350         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
27351         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone(orig_conv);
27352         return tag_ptr(ret_conv, true);
27353 }
27354
27355 uint64_t  __attribute__((export_name("TS_CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_ok"))) TS_CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_ok(uint64_t o) {
27356         LDKInvoiceWithDerivedSigningPubkeyBuilder o_conv;
27357         o_conv.inner = untag_ptr(o);
27358         o_conv.is_owned = ptr_is_owned(o);
27359         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27360         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
27361         
27362         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ");
27363         *ret_conv = CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_ok(o_conv);
27364         return tag_ptr(ret_conv, true);
27365 }
27366
27367 uint64_t  __attribute__((export_name("TS_CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_err"))) TS_CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_err(uint32_t e) {
27368         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_js(e);
27369         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ");
27370         *ret_conv = CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_err(e_conv);
27371         return tag_ptr(ret_conv, true);
27372 }
27373
27374 jboolean  __attribute__((export_name("TS_CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok"))) TS_CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(uint64_t o) {
27375         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* o_conv = (LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ*)untag_ptr(o);
27376         jboolean ret_conv = CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(o_conv);
27377         return ret_conv;
27378 }
27379
27380 void  __attribute__((export_name("TS_CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_free"))) TS_CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_free(uint64_t _res) {
27381         if (!ptr_is_owned(_res)) return;
27382         void* _res_ptr = untag_ptr(_res);
27383         CHECK_ACCESS(_res_ptr);
27384         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ _res_conv = *(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ*)(_res_ptr);
27385         FREE(untag_ptr(_res));
27386         CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_free(_res_conv);
27387 }
27388
27389 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestFieldsDecodeErrorZ_ok"))) TS_CResult_InvoiceRequestFieldsDecodeErrorZ_ok(uint64_t o) {
27390         LDKInvoiceRequestFields o_conv;
27391         o_conv.inner = untag_ptr(o);
27392         o_conv.is_owned = ptr_is_owned(o);
27393         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27394         o_conv = InvoiceRequestFields_clone(&o_conv);
27395         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFieldsDecodeErrorZ), "LDKCResult_InvoiceRequestFieldsDecodeErrorZ");
27396         *ret_conv = CResult_InvoiceRequestFieldsDecodeErrorZ_ok(o_conv);
27397         return tag_ptr(ret_conv, true);
27398 }
27399
27400 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestFieldsDecodeErrorZ_err"))) TS_CResult_InvoiceRequestFieldsDecodeErrorZ_err(uint64_t e) {
27401         void* e_ptr = untag_ptr(e);
27402         CHECK_ACCESS(e_ptr);
27403         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27404         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27405         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFieldsDecodeErrorZ), "LDKCResult_InvoiceRequestFieldsDecodeErrorZ");
27406         *ret_conv = CResult_InvoiceRequestFieldsDecodeErrorZ_err(e_conv);
27407         return tag_ptr(ret_conv, true);
27408 }
27409
27410 jboolean  __attribute__((export_name("TS_CResult_InvoiceRequestFieldsDecodeErrorZ_is_ok"))) TS_CResult_InvoiceRequestFieldsDecodeErrorZ_is_ok(uint64_t o) {
27411         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* o_conv = (LDKCResult_InvoiceRequestFieldsDecodeErrorZ*)untag_ptr(o);
27412         jboolean ret_conv = CResult_InvoiceRequestFieldsDecodeErrorZ_is_ok(o_conv);
27413         return ret_conv;
27414 }
27415
27416 void  __attribute__((export_name("TS_CResult_InvoiceRequestFieldsDecodeErrorZ_free"))) TS_CResult_InvoiceRequestFieldsDecodeErrorZ_free(uint64_t _res) {
27417         if (!ptr_is_owned(_res)) return;
27418         void* _res_ptr = untag_ptr(_res);
27419         CHECK_ACCESS(_res_ptr);
27420         LDKCResult_InvoiceRequestFieldsDecodeErrorZ _res_conv = *(LDKCResult_InvoiceRequestFieldsDecodeErrorZ*)(_res_ptr);
27421         FREE(untag_ptr(_res));
27422         CResult_InvoiceRequestFieldsDecodeErrorZ_free(_res_conv);
27423 }
27424
27425 static inline uint64_t CResult_InvoiceRequestFieldsDecodeErrorZ_clone_ptr(LDKCResult_InvoiceRequestFieldsDecodeErrorZ *NONNULL_PTR arg) {
27426         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFieldsDecodeErrorZ), "LDKCResult_InvoiceRequestFieldsDecodeErrorZ");
27427         *ret_conv = CResult_InvoiceRequestFieldsDecodeErrorZ_clone(arg);
27428         return tag_ptr(ret_conv, true);
27429 }
27430 int64_t  __attribute__((export_name("TS_CResult_InvoiceRequestFieldsDecodeErrorZ_clone_ptr"))) TS_CResult_InvoiceRequestFieldsDecodeErrorZ_clone_ptr(uint64_t arg) {
27431         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* arg_conv = (LDKCResult_InvoiceRequestFieldsDecodeErrorZ*)untag_ptr(arg);
27432         int64_t ret_conv = CResult_InvoiceRequestFieldsDecodeErrorZ_clone_ptr(arg_conv);
27433         return ret_conv;
27434 }
27435
27436 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestFieldsDecodeErrorZ_clone"))) TS_CResult_InvoiceRequestFieldsDecodeErrorZ_clone(uint64_t orig) {
27437         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* orig_conv = (LDKCResult_InvoiceRequestFieldsDecodeErrorZ*)untag_ptr(orig);
27438         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFieldsDecodeErrorZ), "LDKCResult_InvoiceRequestFieldsDecodeErrorZ");
27439         *ret_conv = CResult_InvoiceRequestFieldsDecodeErrorZ_clone(orig_conv);
27440         return tag_ptr(ret_conv, true);
27441 }
27442
27443 uint32_t  __attribute__((export_name("TS_COption_NoneZ_some"))) TS_COption_NoneZ_some() {
27444         uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_some());
27445         return ret_conv;
27446 }
27447
27448 uint32_t  __attribute__((export_name("TS_COption_NoneZ_none"))) TS_COption_NoneZ_none() {
27449         uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_none());
27450         return ret_conv;
27451 }
27452
27453 void  __attribute__((export_name("TS_COption_NoneZ_free"))) TS_COption_NoneZ_free(uint32_t _res) {
27454         LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_js(_res);
27455         COption_NoneZ_free(_res_conv);
27456 }
27457
27458 void  __attribute__((export_name("TS_CVec_WitnessZ_free"))) TS_CVec_WitnessZ_free(ptrArray _res) {
27459         LDKCVec_WitnessZ _res_constr;
27460         _res_constr.datalen = _res->arr_len;
27461         if (_res_constr.datalen > 0)
27462                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
27463         else
27464                 _res_constr.data = NULL;
27465         int8_tArray* _res_vals = (void*) _res->elems;
27466         for (size_t m = 0; m < _res_constr.datalen; m++) {
27467                 int8_tArray _res_conv_12 = _res_vals[m];
27468                 LDKWitness _res_conv_12_ref;
27469                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
27470                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKWitness Bytes");
27471                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
27472                 _res_conv_12_ref.data_is_owned = true;
27473                 _res_constr.data[m] = _res_conv_12_ref;
27474         }
27475         FREE(_res);
27476         CVec_WitnessZ_free(_res_constr);
27477 }
27478
27479 uint64_t  __attribute__((export_name("TS_COption_ECDSASignatureZ_some"))) TS_COption_ECDSASignatureZ_some(int8_tArray o) {
27480         LDKECDSASignature o_ref;
27481         CHECK(o->arr_len == 64);
27482         memcpy(o_ref.compact_form, o->elems, 64); FREE(o);
27483         LDKCOption_ECDSASignatureZ *ret_copy = MALLOC(sizeof(LDKCOption_ECDSASignatureZ), "LDKCOption_ECDSASignatureZ");
27484         *ret_copy = COption_ECDSASignatureZ_some(o_ref);
27485         uint64_t ret_ref = tag_ptr(ret_copy, true);
27486         return ret_ref;
27487 }
27488
27489 uint64_t  __attribute__((export_name("TS_COption_ECDSASignatureZ_none"))) TS_COption_ECDSASignatureZ_none() {
27490         LDKCOption_ECDSASignatureZ *ret_copy = MALLOC(sizeof(LDKCOption_ECDSASignatureZ), "LDKCOption_ECDSASignatureZ");
27491         *ret_copy = COption_ECDSASignatureZ_none();
27492         uint64_t ret_ref = tag_ptr(ret_copy, true);
27493         return ret_ref;
27494 }
27495
27496 void  __attribute__((export_name("TS_COption_ECDSASignatureZ_free"))) TS_COption_ECDSASignatureZ_free(uint64_t _res) {
27497         if (!ptr_is_owned(_res)) return;
27498         void* _res_ptr = untag_ptr(_res);
27499         CHECK_ACCESS(_res_ptr);
27500         LDKCOption_ECDSASignatureZ _res_conv = *(LDKCOption_ECDSASignatureZ*)(_res_ptr);
27501         FREE(untag_ptr(_res));
27502         COption_ECDSASignatureZ_free(_res_conv);
27503 }
27504
27505 static inline uint64_t COption_ECDSASignatureZ_clone_ptr(LDKCOption_ECDSASignatureZ *NONNULL_PTR arg) {
27506         LDKCOption_ECDSASignatureZ *ret_copy = MALLOC(sizeof(LDKCOption_ECDSASignatureZ), "LDKCOption_ECDSASignatureZ");
27507         *ret_copy = COption_ECDSASignatureZ_clone(arg);
27508         uint64_t ret_ref = tag_ptr(ret_copy, true);
27509         return ret_ref;
27510 }
27511 int64_t  __attribute__((export_name("TS_COption_ECDSASignatureZ_clone_ptr"))) TS_COption_ECDSASignatureZ_clone_ptr(uint64_t arg) {
27512         LDKCOption_ECDSASignatureZ* arg_conv = (LDKCOption_ECDSASignatureZ*)untag_ptr(arg);
27513         int64_t ret_conv = COption_ECDSASignatureZ_clone_ptr(arg_conv);
27514         return ret_conv;
27515 }
27516
27517 uint64_t  __attribute__((export_name("TS_COption_ECDSASignatureZ_clone"))) TS_COption_ECDSASignatureZ_clone(uint64_t orig) {
27518         LDKCOption_ECDSASignatureZ* orig_conv = (LDKCOption_ECDSASignatureZ*)untag_ptr(orig);
27519         LDKCOption_ECDSASignatureZ *ret_copy = MALLOC(sizeof(LDKCOption_ECDSASignatureZ), "LDKCOption_ECDSASignatureZ");
27520         *ret_copy = COption_ECDSASignatureZ_clone(orig_conv);
27521         uint64_t ret_ref = tag_ptr(ret_copy, true);
27522         return ret_ref;
27523 }
27524
27525 uint64_t  __attribute__((export_name("TS_COption_i64Z_some"))) TS_COption_i64Z_some(int64_t o) {
27526         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
27527         *ret_copy = COption_i64Z_some(o);
27528         uint64_t ret_ref = tag_ptr(ret_copy, true);
27529         return ret_ref;
27530 }
27531
27532 uint64_t  __attribute__((export_name("TS_COption_i64Z_none"))) TS_COption_i64Z_none() {
27533         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
27534         *ret_copy = COption_i64Z_none();
27535         uint64_t ret_ref = tag_ptr(ret_copy, true);
27536         return ret_ref;
27537 }
27538
27539 void  __attribute__((export_name("TS_COption_i64Z_free"))) TS_COption_i64Z_free(uint64_t _res) {
27540         if (!ptr_is_owned(_res)) return;
27541         void* _res_ptr = untag_ptr(_res);
27542         CHECK_ACCESS(_res_ptr);
27543         LDKCOption_i64Z _res_conv = *(LDKCOption_i64Z*)(_res_ptr);
27544         FREE(untag_ptr(_res));
27545         COption_i64Z_free(_res_conv);
27546 }
27547
27548 static inline uint64_t COption_i64Z_clone_ptr(LDKCOption_i64Z *NONNULL_PTR arg) {
27549         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
27550         *ret_copy = COption_i64Z_clone(arg);
27551         uint64_t ret_ref = tag_ptr(ret_copy, true);
27552         return ret_ref;
27553 }
27554 int64_t  __attribute__((export_name("TS_COption_i64Z_clone_ptr"))) TS_COption_i64Z_clone_ptr(uint64_t arg) {
27555         LDKCOption_i64Z* arg_conv = (LDKCOption_i64Z*)untag_ptr(arg);
27556         int64_t ret_conv = COption_i64Z_clone_ptr(arg_conv);
27557         return ret_conv;
27558 }
27559
27560 uint64_t  __attribute__((export_name("TS_COption_i64Z_clone"))) TS_COption_i64Z_clone(uint64_t orig) {
27561         LDKCOption_i64Z* orig_conv = (LDKCOption_i64Z*)untag_ptr(orig);
27562         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
27563         *ret_copy = COption_i64Z_clone(orig_conv);
27564         uint64_t ret_ref = tag_ptr(ret_copy, true);
27565         return ret_ref;
27566 }
27567
27568 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_ok"))) TS_CResult_SocketAddressDecodeErrorZ_ok(uint64_t o) {
27569         void* o_ptr = untag_ptr(o);
27570         CHECK_ACCESS(o_ptr);
27571         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
27572         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
27573         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
27574         *ret_conv = CResult_SocketAddressDecodeErrorZ_ok(o_conv);
27575         return tag_ptr(ret_conv, true);
27576 }
27577
27578 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_err"))) TS_CResult_SocketAddressDecodeErrorZ_err(uint64_t e) {
27579         void* e_ptr = untag_ptr(e);
27580         CHECK_ACCESS(e_ptr);
27581         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27582         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27583         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
27584         *ret_conv = CResult_SocketAddressDecodeErrorZ_err(e_conv);
27585         return tag_ptr(ret_conv, true);
27586 }
27587
27588 jboolean  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_is_ok"))) TS_CResult_SocketAddressDecodeErrorZ_is_ok(uint64_t o) {
27589         LDKCResult_SocketAddressDecodeErrorZ* o_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(o);
27590         jboolean ret_conv = CResult_SocketAddressDecodeErrorZ_is_ok(o_conv);
27591         return ret_conv;
27592 }
27593
27594 void  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_free"))) TS_CResult_SocketAddressDecodeErrorZ_free(uint64_t _res) {
27595         if (!ptr_is_owned(_res)) return;
27596         void* _res_ptr = untag_ptr(_res);
27597         CHECK_ACCESS(_res_ptr);
27598         LDKCResult_SocketAddressDecodeErrorZ _res_conv = *(LDKCResult_SocketAddressDecodeErrorZ*)(_res_ptr);
27599         FREE(untag_ptr(_res));
27600         CResult_SocketAddressDecodeErrorZ_free(_res_conv);
27601 }
27602
27603 static inline uint64_t CResult_SocketAddressDecodeErrorZ_clone_ptr(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR arg) {
27604         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
27605         *ret_conv = CResult_SocketAddressDecodeErrorZ_clone(arg);
27606         return tag_ptr(ret_conv, true);
27607 }
27608 int64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_clone_ptr"))) TS_CResult_SocketAddressDecodeErrorZ_clone_ptr(uint64_t arg) {
27609         LDKCResult_SocketAddressDecodeErrorZ* arg_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(arg);
27610         int64_t ret_conv = CResult_SocketAddressDecodeErrorZ_clone_ptr(arg_conv);
27611         return ret_conv;
27612 }
27613
27614 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_clone"))) TS_CResult_SocketAddressDecodeErrorZ_clone(uint64_t orig) {
27615         LDKCResult_SocketAddressDecodeErrorZ* orig_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(orig);
27616         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
27617         *ret_conv = CResult_SocketAddressDecodeErrorZ_clone(orig_conv);
27618         return tag_ptr(ret_conv, true);
27619 }
27620
27621 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_ok"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_ok(uint64_t o) {
27622         void* o_ptr = untag_ptr(o);
27623         CHECK_ACCESS(o_ptr);
27624         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
27625         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
27626         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
27627         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_ok(o_conv);
27628         return tag_ptr(ret_conv, true);
27629 }
27630
27631 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_err"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_err(uint32_t e) {
27632         LDKSocketAddressParseError e_conv = LDKSocketAddressParseError_from_js(e);
27633         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
27634         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_err(e_conv);
27635         return tag_ptr(ret_conv, true);
27636 }
27637
27638 jboolean  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_is_ok"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_is_ok(uint64_t o) {
27639         LDKCResult_SocketAddressSocketAddressParseErrorZ* o_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(o);
27640         jboolean ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_is_ok(o_conv);
27641         return ret_conv;
27642 }
27643
27644 void  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_free"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_free(uint64_t _res) {
27645         if (!ptr_is_owned(_res)) return;
27646         void* _res_ptr = untag_ptr(_res);
27647         CHECK_ACCESS(_res_ptr);
27648         LDKCResult_SocketAddressSocketAddressParseErrorZ _res_conv = *(LDKCResult_SocketAddressSocketAddressParseErrorZ*)(_res_ptr);
27649         FREE(untag_ptr(_res));
27650         CResult_SocketAddressSocketAddressParseErrorZ_free(_res_conv);
27651 }
27652
27653 static inline uint64_t CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR arg) {
27654         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
27655         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone(arg);
27656         return tag_ptr(ret_conv, true);
27657 }
27658 int64_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(uint64_t arg) {
27659         LDKCResult_SocketAddressSocketAddressParseErrorZ* arg_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(arg);
27660         int64_t ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(arg_conv);
27661         return ret_conv;
27662 }
27663
27664 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_clone"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_clone(uint64_t orig) {
27665         LDKCResult_SocketAddressSocketAddressParseErrorZ* orig_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(orig);
27666         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
27667         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone(orig_conv);
27668         return tag_ptr(ret_conv, true);
27669 }
27670
27671 void  __attribute__((export_name("TS_CVec_UpdateAddHTLCZ_free"))) TS_CVec_UpdateAddHTLCZ_free(uint64_tArray _res) {
27672         LDKCVec_UpdateAddHTLCZ _res_constr;
27673         _res_constr.datalen = _res->arr_len;
27674         if (_res_constr.datalen > 0)
27675                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
27676         else
27677                 _res_constr.data = NULL;
27678         uint64_t* _res_vals = _res->elems;
27679         for (size_t p = 0; p < _res_constr.datalen; p++) {
27680                 uint64_t _res_conv_15 = _res_vals[p];
27681                 LDKUpdateAddHTLC _res_conv_15_conv;
27682                 _res_conv_15_conv.inner = untag_ptr(_res_conv_15);
27683                 _res_conv_15_conv.is_owned = ptr_is_owned(_res_conv_15);
27684                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
27685                 _res_constr.data[p] = _res_conv_15_conv;
27686         }
27687         FREE(_res);
27688         CVec_UpdateAddHTLCZ_free(_res_constr);
27689 }
27690
27691 void  __attribute__((export_name("TS_CVec_UpdateFulfillHTLCZ_free"))) TS_CVec_UpdateFulfillHTLCZ_free(uint64_tArray _res) {
27692         LDKCVec_UpdateFulfillHTLCZ _res_constr;
27693         _res_constr.datalen = _res->arr_len;
27694         if (_res_constr.datalen > 0)
27695                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
27696         else
27697                 _res_constr.data = NULL;
27698         uint64_t* _res_vals = _res->elems;
27699         for (size_t t = 0; t < _res_constr.datalen; t++) {
27700                 uint64_t _res_conv_19 = _res_vals[t];
27701                 LDKUpdateFulfillHTLC _res_conv_19_conv;
27702                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
27703                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
27704                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
27705                 _res_constr.data[t] = _res_conv_19_conv;
27706         }
27707         FREE(_res);
27708         CVec_UpdateFulfillHTLCZ_free(_res_constr);
27709 }
27710
27711 void  __attribute__((export_name("TS_CVec_UpdateFailHTLCZ_free"))) TS_CVec_UpdateFailHTLCZ_free(uint64_tArray _res) {
27712         LDKCVec_UpdateFailHTLCZ _res_constr;
27713         _res_constr.datalen = _res->arr_len;
27714         if (_res_constr.datalen > 0)
27715                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
27716         else
27717                 _res_constr.data = NULL;
27718         uint64_t* _res_vals = _res->elems;
27719         for (size_t q = 0; q < _res_constr.datalen; q++) {
27720                 uint64_t _res_conv_16 = _res_vals[q];
27721                 LDKUpdateFailHTLC _res_conv_16_conv;
27722                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
27723                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
27724                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
27725                 _res_constr.data[q] = _res_conv_16_conv;
27726         }
27727         FREE(_res);
27728         CVec_UpdateFailHTLCZ_free(_res_constr);
27729 }
27730
27731 void  __attribute__((export_name("TS_CVec_UpdateFailMalformedHTLCZ_free"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint64_tArray _res) {
27732         LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
27733         _res_constr.datalen = _res->arr_len;
27734         if (_res_constr.datalen > 0)
27735                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
27736         else
27737                 _res_constr.data = NULL;
27738         uint64_t* _res_vals = _res->elems;
27739         for (size_t z = 0; z < _res_constr.datalen; z++) {
27740                 uint64_t _res_conv_25 = _res_vals[z];
27741                 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
27742                 _res_conv_25_conv.inner = untag_ptr(_res_conv_25);
27743                 _res_conv_25_conv.is_owned = ptr_is_owned(_res_conv_25);
27744                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
27745                 _res_constr.data[z] = _res_conv_25_conv;
27746         }
27747         FREE(_res);
27748         CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
27749 }
27750
27751 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint64_t o) {
27752         LDKAcceptChannel o_conv;
27753         o_conv.inner = untag_ptr(o);
27754         o_conv.is_owned = ptr_is_owned(o);
27755         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27756         o_conv = AcceptChannel_clone(&o_conv);
27757         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
27758         *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
27759         return tag_ptr(ret_conv, true);
27760 }
27761
27762 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_err"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint64_t e) {
27763         void* e_ptr = untag_ptr(e);
27764         CHECK_ACCESS(e_ptr);
27765         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27766         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27767         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
27768         *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
27769         return tag_ptr(ret_conv, true);
27770 }
27771
27772 jboolean  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_is_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_is_ok(uint64_t o) {
27773         LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(o);
27774         jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
27775         return ret_conv;
27776 }
27777
27778 void  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_free"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint64_t _res) {
27779         if (!ptr_is_owned(_res)) return;
27780         void* _res_ptr = untag_ptr(_res);
27781         CHECK_ACCESS(_res_ptr);
27782         LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
27783         FREE(untag_ptr(_res));
27784         CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
27785 }
27786
27787 static inline uint64_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
27788         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
27789         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
27790         return tag_ptr(ret_conv, true);
27791 }
27792 int64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr"))) TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr(uint64_t arg) {
27793         LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(arg);
27794         int64_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
27795         return ret_conv;
27796 }
27797
27798 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint64_t orig) {
27799         LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(orig);
27800         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
27801         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
27802         return tag_ptr(ret_conv, true);
27803 }
27804
27805 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_ok"))) TS_CResult_AcceptChannelV2DecodeErrorZ_ok(uint64_t o) {
27806         LDKAcceptChannelV2 o_conv;
27807         o_conv.inner = untag_ptr(o);
27808         o_conv.is_owned = ptr_is_owned(o);
27809         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27810         o_conv = AcceptChannelV2_clone(&o_conv);
27811         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
27812         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_ok(o_conv);
27813         return tag_ptr(ret_conv, true);
27814 }
27815
27816 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_err"))) TS_CResult_AcceptChannelV2DecodeErrorZ_err(uint64_t e) {
27817         void* e_ptr = untag_ptr(e);
27818         CHECK_ACCESS(e_ptr);
27819         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27820         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27821         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
27822         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_err(e_conv);
27823         return tag_ptr(ret_conv, true);
27824 }
27825
27826 jboolean  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_is_ok"))) TS_CResult_AcceptChannelV2DecodeErrorZ_is_ok(uint64_t o) {
27827         LDKCResult_AcceptChannelV2DecodeErrorZ* o_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(o);
27828         jboolean ret_conv = CResult_AcceptChannelV2DecodeErrorZ_is_ok(o_conv);
27829         return ret_conv;
27830 }
27831
27832 void  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_free"))) TS_CResult_AcceptChannelV2DecodeErrorZ_free(uint64_t _res) {
27833         if (!ptr_is_owned(_res)) return;
27834         void* _res_ptr = untag_ptr(_res);
27835         CHECK_ACCESS(_res_ptr);
27836         LDKCResult_AcceptChannelV2DecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelV2DecodeErrorZ*)(_res_ptr);
27837         FREE(untag_ptr(_res));
27838         CResult_AcceptChannelV2DecodeErrorZ_free(_res_conv);
27839 }
27840
27841 static inline uint64_t CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR arg) {
27842         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
27843         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone(arg);
27844         return tag_ptr(ret_conv, true);
27845 }
27846 int64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_clone_ptr"))) TS_CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(uint64_t arg) {
27847         LDKCResult_AcceptChannelV2DecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(arg);
27848         int64_t ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(arg_conv);
27849         return ret_conv;
27850 }
27851
27852 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_clone"))) TS_CResult_AcceptChannelV2DecodeErrorZ_clone(uint64_t orig) {
27853         LDKCResult_AcceptChannelV2DecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(orig);
27854         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
27855         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone(orig_conv);
27856         return tag_ptr(ret_conv, true);
27857 }
27858
27859 uint64_t  __attribute__((export_name("TS_CResult_StfuDecodeErrorZ_ok"))) TS_CResult_StfuDecodeErrorZ_ok(uint64_t o) {
27860         LDKStfu o_conv;
27861         o_conv.inner = untag_ptr(o);
27862         o_conv.is_owned = ptr_is_owned(o);
27863         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27864         o_conv = Stfu_clone(&o_conv);
27865         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
27866         *ret_conv = CResult_StfuDecodeErrorZ_ok(o_conv);
27867         return tag_ptr(ret_conv, true);
27868 }
27869
27870 uint64_t  __attribute__((export_name("TS_CResult_StfuDecodeErrorZ_err"))) TS_CResult_StfuDecodeErrorZ_err(uint64_t e) {
27871         void* e_ptr = untag_ptr(e);
27872         CHECK_ACCESS(e_ptr);
27873         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27874         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27875         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
27876         *ret_conv = CResult_StfuDecodeErrorZ_err(e_conv);
27877         return tag_ptr(ret_conv, true);
27878 }
27879
27880 jboolean  __attribute__((export_name("TS_CResult_StfuDecodeErrorZ_is_ok"))) TS_CResult_StfuDecodeErrorZ_is_ok(uint64_t o) {
27881         LDKCResult_StfuDecodeErrorZ* o_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(o);
27882         jboolean ret_conv = CResult_StfuDecodeErrorZ_is_ok(o_conv);
27883         return ret_conv;
27884 }
27885
27886 void  __attribute__((export_name("TS_CResult_StfuDecodeErrorZ_free"))) TS_CResult_StfuDecodeErrorZ_free(uint64_t _res) {
27887         if (!ptr_is_owned(_res)) return;
27888         void* _res_ptr = untag_ptr(_res);
27889         CHECK_ACCESS(_res_ptr);
27890         LDKCResult_StfuDecodeErrorZ _res_conv = *(LDKCResult_StfuDecodeErrorZ*)(_res_ptr);
27891         FREE(untag_ptr(_res));
27892         CResult_StfuDecodeErrorZ_free(_res_conv);
27893 }
27894
27895 static inline uint64_t CResult_StfuDecodeErrorZ_clone_ptr(LDKCResult_StfuDecodeErrorZ *NONNULL_PTR arg) {
27896         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
27897         *ret_conv = CResult_StfuDecodeErrorZ_clone(arg);
27898         return tag_ptr(ret_conv, true);
27899 }
27900 int64_t  __attribute__((export_name("TS_CResult_StfuDecodeErrorZ_clone_ptr"))) TS_CResult_StfuDecodeErrorZ_clone_ptr(uint64_t arg) {
27901         LDKCResult_StfuDecodeErrorZ* arg_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(arg);
27902         int64_t ret_conv = CResult_StfuDecodeErrorZ_clone_ptr(arg_conv);
27903         return ret_conv;
27904 }
27905
27906 uint64_t  __attribute__((export_name("TS_CResult_StfuDecodeErrorZ_clone"))) TS_CResult_StfuDecodeErrorZ_clone(uint64_t orig) {
27907         LDKCResult_StfuDecodeErrorZ* orig_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(orig);
27908         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
27909         *ret_conv = CResult_StfuDecodeErrorZ_clone(orig_conv);
27910         return tag_ptr(ret_conv, true);
27911 }
27912
27913 uint64_t  __attribute__((export_name("TS_CResult_SpliceDecodeErrorZ_ok"))) TS_CResult_SpliceDecodeErrorZ_ok(uint64_t o) {
27914         LDKSplice o_conv;
27915         o_conv.inner = untag_ptr(o);
27916         o_conv.is_owned = ptr_is_owned(o);
27917         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27918         o_conv = Splice_clone(&o_conv);
27919         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
27920         *ret_conv = CResult_SpliceDecodeErrorZ_ok(o_conv);
27921         return tag_ptr(ret_conv, true);
27922 }
27923
27924 uint64_t  __attribute__((export_name("TS_CResult_SpliceDecodeErrorZ_err"))) TS_CResult_SpliceDecodeErrorZ_err(uint64_t e) {
27925         void* e_ptr = untag_ptr(e);
27926         CHECK_ACCESS(e_ptr);
27927         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27928         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27929         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
27930         *ret_conv = CResult_SpliceDecodeErrorZ_err(e_conv);
27931         return tag_ptr(ret_conv, true);
27932 }
27933
27934 jboolean  __attribute__((export_name("TS_CResult_SpliceDecodeErrorZ_is_ok"))) TS_CResult_SpliceDecodeErrorZ_is_ok(uint64_t o) {
27935         LDKCResult_SpliceDecodeErrorZ* o_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(o);
27936         jboolean ret_conv = CResult_SpliceDecodeErrorZ_is_ok(o_conv);
27937         return ret_conv;
27938 }
27939
27940 void  __attribute__((export_name("TS_CResult_SpliceDecodeErrorZ_free"))) TS_CResult_SpliceDecodeErrorZ_free(uint64_t _res) {
27941         if (!ptr_is_owned(_res)) return;
27942         void* _res_ptr = untag_ptr(_res);
27943         CHECK_ACCESS(_res_ptr);
27944         LDKCResult_SpliceDecodeErrorZ _res_conv = *(LDKCResult_SpliceDecodeErrorZ*)(_res_ptr);
27945         FREE(untag_ptr(_res));
27946         CResult_SpliceDecodeErrorZ_free(_res_conv);
27947 }
27948
27949 static inline uint64_t CResult_SpliceDecodeErrorZ_clone_ptr(LDKCResult_SpliceDecodeErrorZ *NONNULL_PTR arg) {
27950         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
27951         *ret_conv = CResult_SpliceDecodeErrorZ_clone(arg);
27952         return tag_ptr(ret_conv, true);
27953 }
27954 int64_t  __attribute__((export_name("TS_CResult_SpliceDecodeErrorZ_clone_ptr"))) TS_CResult_SpliceDecodeErrorZ_clone_ptr(uint64_t arg) {
27955         LDKCResult_SpliceDecodeErrorZ* arg_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(arg);
27956         int64_t ret_conv = CResult_SpliceDecodeErrorZ_clone_ptr(arg_conv);
27957         return ret_conv;
27958 }
27959
27960 uint64_t  __attribute__((export_name("TS_CResult_SpliceDecodeErrorZ_clone"))) TS_CResult_SpliceDecodeErrorZ_clone(uint64_t orig) {
27961         LDKCResult_SpliceDecodeErrorZ* orig_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(orig);
27962         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
27963         *ret_conv = CResult_SpliceDecodeErrorZ_clone(orig_conv);
27964         return tag_ptr(ret_conv, true);
27965 }
27966
27967 uint64_t  __attribute__((export_name("TS_CResult_SpliceAckDecodeErrorZ_ok"))) TS_CResult_SpliceAckDecodeErrorZ_ok(uint64_t o) {
27968         LDKSpliceAck o_conv;
27969         o_conv.inner = untag_ptr(o);
27970         o_conv.is_owned = ptr_is_owned(o);
27971         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27972         o_conv = SpliceAck_clone(&o_conv);
27973         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
27974         *ret_conv = CResult_SpliceAckDecodeErrorZ_ok(o_conv);
27975         return tag_ptr(ret_conv, true);
27976 }
27977
27978 uint64_t  __attribute__((export_name("TS_CResult_SpliceAckDecodeErrorZ_err"))) TS_CResult_SpliceAckDecodeErrorZ_err(uint64_t e) {
27979         void* e_ptr = untag_ptr(e);
27980         CHECK_ACCESS(e_ptr);
27981         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27982         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27983         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
27984         *ret_conv = CResult_SpliceAckDecodeErrorZ_err(e_conv);
27985         return tag_ptr(ret_conv, true);
27986 }
27987
27988 jboolean  __attribute__((export_name("TS_CResult_SpliceAckDecodeErrorZ_is_ok"))) TS_CResult_SpliceAckDecodeErrorZ_is_ok(uint64_t o) {
27989         LDKCResult_SpliceAckDecodeErrorZ* o_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(o);
27990         jboolean ret_conv = CResult_SpliceAckDecodeErrorZ_is_ok(o_conv);
27991         return ret_conv;
27992 }
27993
27994 void  __attribute__((export_name("TS_CResult_SpliceAckDecodeErrorZ_free"))) TS_CResult_SpliceAckDecodeErrorZ_free(uint64_t _res) {
27995         if (!ptr_is_owned(_res)) return;
27996         void* _res_ptr = untag_ptr(_res);
27997         CHECK_ACCESS(_res_ptr);
27998         LDKCResult_SpliceAckDecodeErrorZ _res_conv = *(LDKCResult_SpliceAckDecodeErrorZ*)(_res_ptr);
27999         FREE(untag_ptr(_res));
28000         CResult_SpliceAckDecodeErrorZ_free(_res_conv);
28001 }
28002
28003 static inline uint64_t CResult_SpliceAckDecodeErrorZ_clone_ptr(LDKCResult_SpliceAckDecodeErrorZ *NONNULL_PTR arg) {
28004         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
28005         *ret_conv = CResult_SpliceAckDecodeErrorZ_clone(arg);
28006         return tag_ptr(ret_conv, true);
28007 }
28008 int64_t  __attribute__((export_name("TS_CResult_SpliceAckDecodeErrorZ_clone_ptr"))) TS_CResult_SpliceAckDecodeErrorZ_clone_ptr(uint64_t arg) {
28009         LDKCResult_SpliceAckDecodeErrorZ* arg_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(arg);
28010         int64_t ret_conv = CResult_SpliceAckDecodeErrorZ_clone_ptr(arg_conv);
28011         return ret_conv;
28012 }
28013
28014 uint64_t  __attribute__((export_name("TS_CResult_SpliceAckDecodeErrorZ_clone"))) TS_CResult_SpliceAckDecodeErrorZ_clone(uint64_t orig) {
28015         LDKCResult_SpliceAckDecodeErrorZ* orig_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(orig);
28016         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
28017         *ret_conv = CResult_SpliceAckDecodeErrorZ_clone(orig_conv);
28018         return tag_ptr(ret_conv, true);
28019 }
28020
28021 uint64_t  __attribute__((export_name("TS_CResult_SpliceLockedDecodeErrorZ_ok"))) TS_CResult_SpliceLockedDecodeErrorZ_ok(uint64_t o) {
28022         LDKSpliceLocked o_conv;
28023         o_conv.inner = untag_ptr(o);
28024         o_conv.is_owned = ptr_is_owned(o);
28025         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28026         o_conv = SpliceLocked_clone(&o_conv);
28027         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
28028         *ret_conv = CResult_SpliceLockedDecodeErrorZ_ok(o_conv);
28029         return tag_ptr(ret_conv, true);
28030 }
28031
28032 uint64_t  __attribute__((export_name("TS_CResult_SpliceLockedDecodeErrorZ_err"))) TS_CResult_SpliceLockedDecodeErrorZ_err(uint64_t e) {
28033         void* e_ptr = untag_ptr(e);
28034         CHECK_ACCESS(e_ptr);
28035         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28036         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28037         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
28038         *ret_conv = CResult_SpliceLockedDecodeErrorZ_err(e_conv);
28039         return tag_ptr(ret_conv, true);
28040 }
28041
28042 jboolean  __attribute__((export_name("TS_CResult_SpliceLockedDecodeErrorZ_is_ok"))) TS_CResult_SpliceLockedDecodeErrorZ_is_ok(uint64_t o) {
28043         LDKCResult_SpliceLockedDecodeErrorZ* o_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(o);
28044         jboolean ret_conv = CResult_SpliceLockedDecodeErrorZ_is_ok(o_conv);
28045         return ret_conv;
28046 }
28047
28048 void  __attribute__((export_name("TS_CResult_SpliceLockedDecodeErrorZ_free"))) TS_CResult_SpliceLockedDecodeErrorZ_free(uint64_t _res) {
28049         if (!ptr_is_owned(_res)) return;
28050         void* _res_ptr = untag_ptr(_res);
28051         CHECK_ACCESS(_res_ptr);
28052         LDKCResult_SpliceLockedDecodeErrorZ _res_conv = *(LDKCResult_SpliceLockedDecodeErrorZ*)(_res_ptr);
28053         FREE(untag_ptr(_res));
28054         CResult_SpliceLockedDecodeErrorZ_free(_res_conv);
28055 }
28056
28057 static inline uint64_t CResult_SpliceLockedDecodeErrorZ_clone_ptr(LDKCResult_SpliceLockedDecodeErrorZ *NONNULL_PTR arg) {
28058         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
28059         *ret_conv = CResult_SpliceLockedDecodeErrorZ_clone(arg);
28060         return tag_ptr(ret_conv, true);
28061 }
28062 int64_t  __attribute__((export_name("TS_CResult_SpliceLockedDecodeErrorZ_clone_ptr"))) TS_CResult_SpliceLockedDecodeErrorZ_clone_ptr(uint64_t arg) {
28063         LDKCResult_SpliceLockedDecodeErrorZ* arg_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(arg);
28064         int64_t ret_conv = CResult_SpliceLockedDecodeErrorZ_clone_ptr(arg_conv);
28065         return ret_conv;
28066 }
28067
28068 uint64_t  __attribute__((export_name("TS_CResult_SpliceLockedDecodeErrorZ_clone"))) TS_CResult_SpliceLockedDecodeErrorZ_clone(uint64_t orig) {
28069         LDKCResult_SpliceLockedDecodeErrorZ* orig_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(orig);
28070         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
28071         *ret_conv = CResult_SpliceLockedDecodeErrorZ_clone(orig_conv);
28072         return tag_ptr(ret_conv, true);
28073 }
28074
28075 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_ok"))) TS_CResult_TxAddInputDecodeErrorZ_ok(uint64_t o) {
28076         LDKTxAddInput o_conv;
28077         o_conv.inner = untag_ptr(o);
28078         o_conv.is_owned = ptr_is_owned(o);
28079         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28080         o_conv = TxAddInput_clone(&o_conv);
28081         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
28082         *ret_conv = CResult_TxAddInputDecodeErrorZ_ok(o_conv);
28083         return tag_ptr(ret_conv, true);
28084 }
28085
28086 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_err"))) TS_CResult_TxAddInputDecodeErrorZ_err(uint64_t e) {
28087         void* e_ptr = untag_ptr(e);
28088         CHECK_ACCESS(e_ptr);
28089         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28090         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28091         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
28092         *ret_conv = CResult_TxAddInputDecodeErrorZ_err(e_conv);
28093         return tag_ptr(ret_conv, true);
28094 }
28095
28096 jboolean  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_is_ok"))) TS_CResult_TxAddInputDecodeErrorZ_is_ok(uint64_t o) {
28097         LDKCResult_TxAddInputDecodeErrorZ* o_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(o);
28098         jboolean ret_conv = CResult_TxAddInputDecodeErrorZ_is_ok(o_conv);
28099         return ret_conv;
28100 }
28101
28102 void  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_free"))) TS_CResult_TxAddInputDecodeErrorZ_free(uint64_t _res) {
28103         if (!ptr_is_owned(_res)) return;
28104         void* _res_ptr = untag_ptr(_res);
28105         CHECK_ACCESS(_res_ptr);
28106         LDKCResult_TxAddInputDecodeErrorZ _res_conv = *(LDKCResult_TxAddInputDecodeErrorZ*)(_res_ptr);
28107         FREE(untag_ptr(_res));
28108         CResult_TxAddInputDecodeErrorZ_free(_res_conv);
28109 }
28110
28111 static inline uint64_t CResult_TxAddInputDecodeErrorZ_clone_ptr(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR arg) {
28112         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
28113         *ret_conv = CResult_TxAddInputDecodeErrorZ_clone(arg);
28114         return tag_ptr(ret_conv, true);
28115 }
28116 int64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_clone_ptr"))) TS_CResult_TxAddInputDecodeErrorZ_clone_ptr(uint64_t arg) {
28117         LDKCResult_TxAddInputDecodeErrorZ* arg_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(arg);
28118         int64_t ret_conv = CResult_TxAddInputDecodeErrorZ_clone_ptr(arg_conv);
28119         return ret_conv;
28120 }
28121
28122 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_clone"))) TS_CResult_TxAddInputDecodeErrorZ_clone(uint64_t orig) {
28123         LDKCResult_TxAddInputDecodeErrorZ* orig_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(orig);
28124         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
28125         *ret_conv = CResult_TxAddInputDecodeErrorZ_clone(orig_conv);
28126         return tag_ptr(ret_conv, true);
28127 }
28128
28129 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_ok"))) TS_CResult_TxAddOutputDecodeErrorZ_ok(uint64_t o) {
28130         LDKTxAddOutput o_conv;
28131         o_conv.inner = untag_ptr(o);
28132         o_conv.is_owned = ptr_is_owned(o);
28133         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28134         o_conv = TxAddOutput_clone(&o_conv);
28135         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
28136         *ret_conv = CResult_TxAddOutputDecodeErrorZ_ok(o_conv);
28137         return tag_ptr(ret_conv, true);
28138 }
28139
28140 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_err"))) TS_CResult_TxAddOutputDecodeErrorZ_err(uint64_t e) {
28141         void* e_ptr = untag_ptr(e);
28142         CHECK_ACCESS(e_ptr);
28143         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28144         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28145         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
28146         *ret_conv = CResult_TxAddOutputDecodeErrorZ_err(e_conv);
28147         return tag_ptr(ret_conv, true);
28148 }
28149
28150 jboolean  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_is_ok"))) TS_CResult_TxAddOutputDecodeErrorZ_is_ok(uint64_t o) {
28151         LDKCResult_TxAddOutputDecodeErrorZ* o_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(o);
28152         jboolean ret_conv = CResult_TxAddOutputDecodeErrorZ_is_ok(o_conv);
28153         return ret_conv;
28154 }
28155
28156 void  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_free"))) TS_CResult_TxAddOutputDecodeErrorZ_free(uint64_t _res) {
28157         if (!ptr_is_owned(_res)) return;
28158         void* _res_ptr = untag_ptr(_res);
28159         CHECK_ACCESS(_res_ptr);
28160         LDKCResult_TxAddOutputDecodeErrorZ _res_conv = *(LDKCResult_TxAddOutputDecodeErrorZ*)(_res_ptr);
28161         FREE(untag_ptr(_res));
28162         CResult_TxAddOutputDecodeErrorZ_free(_res_conv);
28163 }
28164
28165 static inline uint64_t CResult_TxAddOutputDecodeErrorZ_clone_ptr(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR arg) {
28166         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
28167         *ret_conv = CResult_TxAddOutputDecodeErrorZ_clone(arg);
28168         return tag_ptr(ret_conv, true);
28169 }
28170 int64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_clone_ptr"))) TS_CResult_TxAddOutputDecodeErrorZ_clone_ptr(uint64_t arg) {
28171         LDKCResult_TxAddOutputDecodeErrorZ* arg_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(arg);
28172         int64_t ret_conv = CResult_TxAddOutputDecodeErrorZ_clone_ptr(arg_conv);
28173         return ret_conv;
28174 }
28175
28176 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_clone"))) TS_CResult_TxAddOutputDecodeErrorZ_clone(uint64_t orig) {
28177         LDKCResult_TxAddOutputDecodeErrorZ* orig_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(orig);
28178         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
28179         *ret_conv = CResult_TxAddOutputDecodeErrorZ_clone(orig_conv);
28180         return tag_ptr(ret_conv, true);
28181 }
28182
28183 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_ok"))) TS_CResult_TxRemoveInputDecodeErrorZ_ok(uint64_t o) {
28184         LDKTxRemoveInput o_conv;
28185         o_conv.inner = untag_ptr(o);
28186         o_conv.is_owned = ptr_is_owned(o);
28187         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28188         o_conv = TxRemoveInput_clone(&o_conv);
28189         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
28190         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_ok(o_conv);
28191         return tag_ptr(ret_conv, true);
28192 }
28193
28194 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_err"))) TS_CResult_TxRemoveInputDecodeErrorZ_err(uint64_t e) {
28195         void* e_ptr = untag_ptr(e);
28196         CHECK_ACCESS(e_ptr);
28197         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28198         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28199         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
28200         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_err(e_conv);
28201         return tag_ptr(ret_conv, true);
28202 }
28203
28204 jboolean  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_is_ok"))) TS_CResult_TxRemoveInputDecodeErrorZ_is_ok(uint64_t o) {
28205         LDKCResult_TxRemoveInputDecodeErrorZ* o_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(o);
28206         jboolean ret_conv = CResult_TxRemoveInputDecodeErrorZ_is_ok(o_conv);
28207         return ret_conv;
28208 }
28209
28210 void  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_free"))) TS_CResult_TxRemoveInputDecodeErrorZ_free(uint64_t _res) {
28211         if (!ptr_is_owned(_res)) return;
28212         void* _res_ptr = untag_ptr(_res);
28213         CHECK_ACCESS(_res_ptr);
28214         LDKCResult_TxRemoveInputDecodeErrorZ _res_conv = *(LDKCResult_TxRemoveInputDecodeErrorZ*)(_res_ptr);
28215         FREE(untag_ptr(_res));
28216         CResult_TxRemoveInputDecodeErrorZ_free(_res_conv);
28217 }
28218
28219 static inline uint64_t CResult_TxRemoveInputDecodeErrorZ_clone_ptr(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR arg) {
28220         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
28221         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone(arg);
28222         return tag_ptr(ret_conv, true);
28223 }
28224 int64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_clone_ptr"))) TS_CResult_TxRemoveInputDecodeErrorZ_clone_ptr(uint64_t arg) {
28225         LDKCResult_TxRemoveInputDecodeErrorZ* arg_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(arg);
28226         int64_t ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone_ptr(arg_conv);
28227         return ret_conv;
28228 }
28229
28230 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_clone"))) TS_CResult_TxRemoveInputDecodeErrorZ_clone(uint64_t orig) {
28231         LDKCResult_TxRemoveInputDecodeErrorZ* orig_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(orig);
28232         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
28233         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone(orig_conv);
28234         return tag_ptr(ret_conv, true);
28235 }
28236
28237 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_ok"))) TS_CResult_TxRemoveOutputDecodeErrorZ_ok(uint64_t o) {
28238         LDKTxRemoveOutput o_conv;
28239         o_conv.inner = untag_ptr(o);
28240         o_conv.is_owned = ptr_is_owned(o);
28241         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28242         o_conv = TxRemoveOutput_clone(&o_conv);
28243         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
28244         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_ok(o_conv);
28245         return tag_ptr(ret_conv, true);
28246 }
28247
28248 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_err"))) TS_CResult_TxRemoveOutputDecodeErrorZ_err(uint64_t e) {
28249         void* e_ptr = untag_ptr(e);
28250         CHECK_ACCESS(e_ptr);
28251         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28252         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28253         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
28254         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_err(e_conv);
28255         return tag_ptr(ret_conv, true);
28256 }
28257
28258 jboolean  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_is_ok"))) TS_CResult_TxRemoveOutputDecodeErrorZ_is_ok(uint64_t o) {
28259         LDKCResult_TxRemoveOutputDecodeErrorZ* o_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(o);
28260         jboolean ret_conv = CResult_TxRemoveOutputDecodeErrorZ_is_ok(o_conv);
28261         return ret_conv;
28262 }
28263
28264 void  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_free"))) TS_CResult_TxRemoveOutputDecodeErrorZ_free(uint64_t _res) {
28265         if (!ptr_is_owned(_res)) return;
28266         void* _res_ptr = untag_ptr(_res);
28267         CHECK_ACCESS(_res_ptr);
28268         LDKCResult_TxRemoveOutputDecodeErrorZ _res_conv = *(LDKCResult_TxRemoveOutputDecodeErrorZ*)(_res_ptr);
28269         FREE(untag_ptr(_res));
28270         CResult_TxRemoveOutputDecodeErrorZ_free(_res_conv);
28271 }
28272
28273 static inline uint64_t CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR arg) {
28274         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
28275         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone(arg);
28276         return tag_ptr(ret_conv, true);
28277 }
28278 int64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_clone_ptr"))) TS_CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(uint64_t arg) {
28279         LDKCResult_TxRemoveOutputDecodeErrorZ* arg_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(arg);
28280         int64_t ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(arg_conv);
28281         return ret_conv;
28282 }
28283
28284 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_clone"))) TS_CResult_TxRemoveOutputDecodeErrorZ_clone(uint64_t orig) {
28285         LDKCResult_TxRemoveOutputDecodeErrorZ* orig_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(orig);
28286         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
28287         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone(orig_conv);
28288         return tag_ptr(ret_conv, true);
28289 }
28290
28291 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_ok"))) TS_CResult_TxCompleteDecodeErrorZ_ok(uint64_t o) {
28292         LDKTxComplete o_conv;
28293         o_conv.inner = untag_ptr(o);
28294         o_conv.is_owned = ptr_is_owned(o);
28295         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28296         o_conv = TxComplete_clone(&o_conv);
28297         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
28298         *ret_conv = CResult_TxCompleteDecodeErrorZ_ok(o_conv);
28299         return tag_ptr(ret_conv, true);
28300 }
28301
28302 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_err"))) TS_CResult_TxCompleteDecodeErrorZ_err(uint64_t e) {
28303         void* e_ptr = untag_ptr(e);
28304         CHECK_ACCESS(e_ptr);
28305         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28306         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28307         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
28308         *ret_conv = CResult_TxCompleteDecodeErrorZ_err(e_conv);
28309         return tag_ptr(ret_conv, true);
28310 }
28311
28312 jboolean  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_is_ok"))) TS_CResult_TxCompleteDecodeErrorZ_is_ok(uint64_t o) {
28313         LDKCResult_TxCompleteDecodeErrorZ* o_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(o);
28314         jboolean ret_conv = CResult_TxCompleteDecodeErrorZ_is_ok(o_conv);
28315         return ret_conv;
28316 }
28317
28318 void  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_free"))) TS_CResult_TxCompleteDecodeErrorZ_free(uint64_t _res) {
28319         if (!ptr_is_owned(_res)) return;
28320         void* _res_ptr = untag_ptr(_res);
28321         CHECK_ACCESS(_res_ptr);
28322         LDKCResult_TxCompleteDecodeErrorZ _res_conv = *(LDKCResult_TxCompleteDecodeErrorZ*)(_res_ptr);
28323         FREE(untag_ptr(_res));
28324         CResult_TxCompleteDecodeErrorZ_free(_res_conv);
28325 }
28326
28327 static inline uint64_t CResult_TxCompleteDecodeErrorZ_clone_ptr(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR arg) {
28328         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
28329         *ret_conv = CResult_TxCompleteDecodeErrorZ_clone(arg);
28330         return tag_ptr(ret_conv, true);
28331 }
28332 int64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_clone_ptr"))) TS_CResult_TxCompleteDecodeErrorZ_clone_ptr(uint64_t arg) {
28333         LDKCResult_TxCompleteDecodeErrorZ* arg_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(arg);
28334         int64_t ret_conv = CResult_TxCompleteDecodeErrorZ_clone_ptr(arg_conv);
28335         return ret_conv;
28336 }
28337
28338 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_clone"))) TS_CResult_TxCompleteDecodeErrorZ_clone(uint64_t orig) {
28339         LDKCResult_TxCompleteDecodeErrorZ* orig_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(orig);
28340         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
28341         *ret_conv = CResult_TxCompleteDecodeErrorZ_clone(orig_conv);
28342         return tag_ptr(ret_conv, true);
28343 }
28344
28345 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_ok"))) TS_CResult_TxSignaturesDecodeErrorZ_ok(uint64_t o) {
28346         LDKTxSignatures o_conv;
28347         o_conv.inner = untag_ptr(o);
28348         o_conv.is_owned = ptr_is_owned(o);
28349         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28350         o_conv = TxSignatures_clone(&o_conv);
28351         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
28352         *ret_conv = CResult_TxSignaturesDecodeErrorZ_ok(o_conv);
28353         return tag_ptr(ret_conv, true);
28354 }
28355
28356 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_err"))) TS_CResult_TxSignaturesDecodeErrorZ_err(uint64_t e) {
28357         void* e_ptr = untag_ptr(e);
28358         CHECK_ACCESS(e_ptr);
28359         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28360         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28361         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
28362         *ret_conv = CResult_TxSignaturesDecodeErrorZ_err(e_conv);
28363         return tag_ptr(ret_conv, true);
28364 }
28365
28366 jboolean  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_is_ok"))) TS_CResult_TxSignaturesDecodeErrorZ_is_ok(uint64_t o) {
28367         LDKCResult_TxSignaturesDecodeErrorZ* o_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(o);
28368         jboolean ret_conv = CResult_TxSignaturesDecodeErrorZ_is_ok(o_conv);
28369         return ret_conv;
28370 }
28371
28372 void  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_free"))) TS_CResult_TxSignaturesDecodeErrorZ_free(uint64_t _res) {
28373         if (!ptr_is_owned(_res)) return;
28374         void* _res_ptr = untag_ptr(_res);
28375         CHECK_ACCESS(_res_ptr);
28376         LDKCResult_TxSignaturesDecodeErrorZ _res_conv = *(LDKCResult_TxSignaturesDecodeErrorZ*)(_res_ptr);
28377         FREE(untag_ptr(_res));
28378         CResult_TxSignaturesDecodeErrorZ_free(_res_conv);
28379 }
28380
28381 static inline uint64_t CResult_TxSignaturesDecodeErrorZ_clone_ptr(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR arg) {
28382         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
28383         *ret_conv = CResult_TxSignaturesDecodeErrorZ_clone(arg);
28384         return tag_ptr(ret_conv, true);
28385 }
28386 int64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_clone_ptr"))) TS_CResult_TxSignaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
28387         LDKCResult_TxSignaturesDecodeErrorZ* arg_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(arg);
28388         int64_t ret_conv = CResult_TxSignaturesDecodeErrorZ_clone_ptr(arg_conv);
28389         return ret_conv;
28390 }
28391
28392 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_clone"))) TS_CResult_TxSignaturesDecodeErrorZ_clone(uint64_t orig) {
28393         LDKCResult_TxSignaturesDecodeErrorZ* orig_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(orig);
28394         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
28395         *ret_conv = CResult_TxSignaturesDecodeErrorZ_clone(orig_conv);
28396         return tag_ptr(ret_conv, true);
28397 }
28398
28399 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_ok"))) TS_CResult_TxInitRbfDecodeErrorZ_ok(uint64_t o) {
28400         LDKTxInitRbf o_conv;
28401         o_conv.inner = untag_ptr(o);
28402         o_conv.is_owned = ptr_is_owned(o);
28403         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28404         o_conv = TxInitRbf_clone(&o_conv);
28405         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
28406         *ret_conv = CResult_TxInitRbfDecodeErrorZ_ok(o_conv);
28407         return tag_ptr(ret_conv, true);
28408 }
28409
28410 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_err"))) TS_CResult_TxInitRbfDecodeErrorZ_err(uint64_t e) {
28411         void* e_ptr = untag_ptr(e);
28412         CHECK_ACCESS(e_ptr);
28413         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28414         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28415         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
28416         *ret_conv = CResult_TxInitRbfDecodeErrorZ_err(e_conv);
28417         return tag_ptr(ret_conv, true);
28418 }
28419
28420 jboolean  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_is_ok"))) TS_CResult_TxInitRbfDecodeErrorZ_is_ok(uint64_t o) {
28421         LDKCResult_TxInitRbfDecodeErrorZ* o_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(o);
28422         jboolean ret_conv = CResult_TxInitRbfDecodeErrorZ_is_ok(o_conv);
28423         return ret_conv;
28424 }
28425
28426 void  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_free"))) TS_CResult_TxInitRbfDecodeErrorZ_free(uint64_t _res) {
28427         if (!ptr_is_owned(_res)) return;
28428         void* _res_ptr = untag_ptr(_res);
28429         CHECK_ACCESS(_res_ptr);
28430         LDKCResult_TxInitRbfDecodeErrorZ _res_conv = *(LDKCResult_TxInitRbfDecodeErrorZ*)(_res_ptr);
28431         FREE(untag_ptr(_res));
28432         CResult_TxInitRbfDecodeErrorZ_free(_res_conv);
28433 }
28434
28435 static inline uint64_t CResult_TxInitRbfDecodeErrorZ_clone_ptr(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR arg) {
28436         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
28437         *ret_conv = CResult_TxInitRbfDecodeErrorZ_clone(arg);
28438         return tag_ptr(ret_conv, true);
28439 }
28440 int64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_clone_ptr"))) TS_CResult_TxInitRbfDecodeErrorZ_clone_ptr(uint64_t arg) {
28441         LDKCResult_TxInitRbfDecodeErrorZ* arg_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(arg);
28442         int64_t ret_conv = CResult_TxInitRbfDecodeErrorZ_clone_ptr(arg_conv);
28443         return ret_conv;
28444 }
28445
28446 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_clone"))) TS_CResult_TxInitRbfDecodeErrorZ_clone(uint64_t orig) {
28447         LDKCResult_TxInitRbfDecodeErrorZ* orig_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(orig);
28448         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
28449         *ret_conv = CResult_TxInitRbfDecodeErrorZ_clone(orig_conv);
28450         return tag_ptr(ret_conv, true);
28451 }
28452
28453 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_ok"))) TS_CResult_TxAckRbfDecodeErrorZ_ok(uint64_t o) {
28454         LDKTxAckRbf o_conv;
28455         o_conv.inner = untag_ptr(o);
28456         o_conv.is_owned = ptr_is_owned(o);
28457         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28458         o_conv = TxAckRbf_clone(&o_conv);
28459         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
28460         *ret_conv = CResult_TxAckRbfDecodeErrorZ_ok(o_conv);
28461         return tag_ptr(ret_conv, true);
28462 }
28463
28464 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_err"))) TS_CResult_TxAckRbfDecodeErrorZ_err(uint64_t e) {
28465         void* e_ptr = untag_ptr(e);
28466         CHECK_ACCESS(e_ptr);
28467         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28468         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28469         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
28470         *ret_conv = CResult_TxAckRbfDecodeErrorZ_err(e_conv);
28471         return tag_ptr(ret_conv, true);
28472 }
28473
28474 jboolean  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_is_ok"))) TS_CResult_TxAckRbfDecodeErrorZ_is_ok(uint64_t o) {
28475         LDKCResult_TxAckRbfDecodeErrorZ* o_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(o);
28476         jboolean ret_conv = CResult_TxAckRbfDecodeErrorZ_is_ok(o_conv);
28477         return ret_conv;
28478 }
28479
28480 void  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_free"))) TS_CResult_TxAckRbfDecodeErrorZ_free(uint64_t _res) {
28481         if (!ptr_is_owned(_res)) return;
28482         void* _res_ptr = untag_ptr(_res);
28483         CHECK_ACCESS(_res_ptr);
28484         LDKCResult_TxAckRbfDecodeErrorZ _res_conv = *(LDKCResult_TxAckRbfDecodeErrorZ*)(_res_ptr);
28485         FREE(untag_ptr(_res));
28486         CResult_TxAckRbfDecodeErrorZ_free(_res_conv);
28487 }
28488
28489 static inline uint64_t CResult_TxAckRbfDecodeErrorZ_clone_ptr(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR arg) {
28490         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
28491         *ret_conv = CResult_TxAckRbfDecodeErrorZ_clone(arg);
28492         return tag_ptr(ret_conv, true);
28493 }
28494 int64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_clone_ptr"))) TS_CResult_TxAckRbfDecodeErrorZ_clone_ptr(uint64_t arg) {
28495         LDKCResult_TxAckRbfDecodeErrorZ* arg_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(arg);
28496         int64_t ret_conv = CResult_TxAckRbfDecodeErrorZ_clone_ptr(arg_conv);
28497         return ret_conv;
28498 }
28499
28500 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_clone"))) TS_CResult_TxAckRbfDecodeErrorZ_clone(uint64_t orig) {
28501         LDKCResult_TxAckRbfDecodeErrorZ* orig_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(orig);
28502         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
28503         *ret_conv = CResult_TxAckRbfDecodeErrorZ_clone(orig_conv);
28504         return tag_ptr(ret_conv, true);
28505 }
28506
28507 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_ok"))) TS_CResult_TxAbortDecodeErrorZ_ok(uint64_t o) {
28508         LDKTxAbort o_conv;
28509         o_conv.inner = untag_ptr(o);
28510         o_conv.is_owned = ptr_is_owned(o);
28511         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28512         o_conv = TxAbort_clone(&o_conv);
28513         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
28514         *ret_conv = CResult_TxAbortDecodeErrorZ_ok(o_conv);
28515         return tag_ptr(ret_conv, true);
28516 }
28517
28518 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_err"))) TS_CResult_TxAbortDecodeErrorZ_err(uint64_t e) {
28519         void* e_ptr = untag_ptr(e);
28520         CHECK_ACCESS(e_ptr);
28521         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28522         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28523         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
28524         *ret_conv = CResult_TxAbortDecodeErrorZ_err(e_conv);
28525         return tag_ptr(ret_conv, true);
28526 }
28527
28528 jboolean  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_is_ok"))) TS_CResult_TxAbortDecodeErrorZ_is_ok(uint64_t o) {
28529         LDKCResult_TxAbortDecodeErrorZ* o_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(o);
28530         jboolean ret_conv = CResult_TxAbortDecodeErrorZ_is_ok(o_conv);
28531         return ret_conv;
28532 }
28533
28534 void  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_free"))) TS_CResult_TxAbortDecodeErrorZ_free(uint64_t _res) {
28535         if (!ptr_is_owned(_res)) return;
28536         void* _res_ptr = untag_ptr(_res);
28537         CHECK_ACCESS(_res_ptr);
28538         LDKCResult_TxAbortDecodeErrorZ _res_conv = *(LDKCResult_TxAbortDecodeErrorZ*)(_res_ptr);
28539         FREE(untag_ptr(_res));
28540         CResult_TxAbortDecodeErrorZ_free(_res_conv);
28541 }
28542
28543 static inline uint64_t CResult_TxAbortDecodeErrorZ_clone_ptr(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR arg) {
28544         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
28545         *ret_conv = CResult_TxAbortDecodeErrorZ_clone(arg);
28546         return tag_ptr(ret_conv, true);
28547 }
28548 int64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_clone_ptr"))) TS_CResult_TxAbortDecodeErrorZ_clone_ptr(uint64_t arg) {
28549         LDKCResult_TxAbortDecodeErrorZ* arg_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(arg);
28550         int64_t ret_conv = CResult_TxAbortDecodeErrorZ_clone_ptr(arg_conv);
28551         return ret_conv;
28552 }
28553
28554 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_clone"))) TS_CResult_TxAbortDecodeErrorZ_clone(uint64_t orig) {
28555         LDKCResult_TxAbortDecodeErrorZ* orig_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(orig);
28556         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
28557         *ret_conv = CResult_TxAbortDecodeErrorZ_clone(orig_conv);
28558         return tag_ptr(ret_conv, true);
28559 }
28560
28561 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint64_t o) {
28562         LDKAnnouncementSignatures o_conv;
28563         o_conv.inner = untag_ptr(o);
28564         o_conv.is_owned = ptr_is_owned(o);
28565         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28566         o_conv = AnnouncementSignatures_clone(&o_conv);
28567         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
28568         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
28569         return tag_ptr(ret_conv, true);
28570 }
28571
28572 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint64_t e) {
28573         void* e_ptr = untag_ptr(e);
28574         CHECK_ACCESS(e_ptr);
28575         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28576         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28577         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
28578         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
28579         return tag_ptr(ret_conv, true);
28580 }
28581
28582 jboolean  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(uint64_t o) {
28583         LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(o);
28584         jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
28585         return ret_conv;
28586 }
28587
28588 void  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_free"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint64_t _res) {
28589         if (!ptr_is_owned(_res)) return;
28590         void* _res_ptr = untag_ptr(_res);
28591         CHECK_ACCESS(_res_ptr);
28592         LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
28593         FREE(untag_ptr(_res));
28594         CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
28595 }
28596
28597 static inline uint64_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
28598         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
28599         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
28600         return tag_ptr(ret_conv, true);
28601 }
28602 int64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
28603         LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(arg);
28604         int64_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
28605         return ret_conv;
28606 }
28607
28608 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint64_t orig) {
28609         LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(orig);
28610         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
28611         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
28612         return tag_ptr(ret_conv, true);
28613 }
28614
28615 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint64_t o) {
28616         LDKChannelReestablish o_conv;
28617         o_conv.inner = untag_ptr(o);
28618         o_conv.is_owned = ptr_is_owned(o);
28619         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28620         o_conv = ChannelReestablish_clone(&o_conv);
28621         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
28622         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
28623         return tag_ptr(ret_conv, true);
28624 }
28625
28626 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint64_t e) {
28627         void* e_ptr = untag_ptr(e);
28628         CHECK_ACCESS(e_ptr);
28629         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28630         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28631         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
28632         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
28633         return tag_ptr(ret_conv, true);
28634 }
28635
28636 jboolean  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_is_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_is_ok(uint64_t o) {
28637         LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(o);
28638         jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
28639         return ret_conv;
28640 }
28641
28642 void  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_free"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint64_t _res) {
28643         if (!ptr_is_owned(_res)) return;
28644         void* _res_ptr = untag_ptr(_res);
28645         CHECK_ACCESS(_res_ptr);
28646         LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
28647         FREE(untag_ptr(_res));
28648         CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
28649 }
28650
28651 static inline uint64_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
28652         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
28653         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
28654         return tag_ptr(ret_conv, true);
28655 }
28656 int64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr(uint64_t arg) {
28657         LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(arg);
28658         int64_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
28659         return ret_conv;
28660 }
28661
28662 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint64_t orig) {
28663         LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(orig);
28664         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
28665         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
28666         return tag_ptr(ret_conv, true);
28667 }
28668
28669 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint64_t o) {
28670         LDKClosingSigned o_conv;
28671         o_conv.inner = untag_ptr(o);
28672         o_conv.is_owned = ptr_is_owned(o);
28673         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28674         o_conv = ClosingSigned_clone(&o_conv);
28675         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
28676         *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
28677         return tag_ptr(ret_conv, true);
28678 }
28679
28680 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_err"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint64_t e) {
28681         void* e_ptr = untag_ptr(e);
28682         CHECK_ACCESS(e_ptr);
28683         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28684         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28685         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
28686         *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
28687         return tag_ptr(ret_conv, true);
28688 }
28689
28690 jboolean  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_is_ok(uint64_t o) {
28691         LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(o);
28692         jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
28693         return ret_conv;
28694 }
28695
28696 void  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_free"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint64_t _res) {
28697         if (!ptr_is_owned(_res)) return;
28698         void* _res_ptr = untag_ptr(_res);
28699         CHECK_ACCESS(_res_ptr);
28700         LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
28701         FREE(untag_ptr(_res));
28702         CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
28703 }
28704
28705 static inline uint64_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
28706         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
28707         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
28708         return tag_ptr(ret_conv, true);
28709 }
28710 int64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
28711         LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(arg);
28712         int64_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
28713         return ret_conv;
28714 }
28715
28716 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint64_t orig) {
28717         LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(orig);
28718         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
28719         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
28720         return tag_ptr(ret_conv, true);
28721 }
28722
28723 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(uint64_t o) {
28724         LDKClosingSignedFeeRange o_conv;
28725         o_conv.inner = untag_ptr(o);
28726         o_conv.is_owned = ptr_is_owned(o);
28727         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28728         o_conv = ClosingSignedFeeRange_clone(&o_conv);
28729         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
28730         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
28731         return tag_ptr(ret_conv, true);
28732 }
28733
28734 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err(uint64_t e) {
28735         void* e_ptr = untag_ptr(e);
28736         CHECK_ACCESS(e_ptr);
28737         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28738         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28739         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
28740         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
28741         return tag_ptr(ret_conv, true);
28742 }
28743
28744 jboolean  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(uint64_t o) {
28745         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(o);
28746         jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
28747         return ret_conv;
28748 }
28749
28750 void  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free(uint64_t _res) {
28751         if (!ptr_is_owned(_res)) return;
28752         void* _res_ptr = untag_ptr(_res);
28753         CHECK_ACCESS(_res_ptr);
28754         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
28755         FREE(untag_ptr(_res));
28756         CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
28757 }
28758
28759 static inline uint64_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
28760         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
28761         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
28762         return tag_ptr(ret_conv, true);
28763 }
28764 int64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
28765         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(arg);
28766         int64_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
28767         return ret_conv;
28768 }
28769
28770 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(uint64_t orig) {
28771         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(orig);
28772         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
28773         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
28774         return tag_ptr(ret_conv, true);
28775 }
28776
28777 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint64_t o) {
28778         LDKCommitmentSigned o_conv;
28779         o_conv.inner = untag_ptr(o);
28780         o_conv.is_owned = ptr_is_owned(o);
28781         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28782         o_conv = CommitmentSigned_clone(&o_conv);
28783         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
28784         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
28785         return tag_ptr(ret_conv, true);
28786 }
28787
28788 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint64_t e) {
28789         void* e_ptr = untag_ptr(e);
28790         CHECK_ACCESS(e_ptr);
28791         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28792         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28793         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
28794         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
28795         return tag_ptr(ret_conv, true);
28796 }
28797
28798 jboolean  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_is_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_is_ok(uint64_t o) {
28799         LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(o);
28800         jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
28801         return ret_conv;
28802 }
28803
28804 void  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_free"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint64_t _res) {
28805         if (!ptr_is_owned(_res)) return;
28806         void* _res_ptr = untag_ptr(_res);
28807         CHECK_ACCESS(_res_ptr);
28808         LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
28809         FREE(untag_ptr(_res));
28810         CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
28811 }
28812
28813 static inline uint64_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
28814         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
28815         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
28816         return tag_ptr(ret_conv, true);
28817 }
28818 int64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
28819         LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(arg);
28820         int64_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
28821         return ret_conv;
28822 }
28823
28824 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint64_t orig) {
28825         LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(orig);
28826         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
28827         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
28828         return tag_ptr(ret_conv, true);
28829 }
28830
28831 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint64_t o) {
28832         LDKFundingCreated o_conv;
28833         o_conv.inner = untag_ptr(o);
28834         o_conv.is_owned = ptr_is_owned(o);
28835         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28836         o_conv = FundingCreated_clone(&o_conv);
28837         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
28838         *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
28839         return tag_ptr(ret_conv, true);
28840 }
28841
28842 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_err"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint64_t e) {
28843         void* e_ptr = untag_ptr(e);
28844         CHECK_ACCESS(e_ptr);
28845         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28846         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28847         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
28848         *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
28849         return tag_ptr(ret_conv, true);
28850 }
28851
28852 jboolean  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_is_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_is_ok(uint64_t o) {
28853         LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(o);
28854         jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
28855         return ret_conv;
28856 }
28857
28858 void  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_free"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint64_t _res) {
28859         if (!ptr_is_owned(_res)) return;
28860         void* _res_ptr = untag_ptr(_res);
28861         CHECK_ACCESS(_res_ptr);
28862         LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
28863         FREE(untag_ptr(_res));
28864         CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
28865 }
28866
28867 static inline uint64_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
28868         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
28869         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
28870         return tag_ptr(ret_conv, true);
28871 }
28872 int64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr(uint64_t arg) {
28873         LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(arg);
28874         int64_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
28875         return ret_conv;
28876 }
28877
28878 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint64_t orig) {
28879         LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(orig);
28880         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
28881         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
28882         return tag_ptr(ret_conv, true);
28883 }
28884
28885 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_ok"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint64_t o) {
28886         LDKFundingSigned o_conv;
28887         o_conv.inner = untag_ptr(o);
28888         o_conv.is_owned = ptr_is_owned(o);
28889         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28890         o_conv = FundingSigned_clone(&o_conv);
28891         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
28892         *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
28893         return tag_ptr(ret_conv, true);
28894 }
28895
28896 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_err"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint64_t e) {
28897         void* e_ptr = untag_ptr(e);
28898         CHECK_ACCESS(e_ptr);
28899         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28900         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28901         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
28902         *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
28903         return tag_ptr(ret_conv, true);
28904 }
28905
28906 jboolean  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_is_ok"))) TS_CResult_FundingSignedDecodeErrorZ_is_ok(uint64_t o) {
28907         LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(o);
28908         jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
28909         return ret_conv;
28910 }
28911
28912 void  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_free"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint64_t _res) {
28913         if (!ptr_is_owned(_res)) return;
28914         void* _res_ptr = untag_ptr(_res);
28915         CHECK_ACCESS(_res_ptr);
28916         LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
28917         FREE(untag_ptr(_res));
28918         CResult_FundingSignedDecodeErrorZ_free(_res_conv);
28919 }
28920
28921 static inline uint64_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
28922         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
28923         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
28924         return tag_ptr(ret_conv, true);
28925 }
28926 int64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
28927         LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(arg);
28928         int64_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
28929         return ret_conv;
28930 }
28931
28932 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint64_t orig) {
28933         LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(orig);
28934         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
28935         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
28936         return tag_ptr(ret_conv, true);
28937 }
28938
28939 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_ok(uint64_t o) {
28940         LDKChannelReady o_conv;
28941         o_conv.inner = untag_ptr(o);
28942         o_conv.is_owned = ptr_is_owned(o);
28943         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28944         o_conv = ChannelReady_clone(&o_conv);
28945         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
28946         *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
28947         return tag_ptr(ret_conv, true);
28948 }
28949
28950 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_err"))) TS_CResult_ChannelReadyDecodeErrorZ_err(uint64_t e) {
28951         void* e_ptr = untag_ptr(e);
28952         CHECK_ACCESS(e_ptr);
28953         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28954         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28955         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
28956         *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
28957         return tag_ptr(ret_conv, true);
28958 }
28959
28960 jboolean  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_is_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_is_ok(uint64_t o) {
28961         LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(o);
28962         jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
28963         return ret_conv;
28964 }
28965
28966 void  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_free"))) TS_CResult_ChannelReadyDecodeErrorZ_free(uint64_t _res) {
28967         if (!ptr_is_owned(_res)) return;
28968         void* _res_ptr = untag_ptr(_res);
28969         CHECK_ACCESS(_res_ptr);
28970         LDKCResult_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
28971         FREE(untag_ptr(_res));
28972         CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
28973 }
28974
28975 static inline uint64_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
28976         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
28977         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
28978         return tag_ptr(ret_conv, true);
28979 }
28980 int64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr(uint64_t arg) {
28981         LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(arg);
28982         int64_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
28983         return ret_conv;
28984 }
28985
28986 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone"))) TS_CResult_ChannelReadyDecodeErrorZ_clone(uint64_t orig) {
28987         LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(orig);
28988         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
28989         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
28990         return tag_ptr(ret_conv, true);
28991 }
28992
28993 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_ok"))) TS_CResult_InitDecodeErrorZ_ok(uint64_t o) {
28994         LDKInit o_conv;
28995         o_conv.inner = untag_ptr(o);
28996         o_conv.is_owned = ptr_is_owned(o);
28997         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28998         o_conv = Init_clone(&o_conv);
28999         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
29000         *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
29001         return tag_ptr(ret_conv, true);
29002 }
29003
29004 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_err"))) TS_CResult_InitDecodeErrorZ_err(uint64_t e) {
29005         void* e_ptr = untag_ptr(e);
29006         CHECK_ACCESS(e_ptr);
29007         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29008         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29009         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
29010         *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
29011         return tag_ptr(ret_conv, true);
29012 }
29013
29014 jboolean  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_is_ok"))) TS_CResult_InitDecodeErrorZ_is_ok(uint64_t o) {
29015         LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(o);
29016         jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
29017         return ret_conv;
29018 }
29019
29020 void  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_free"))) TS_CResult_InitDecodeErrorZ_free(uint64_t _res) {
29021         if (!ptr_is_owned(_res)) return;
29022         void* _res_ptr = untag_ptr(_res);
29023         CHECK_ACCESS(_res_ptr);
29024         LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
29025         FREE(untag_ptr(_res));
29026         CResult_InitDecodeErrorZ_free(_res_conv);
29027 }
29028
29029 static inline uint64_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
29030         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
29031         *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
29032         return tag_ptr(ret_conv, true);
29033 }
29034 int64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone_ptr"))) TS_CResult_InitDecodeErrorZ_clone_ptr(uint64_t arg) {
29035         LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(arg);
29036         int64_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
29037         return ret_conv;
29038 }
29039
29040 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone"))) TS_CResult_InitDecodeErrorZ_clone(uint64_t orig) {
29041         LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(orig);
29042         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
29043         *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
29044         return tag_ptr(ret_conv, true);
29045 }
29046
29047 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_ok"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint64_t o) {
29048         LDKOpenChannel o_conv;
29049         o_conv.inner = untag_ptr(o);
29050         o_conv.is_owned = ptr_is_owned(o);
29051         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29052         o_conv = OpenChannel_clone(&o_conv);
29053         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
29054         *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
29055         return tag_ptr(ret_conv, true);
29056 }
29057
29058 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_err"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint64_t e) {
29059         void* e_ptr = untag_ptr(e);
29060         CHECK_ACCESS(e_ptr);
29061         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29062         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29063         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
29064         *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
29065         return tag_ptr(ret_conv, true);
29066 }
29067
29068 jboolean  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_is_ok"))) TS_CResult_OpenChannelDecodeErrorZ_is_ok(uint64_t o) {
29069         LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(o);
29070         jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
29071         return ret_conv;
29072 }
29073
29074 void  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_free"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint64_t _res) {
29075         if (!ptr_is_owned(_res)) return;
29076         void* _res_ptr = untag_ptr(_res);
29077         CHECK_ACCESS(_res_ptr);
29078         LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
29079         FREE(untag_ptr(_res));
29080         CResult_OpenChannelDecodeErrorZ_free(_res_conv);
29081 }
29082
29083 static inline uint64_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
29084         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
29085         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
29086         return tag_ptr(ret_conv, true);
29087 }
29088 int64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone_ptr"))) TS_CResult_OpenChannelDecodeErrorZ_clone_ptr(uint64_t arg) {
29089         LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(arg);
29090         int64_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
29091         return ret_conv;
29092 }
29093
29094 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint64_t orig) {
29095         LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(orig);
29096         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
29097         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
29098         return tag_ptr(ret_conv, true);
29099 }
29100
29101 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_ok"))) TS_CResult_OpenChannelV2DecodeErrorZ_ok(uint64_t o) {
29102         LDKOpenChannelV2 o_conv;
29103         o_conv.inner = untag_ptr(o);
29104         o_conv.is_owned = ptr_is_owned(o);
29105         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29106         o_conv = OpenChannelV2_clone(&o_conv);
29107         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
29108         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_ok(o_conv);
29109         return tag_ptr(ret_conv, true);
29110 }
29111
29112 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_err"))) TS_CResult_OpenChannelV2DecodeErrorZ_err(uint64_t e) {
29113         void* e_ptr = untag_ptr(e);
29114         CHECK_ACCESS(e_ptr);
29115         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29116         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29117         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
29118         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_err(e_conv);
29119         return tag_ptr(ret_conv, true);
29120 }
29121
29122 jboolean  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_is_ok"))) TS_CResult_OpenChannelV2DecodeErrorZ_is_ok(uint64_t o) {
29123         LDKCResult_OpenChannelV2DecodeErrorZ* o_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(o);
29124         jboolean ret_conv = CResult_OpenChannelV2DecodeErrorZ_is_ok(o_conv);
29125         return ret_conv;
29126 }
29127
29128 void  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_free"))) TS_CResult_OpenChannelV2DecodeErrorZ_free(uint64_t _res) {
29129         if (!ptr_is_owned(_res)) return;
29130         void* _res_ptr = untag_ptr(_res);
29131         CHECK_ACCESS(_res_ptr);
29132         LDKCResult_OpenChannelV2DecodeErrorZ _res_conv = *(LDKCResult_OpenChannelV2DecodeErrorZ*)(_res_ptr);
29133         FREE(untag_ptr(_res));
29134         CResult_OpenChannelV2DecodeErrorZ_free(_res_conv);
29135 }
29136
29137 static inline uint64_t CResult_OpenChannelV2DecodeErrorZ_clone_ptr(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR arg) {
29138         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
29139         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone(arg);
29140         return tag_ptr(ret_conv, true);
29141 }
29142 int64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_clone_ptr"))) TS_CResult_OpenChannelV2DecodeErrorZ_clone_ptr(uint64_t arg) {
29143         LDKCResult_OpenChannelV2DecodeErrorZ* arg_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(arg);
29144         int64_t ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone_ptr(arg_conv);
29145         return ret_conv;
29146 }
29147
29148 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_clone"))) TS_CResult_OpenChannelV2DecodeErrorZ_clone(uint64_t orig) {
29149         LDKCResult_OpenChannelV2DecodeErrorZ* orig_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(orig);
29150         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
29151         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone(orig_conv);
29152         return tag_ptr(ret_conv, true);
29153 }
29154
29155 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint64_t o) {
29156         LDKRevokeAndACK o_conv;
29157         o_conv.inner = untag_ptr(o);
29158         o_conv.is_owned = ptr_is_owned(o);
29159         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29160         o_conv = RevokeAndACK_clone(&o_conv);
29161         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
29162         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
29163         return tag_ptr(ret_conv, true);
29164 }
29165
29166 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint64_t e) {
29167         void* e_ptr = untag_ptr(e);
29168         CHECK_ACCESS(e_ptr);
29169         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29170         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29171         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
29172         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
29173         return tag_ptr(ret_conv, true);
29174 }
29175
29176 jboolean  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_is_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_is_ok(uint64_t o) {
29177         LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(o);
29178         jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
29179         return ret_conv;
29180 }
29181
29182 void  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_free"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint64_t _res) {
29183         if (!ptr_is_owned(_res)) return;
29184         void* _res_ptr = untag_ptr(_res);
29185         CHECK_ACCESS(_res_ptr);
29186         LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
29187         FREE(untag_ptr(_res));
29188         CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
29189 }
29190
29191 static inline uint64_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
29192         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
29193         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
29194         return tag_ptr(ret_conv, true);
29195 }
29196 int64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr(uint64_t arg) {
29197         LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(arg);
29198         int64_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
29199         return ret_conv;
29200 }
29201
29202 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint64_t orig) {
29203         LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(orig);
29204         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
29205         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
29206         return tag_ptr(ret_conv, true);
29207 }
29208
29209 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_ok"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint64_t o) {
29210         LDKShutdown o_conv;
29211         o_conv.inner = untag_ptr(o);
29212         o_conv.is_owned = ptr_is_owned(o);
29213         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29214         o_conv = Shutdown_clone(&o_conv);
29215         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
29216         *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
29217         return tag_ptr(ret_conv, true);
29218 }
29219
29220 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_err"))) TS_CResult_ShutdownDecodeErrorZ_err(uint64_t e) {
29221         void* e_ptr = untag_ptr(e);
29222         CHECK_ACCESS(e_ptr);
29223         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29224         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29225         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
29226         *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
29227         return tag_ptr(ret_conv, true);
29228 }
29229
29230 jboolean  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_is_ok"))) TS_CResult_ShutdownDecodeErrorZ_is_ok(uint64_t o) {
29231         LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(o);
29232         jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
29233         return ret_conv;
29234 }
29235
29236 void  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_free"))) TS_CResult_ShutdownDecodeErrorZ_free(uint64_t _res) {
29237         if (!ptr_is_owned(_res)) return;
29238         void* _res_ptr = untag_ptr(_res);
29239         CHECK_ACCESS(_res_ptr);
29240         LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
29241         FREE(untag_ptr(_res));
29242         CResult_ShutdownDecodeErrorZ_free(_res_conv);
29243 }
29244
29245 static inline uint64_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
29246         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
29247         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
29248         return tag_ptr(ret_conv, true);
29249 }
29250 int64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownDecodeErrorZ_clone_ptr(uint64_t arg) {
29251         LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(arg);
29252         int64_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
29253         return ret_conv;
29254 }
29255
29256 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint64_t orig) {
29257         LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(orig);
29258         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
29259         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
29260         return tag_ptr(ret_conv, true);
29261 }
29262
29263 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint64_t o) {
29264         LDKUpdateFailHTLC o_conv;
29265         o_conv.inner = untag_ptr(o);
29266         o_conv.is_owned = ptr_is_owned(o);
29267         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29268         o_conv = UpdateFailHTLC_clone(&o_conv);
29269         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
29270         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
29271         return tag_ptr(ret_conv, true);
29272 }
29273
29274 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint64_t e) {
29275         void* e_ptr = untag_ptr(e);
29276         CHECK_ACCESS(e_ptr);
29277         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29278         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29279         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
29280         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
29281         return tag_ptr(ret_conv, true);
29282 }
29283
29284 jboolean  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok(uint64_t o) {
29285         LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(o);
29286         jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
29287         return ret_conv;
29288 }
29289
29290 void  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint64_t _res) {
29291         if (!ptr_is_owned(_res)) return;
29292         void* _res_ptr = untag_ptr(_res);
29293         CHECK_ACCESS(_res_ptr);
29294         LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
29295         FREE(untag_ptr(_res));
29296         CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
29297 }
29298
29299 static inline uint64_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
29300         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
29301         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
29302         return tag_ptr(ret_conv, true);
29303 }
29304 int64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
29305         LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(arg);
29306         int64_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
29307         return ret_conv;
29308 }
29309
29310 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint64_t orig) {
29311         LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(orig);
29312         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
29313         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
29314         return tag_ptr(ret_conv, true);
29315 }
29316
29317 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint64_t o) {
29318         LDKUpdateFailMalformedHTLC o_conv;
29319         o_conv.inner = untag_ptr(o);
29320         o_conv.is_owned = ptr_is_owned(o);
29321         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29322         o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
29323         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
29324         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
29325         return tag_ptr(ret_conv, true);
29326 }
29327
29328 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint64_t e) {
29329         void* e_ptr = untag_ptr(e);
29330         CHECK_ACCESS(e_ptr);
29331         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29332         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29333         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
29334         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
29335         return tag_ptr(ret_conv, true);
29336 }
29337
29338 jboolean  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(uint64_t o) {
29339         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(o);
29340         jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
29341         return ret_conv;
29342 }
29343
29344 void  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint64_t _res) {
29345         if (!ptr_is_owned(_res)) return;
29346         void* _res_ptr = untag_ptr(_res);
29347         CHECK_ACCESS(_res_ptr);
29348         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
29349         FREE(untag_ptr(_res));
29350         CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
29351 }
29352
29353 static inline uint64_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
29354         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
29355         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
29356         return tag_ptr(ret_conv, true);
29357 }
29358 int64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
29359         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(arg);
29360         int64_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
29361         return ret_conv;
29362 }
29363
29364 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint64_t orig) {
29365         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(orig);
29366         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
29367         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
29368         return tag_ptr(ret_conv, true);
29369 }
29370
29371 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint64_t o) {
29372         LDKUpdateFee o_conv;
29373         o_conv.inner = untag_ptr(o);
29374         o_conv.is_owned = ptr_is_owned(o);
29375         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29376         o_conv = UpdateFee_clone(&o_conv);
29377         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
29378         *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
29379         return tag_ptr(ret_conv, true);
29380 }
29381
29382 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_err"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint64_t e) {
29383         void* e_ptr = untag_ptr(e);
29384         CHECK_ACCESS(e_ptr);
29385         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29386         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29387         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
29388         *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
29389         return tag_ptr(ret_conv, true);
29390 }
29391
29392 jboolean  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_is_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_is_ok(uint64_t o) {
29393         LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(o);
29394         jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
29395         return ret_conv;
29396 }
29397
29398 void  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_free"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint64_t _res) {
29399         if (!ptr_is_owned(_res)) return;
29400         void* _res_ptr = untag_ptr(_res);
29401         CHECK_ACCESS(_res_ptr);
29402         LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
29403         FREE(untag_ptr(_res));
29404         CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
29405 }
29406
29407 static inline uint64_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
29408         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
29409         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
29410         return tag_ptr(ret_conv, true);
29411 }
29412 int64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr(uint64_t arg) {
29413         LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(arg);
29414         int64_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
29415         return ret_conv;
29416 }
29417
29418 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint64_t orig) {
29419         LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(orig);
29420         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
29421         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
29422         return tag_ptr(ret_conv, true);
29423 }
29424
29425 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint64_t o) {
29426         LDKUpdateFulfillHTLC o_conv;
29427         o_conv.inner = untag_ptr(o);
29428         o_conv.is_owned = ptr_is_owned(o);
29429         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29430         o_conv = UpdateFulfillHTLC_clone(&o_conv);
29431         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
29432         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
29433         return tag_ptr(ret_conv, true);
29434 }
29435
29436 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint64_t e) {
29437         void* e_ptr = untag_ptr(e);
29438         CHECK_ACCESS(e_ptr);
29439         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29440         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29441         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
29442         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
29443         return tag_ptr(ret_conv, true);
29444 }
29445
29446 jboolean  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(uint64_t o) {
29447         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(o);
29448         jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
29449         return ret_conv;
29450 }
29451
29452 void  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint64_t _res) {
29453         if (!ptr_is_owned(_res)) return;
29454         void* _res_ptr = untag_ptr(_res);
29455         CHECK_ACCESS(_res_ptr);
29456         LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
29457         FREE(untag_ptr(_res));
29458         CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
29459 }
29460
29461 static inline uint64_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
29462         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
29463         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
29464         return tag_ptr(ret_conv, true);
29465 }
29466 int64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
29467         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(arg);
29468         int64_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
29469         return ret_conv;
29470 }
29471
29472 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint64_t orig) {
29473         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(orig);
29474         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
29475         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
29476         return tag_ptr(ret_conv, true);
29477 }
29478
29479 uint64_t  __attribute__((export_name("TS_CResult_OnionPacketDecodeErrorZ_ok"))) TS_CResult_OnionPacketDecodeErrorZ_ok(uint64_t o) {
29480         LDKOnionPacket o_conv;
29481         o_conv.inner = untag_ptr(o);
29482         o_conv.is_owned = ptr_is_owned(o);
29483         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29484         o_conv = OnionPacket_clone(&o_conv);
29485         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
29486         *ret_conv = CResult_OnionPacketDecodeErrorZ_ok(o_conv);
29487         return tag_ptr(ret_conv, true);
29488 }
29489
29490 uint64_t  __attribute__((export_name("TS_CResult_OnionPacketDecodeErrorZ_err"))) TS_CResult_OnionPacketDecodeErrorZ_err(uint64_t e) {
29491         void* e_ptr = untag_ptr(e);
29492         CHECK_ACCESS(e_ptr);
29493         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29494         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29495         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
29496         *ret_conv = CResult_OnionPacketDecodeErrorZ_err(e_conv);
29497         return tag_ptr(ret_conv, true);
29498 }
29499
29500 jboolean  __attribute__((export_name("TS_CResult_OnionPacketDecodeErrorZ_is_ok"))) TS_CResult_OnionPacketDecodeErrorZ_is_ok(uint64_t o) {
29501         LDKCResult_OnionPacketDecodeErrorZ* o_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(o);
29502         jboolean ret_conv = CResult_OnionPacketDecodeErrorZ_is_ok(o_conv);
29503         return ret_conv;
29504 }
29505
29506 void  __attribute__((export_name("TS_CResult_OnionPacketDecodeErrorZ_free"))) TS_CResult_OnionPacketDecodeErrorZ_free(uint64_t _res) {
29507         if (!ptr_is_owned(_res)) return;
29508         void* _res_ptr = untag_ptr(_res);
29509         CHECK_ACCESS(_res_ptr);
29510         LDKCResult_OnionPacketDecodeErrorZ _res_conv = *(LDKCResult_OnionPacketDecodeErrorZ*)(_res_ptr);
29511         FREE(untag_ptr(_res));
29512         CResult_OnionPacketDecodeErrorZ_free(_res_conv);
29513 }
29514
29515 static inline uint64_t CResult_OnionPacketDecodeErrorZ_clone_ptr(LDKCResult_OnionPacketDecodeErrorZ *NONNULL_PTR arg) {
29516         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
29517         *ret_conv = CResult_OnionPacketDecodeErrorZ_clone(arg);
29518         return tag_ptr(ret_conv, true);
29519 }
29520 int64_t  __attribute__((export_name("TS_CResult_OnionPacketDecodeErrorZ_clone_ptr"))) TS_CResult_OnionPacketDecodeErrorZ_clone_ptr(uint64_t arg) {
29521         LDKCResult_OnionPacketDecodeErrorZ* arg_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(arg);
29522         int64_t ret_conv = CResult_OnionPacketDecodeErrorZ_clone_ptr(arg_conv);
29523         return ret_conv;
29524 }
29525
29526 uint64_t  __attribute__((export_name("TS_CResult_OnionPacketDecodeErrorZ_clone"))) TS_CResult_OnionPacketDecodeErrorZ_clone(uint64_t orig) {
29527         LDKCResult_OnionPacketDecodeErrorZ* orig_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(orig);
29528         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
29529         *ret_conv = CResult_OnionPacketDecodeErrorZ_clone(orig_conv);
29530         return tag_ptr(ret_conv, true);
29531 }
29532
29533 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint64_t o) {
29534         LDKUpdateAddHTLC o_conv;
29535         o_conv.inner = untag_ptr(o);
29536         o_conv.is_owned = ptr_is_owned(o);
29537         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29538         o_conv = UpdateAddHTLC_clone(&o_conv);
29539         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
29540         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
29541         return tag_ptr(ret_conv, true);
29542 }
29543
29544 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint64_t e) {
29545         void* e_ptr = untag_ptr(e);
29546         CHECK_ACCESS(e_ptr);
29547         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29548         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29549         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
29550         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
29551         return tag_ptr(ret_conv, true);
29552 }
29553
29554 jboolean  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok(uint64_t o) {
29555         LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(o);
29556         jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
29557         return ret_conv;
29558 }
29559
29560 void  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_free"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint64_t _res) {
29561         if (!ptr_is_owned(_res)) return;
29562         void* _res_ptr = untag_ptr(_res);
29563         CHECK_ACCESS(_res_ptr);
29564         LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
29565         FREE(untag_ptr(_res));
29566         CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
29567 }
29568
29569 static inline uint64_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
29570         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
29571         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
29572         return tag_ptr(ret_conv, true);
29573 }
29574 int64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
29575         LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(arg);
29576         int64_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
29577         return ret_conv;
29578 }
29579
29580 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint64_t orig) {
29581         LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(orig);
29582         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
29583         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
29584         return tag_ptr(ret_conv, true);
29585 }
29586
29587 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_ok"))) TS_CResult_OnionMessageDecodeErrorZ_ok(uint64_t o) {
29588         LDKOnionMessage o_conv;
29589         o_conv.inner = untag_ptr(o);
29590         o_conv.is_owned = ptr_is_owned(o);
29591         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29592         o_conv = OnionMessage_clone(&o_conv);
29593         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
29594         *ret_conv = CResult_OnionMessageDecodeErrorZ_ok(o_conv);
29595         return tag_ptr(ret_conv, true);
29596 }
29597
29598 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_err"))) TS_CResult_OnionMessageDecodeErrorZ_err(uint64_t e) {
29599         void* e_ptr = untag_ptr(e);
29600         CHECK_ACCESS(e_ptr);
29601         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29602         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29603         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
29604         *ret_conv = CResult_OnionMessageDecodeErrorZ_err(e_conv);
29605         return tag_ptr(ret_conv, true);
29606 }
29607
29608 jboolean  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_is_ok"))) TS_CResult_OnionMessageDecodeErrorZ_is_ok(uint64_t o) {
29609         LDKCResult_OnionMessageDecodeErrorZ* o_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(o);
29610         jboolean ret_conv = CResult_OnionMessageDecodeErrorZ_is_ok(o_conv);
29611         return ret_conv;
29612 }
29613
29614 void  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_free"))) TS_CResult_OnionMessageDecodeErrorZ_free(uint64_t _res) {
29615         if (!ptr_is_owned(_res)) return;
29616         void* _res_ptr = untag_ptr(_res);
29617         CHECK_ACCESS(_res_ptr);
29618         LDKCResult_OnionMessageDecodeErrorZ _res_conv = *(LDKCResult_OnionMessageDecodeErrorZ*)(_res_ptr);
29619         FREE(untag_ptr(_res));
29620         CResult_OnionMessageDecodeErrorZ_free(_res_conv);
29621 }
29622
29623 static inline uint64_t CResult_OnionMessageDecodeErrorZ_clone_ptr(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR arg) {
29624         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
29625         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(arg);
29626         return tag_ptr(ret_conv, true);
29627 }
29628 int64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_clone_ptr"))) TS_CResult_OnionMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
29629         LDKCResult_OnionMessageDecodeErrorZ* arg_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(arg);
29630         int64_t ret_conv = CResult_OnionMessageDecodeErrorZ_clone_ptr(arg_conv);
29631         return ret_conv;
29632 }
29633
29634 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_clone"))) TS_CResult_OnionMessageDecodeErrorZ_clone(uint64_t orig) {
29635         LDKCResult_OnionMessageDecodeErrorZ* orig_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(orig);
29636         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
29637         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(orig_conv);
29638         return tag_ptr(ret_conv, true);
29639 }
29640
29641 uint64_t  __attribute__((export_name("TS_CResult_FinalOnionHopDataDecodeErrorZ_ok"))) TS_CResult_FinalOnionHopDataDecodeErrorZ_ok(uint64_t o) {
29642         LDKFinalOnionHopData o_conv;
29643         o_conv.inner = untag_ptr(o);
29644         o_conv.is_owned = ptr_is_owned(o);
29645         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29646         o_conv = FinalOnionHopData_clone(&o_conv);
29647         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
29648         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_ok(o_conv);
29649         return tag_ptr(ret_conv, true);
29650 }
29651
29652 uint64_t  __attribute__((export_name("TS_CResult_FinalOnionHopDataDecodeErrorZ_err"))) TS_CResult_FinalOnionHopDataDecodeErrorZ_err(uint64_t e) {
29653         void* e_ptr = untag_ptr(e);
29654         CHECK_ACCESS(e_ptr);
29655         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29656         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29657         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
29658         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_err(e_conv);
29659         return tag_ptr(ret_conv, true);
29660 }
29661
29662 jboolean  __attribute__((export_name("TS_CResult_FinalOnionHopDataDecodeErrorZ_is_ok"))) TS_CResult_FinalOnionHopDataDecodeErrorZ_is_ok(uint64_t o) {
29663         LDKCResult_FinalOnionHopDataDecodeErrorZ* o_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(o);
29664         jboolean ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_is_ok(o_conv);
29665         return ret_conv;
29666 }
29667
29668 void  __attribute__((export_name("TS_CResult_FinalOnionHopDataDecodeErrorZ_free"))) TS_CResult_FinalOnionHopDataDecodeErrorZ_free(uint64_t _res) {
29669         if (!ptr_is_owned(_res)) return;
29670         void* _res_ptr = untag_ptr(_res);
29671         CHECK_ACCESS(_res_ptr);
29672         LDKCResult_FinalOnionHopDataDecodeErrorZ _res_conv = *(LDKCResult_FinalOnionHopDataDecodeErrorZ*)(_res_ptr);
29673         FREE(untag_ptr(_res));
29674         CResult_FinalOnionHopDataDecodeErrorZ_free(_res_conv);
29675 }
29676
29677 static inline uint64_t CResult_FinalOnionHopDataDecodeErrorZ_clone_ptr(LDKCResult_FinalOnionHopDataDecodeErrorZ *NONNULL_PTR arg) {
29678         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
29679         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_clone(arg);
29680         return tag_ptr(ret_conv, true);
29681 }
29682 int64_t  __attribute__((export_name("TS_CResult_FinalOnionHopDataDecodeErrorZ_clone_ptr"))) TS_CResult_FinalOnionHopDataDecodeErrorZ_clone_ptr(uint64_t arg) {
29683         LDKCResult_FinalOnionHopDataDecodeErrorZ* arg_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(arg);
29684         int64_t ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_clone_ptr(arg_conv);
29685         return ret_conv;
29686 }
29687
29688 uint64_t  __attribute__((export_name("TS_CResult_FinalOnionHopDataDecodeErrorZ_clone"))) TS_CResult_FinalOnionHopDataDecodeErrorZ_clone(uint64_t orig) {
29689         LDKCResult_FinalOnionHopDataDecodeErrorZ* orig_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(orig);
29690         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
29691         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_clone(orig_conv);
29692         return tag_ptr(ret_conv, true);
29693 }
29694
29695 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_ok"))) TS_CResult_PingDecodeErrorZ_ok(uint64_t o) {
29696         LDKPing o_conv;
29697         o_conv.inner = untag_ptr(o);
29698         o_conv.is_owned = ptr_is_owned(o);
29699         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29700         o_conv = Ping_clone(&o_conv);
29701         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
29702         *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
29703         return tag_ptr(ret_conv, true);
29704 }
29705
29706 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_err"))) TS_CResult_PingDecodeErrorZ_err(uint64_t e) {
29707         void* e_ptr = untag_ptr(e);
29708         CHECK_ACCESS(e_ptr);
29709         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29710         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29711         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
29712         *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
29713         return tag_ptr(ret_conv, true);
29714 }
29715
29716 jboolean  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_is_ok"))) TS_CResult_PingDecodeErrorZ_is_ok(uint64_t o) {
29717         LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(o);
29718         jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
29719         return ret_conv;
29720 }
29721
29722 void  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_free"))) TS_CResult_PingDecodeErrorZ_free(uint64_t _res) {
29723         if (!ptr_is_owned(_res)) return;
29724         void* _res_ptr = untag_ptr(_res);
29725         CHECK_ACCESS(_res_ptr);
29726         LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
29727         FREE(untag_ptr(_res));
29728         CResult_PingDecodeErrorZ_free(_res_conv);
29729 }
29730
29731 static inline uint64_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
29732         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
29733         *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
29734         return tag_ptr(ret_conv, true);
29735 }
29736 int64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone_ptr"))) TS_CResult_PingDecodeErrorZ_clone_ptr(uint64_t arg) {
29737         LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(arg);
29738         int64_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
29739         return ret_conv;
29740 }
29741
29742 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone"))) TS_CResult_PingDecodeErrorZ_clone(uint64_t orig) {
29743         LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(orig);
29744         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
29745         *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
29746         return tag_ptr(ret_conv, true);
29747 }
29748
29749 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_ok"))) TS_CResult_PongDecodeErrorZ_ok(uint64_t o) {
29750         LDKPong o_conv;
29751         o_conv.inner = untag_ptr(o);
29752         o_conv.is_owned = ptr_is_owned(o);
29753         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29754         o_conv = Pong_clone(&o_conv);
29755         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
29756         *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
29757         return tag_ptr(ret_conv, true);
29758 }
29759
29760 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_err"))) TS_CResult_PongDecodeErrorZ_err(uint64_t e) {
29761         void* e_ptr = untag_ptr(e);
29762         CHECK_ACCESS(e_ptr);
29763         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29764         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29765         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
29766         *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
29767         return tag_ptr(ret_conv, true);
29768 }
29769
29770 jboolean  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_is_ok"))) TS_CResult_PongDecodeErrorZ_is_ok(uint64_t o) {
29771         LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(o);
29772         jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
29773         return ret_conv;
29774 }
29775
29776 void  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_free"))) TS_CResult_PongDecodeErrorZ_free(uint64_t _res) {
29777         if (!ptr_is_owned(_res)) return;
29778         void* _res_ptr = untag_ptr(_res);
29779         CHECK_ACCESS(_res_ptr);
29780         LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
29781         FREE(untag_ptr(_res));
29782         CResult_PongDecodeErrorZ_free(_res_conv);
29783 }
29784
29785 static inline uint64_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
29786         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
29787         *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
29788         return tag_ptr(ret_conv, true);
29789 }
29790 int64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone_ptr"))) TS_CResult_PongDecodeErrorZ_clone_ptr(uint64_t arg) {
29791         LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(arg);
29792         int64_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
29793         return ret_conv;
29794 }
29795
29796 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone"))) TS_CResult_PongDecodeErrorZ_clone(uint64_t orig) {
29797         LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(orig);
29798         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
29799         *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
29800         return tag_ptr(ret_conv, true);
29801 }
29802
29803 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint64_t o) {
29804         LDKUnsignedChannelAnnouncement o_conv;
29805         o_conv.inner = untag_ptr(o);
29806         o_conv.is_owned = ptr_is_owned(o);
29807         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29808         o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
29809         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
29810         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
29811         return tag_ptr(ret_conv, true);
29812 }
29813
29814 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint64_t e) {
29815         void* e_ptr = untag_ptr(e);
29816         CHECK_ACCESS(e_ptr);
29817         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29818         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29819         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
29820         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
29821         return tag_ptr(ret_conv, true);
29822 }
29823
29824 jboolean  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
29825         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
29826         jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
29827         return ret_conv;
29828 }
29829
29830 void  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint64_t _res) {
29831         if (!ptr_is_owned(_res)) return;
29832         void* _res_ptr = untag_ptr(_res);
29833         CHECK_ACCESS(_res_ptr);
29834         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
29835         FREE(untag_ptr(_res));
29836         CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
29837 }
29838
29839 static inline uint64_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
29840         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
29841         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
29842         return tag_ptr(ret_conv, true);
29843 }
29844 int64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
29845         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
29846         int64_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
29847         return ret_conv;
29848 }
29849
29850 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint64_t orig) {
29851         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
29852         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
29853         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
29854         return tag_ptr(ret_conv, true);
29855 }
29856
29857 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint64_t o) {
29858         LDKChannelAnnouncement o_conv;
29859         o_conv.inner = untag_ptr(o);
29860         o_conv.is_owned = ptr_is_owned(o);
29861         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29862         o_conv = ChannelAnnouncement_clone(&o_conv);
29863         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
29864         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
29865         return tag_ptr(ret_conv, true);
29866 }
29867
29868 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint64_t e) {
29869         void* e_ptr = untag_ptr(e);
29870         CHECK_ACCESS(e_ptr);
29871         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29872         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29873         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
29874         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
29875         return tag_ptr(ret_conv, true);
29876 }
29877
29878 jboolean  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
29879         LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
29880         jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
29881         return ret_conv;
29882 }
29883
29884 void  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint64_t _res) {
29885         if (!ptr_is_owned(_res)) return;
29886         void* _res_ptr = untag_ptr(_res);
29887         CHECK_ACCESS(_res_ptr);
29888         LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
29889         FREE(untag_ptr(_res));
29890         CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
29891 }
29892
29893 static inline uint64_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
29894         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
29895         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
29896         return tag_ptr(ret_conv, true);
29897 }
29898 int64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
29899         LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
29900         int64_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
29901         return ret_conv;
29902 }
29903
29904 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint64_t orig) {
29905         LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
29906         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
29907         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
29908         return tag_ptr(ret_conv, true);
29909 }
29910
29911 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint64_t o) {
29912         LDKUnsignedChannelUpdate o_conv;
29913         o_conv.inner = untag_ptr(o);
29914         o_conv.is_owned = ptr_is_owned(o);
29915         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29916         o_conv = UnsignedChannelUpdate_clone(&o_conv);
29917         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
29918         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
29919         return tag_ptr(ret_conv, true);
29920 }
29921
29922 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint64_t e) {
29923         void* e_ptr = untag_ptr(e);
29924         CHECK_ACCESS(e_ptr);
29925         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29926         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29927         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
29928         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
29929         return tag_ptr(ret_conv, true);
29930 }
29931
29932 jboolean  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(uint64_t o) {
29933         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(o);
29934         jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
29935         return ret_conv;
29936 }
29937
29938 void  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint64_t _res) {
29939         if (!ptr_is_owned(_res)) return;
29940         void* _res_ptr = untag_ptr(_res);
29941         CHECK_ACCESS(_res_ptr);
29942         LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
29943         FREE(untag_ptr(_res));
29944         CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
29945 }
29946
29947 static inline uint64_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
29948         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
29949         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
29950         return tag_ptr(ret_conv, true);
29951 }
29952 int64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
29953         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(arg);
29954         int64_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
29955         return ret_conv;
29956 }
29957
29958 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint64_t orig) {
29959         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(orig);
29960         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
29961         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
29962         return tag_ptr(ret_conv, true);
29963 }
29964
29965 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint64_t o) {
29966         LDKChannelUpdate o_conv;
29967         o_conv.inner = untag_ptr(o);
29968         o_conv.is_owned = ptr_is_owned(o);
29969         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29970         o_conv = ChannelUpdate_clone(&o_conv);
29971         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
29972         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
29973         return tag_ptr(ret_conv, true);
29974 }
29975
29976 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint64_t e) {
29977         void* e_ptr = untag_ptr(e);
29978         CHECK_ACCESS(e_ptr);
29979         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29980         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29981         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
29982         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
29983         return tag_ptr(ret_conv, true);
29984 }
29985
29986 jboolean  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_is_ok(uint64_t o) {
29987         LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(o);
29988         jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
29989         return ret_conv;
29990 }
29991
29992 void  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_free"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint64_t _res) {
29993         if (!ptr_is_owned(_res)) return;
29994         void* _res_ptr = untag_ptr(_res);
29995         CHECK_ACCESS(_res_ptr);
29996         LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
29997         FREE(untag_ptr(_res));
29998         CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
29999 }
30000
30001 static inline uint64_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
30002         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
30003         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
30004         return tag_ptr(ret_conv, true);
30005 }
30006 int64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
30007         LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(arg);
30008         int64_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
30009         return ret_conv;
30010 }
30011
30012 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint64_t orig) {
30013         LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(orig);
30014         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
30015         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
30016         return tag_ptr(ret_conv, true);
30017 }
30018
30019 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint64_t o) {
30020         LDKErrorMessage o_conv;
30021         o_conv.inner = untag_ptr(o);
30022         o_conv.is_owned = ptr_is_owned(o);
30023         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30024         o_conv = ErrorMessage_clone(&o_conv);
30025         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
30026         *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
30027         return tag_ptr(ret_conv, true);
30028 }
30029
30030 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_err"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint64_t e) {
30031         void* e_ptr = untag_ptr(e);
30032         CHECK_ACCESS(e_ptr);
30033         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30034         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30035         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
30036         *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
30037         return tag_ptr(ret_conv, true);
30038 }
30039
30040 jboolean  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_is_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_is_ok(uint64_t o) {
30041         LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(o);
30042         jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
30043         return ret_conv;
30044 }
30045
30046 void  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_free"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint64_t _res) {
30047         if (!ptr_is_owned(_res)) return;
30048         void* _res_ptr = untag_ptr(_res);
30049         CHECK_ACCESS(_res_ptr);
30050         LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
30051         FREE(untag_ptr(_res));
30052         CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
30053 }
30054
30055 static inline uint64_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
30056         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
30057         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
30058         return tag_ptr(ret_conv, true);
30059 }
30060 int64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr"))) TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
30061         LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(arg);
30062         int64_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
30063         return ret_conv;
30064 }
30065
30066 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint64_t orig) {
30067         LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(orig);
30068         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
30069         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
30070         return tag_ptr(ret_conv, true);
30071 }
30072
30073 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_ok"))) TS_CResult_WarningMessageDecodeErrorZ_ok(uint64_t o) {
30074         LDKWarningMessage o_conv;
30075         o_conv.inner = untag_ptr(o);
30076         o_conv.is_owned = ptr_is_owned(o);
30077         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30078         o_conv = WarningMessage_clone(&o_conv);
30079         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
30080         *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
30081         return tag_ptr(ret_conv, true);
30082 }
30083
30084 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_err"))) TS_CResult_WarningMessageDecodeErrorZ_err(uint64_t e) {
30085         void* e_ptr = untag_ptr(e);
30086         CHECK_ACCESS(e_ptr);
30087         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30088         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30089         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
30090         *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
30091         return tag_ptr(ret_conv, true);
30092 }
30093
30094 jboolean  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_is_ok"))) TS_CResult_WarningMessageDecodeErrorZ_is_ok(uint64_t o) {
30095         LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(o);
30096         jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
30097         return ret_conv;
30098 }
30099
30100 void  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_free"))) TS_CResult_WarningMessageDecodeErrorZ_free(uint64_t _res) {
30101         if (!ptr_is_owned(_res)) return;
30102         void* _res_ptr = untag_ptr(_res);
30103         CHECK_ACCESS(_res_ptr);
30104         LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
30105         FREE(untag_ptr(_res));
30106         CResult_WarningMessageDecodeErrorZ_free(_res_conv);
30107 }
30108
30109 static inline uint64_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
30110         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
30111         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
30112         return tag_ptr(ret_conv, true);
30113 }
30114 int64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone_ptr"))) TS_CResult_WarningMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
30115         LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(arg);
30116         int64_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
30117         return ret_conv;
30118 }
30119
30120 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone"))) TS_CResult_WarningMessageDecodeErrorZ_clone(uint64_t orig) {
30121         LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(orig);
30122         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
30123         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
30124         return tag_ptr(ret_conv, true);
30125 }
30126
30127 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint64_t o) {
30128         LDKUnsignedNodeAnnouncement o_conv;
30129         o_conv.inner = untag_ptr(o);
30130         o_conv.is_owned = ptr_is_owned(o);
30131         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30132         o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
30133         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
30134         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
30135         return tag_ptr(ret_conv, true);
30136 }
30137
30138 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint64_t e) {
30139         void* e_ptr = untag_ptr(e);
30140         CHECK_ACCESS(e_ptr);
30141         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30142         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30143         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
30144         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
30145         return tag_ptr(ret_conv, true);
30146 }
30147
30148 jboolean  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
30149         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(o);
30150         jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
30151         return ret_conv;
30152 }
30153
30154 void  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint64_t _res) {
30155         if (!ptr_is_owned(_res)) return;
30156         void* _res_ptr = untag_ptr(_res);
30157         CHECK_ACCESS(_res_ptr);
30158         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
30159         FREE(untag_ptr(_res));
30160         CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
30161 }
30162
30163 static inline uint64_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
30164         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
30165         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
30166         return tag_ptr(ret_conv, true);
30167 }
30168 int64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
30169         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
30170         int64_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
30171         return ret_conv;
30172 }
30173
30174 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint64_t orig) {
30175         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
30176         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
30177         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
30178         return tag_ptr(ret_conv, true);
30179 }
30180
30181 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint64_t o) {
30182         LDKNodeAnnouncement o_conv;
30183         o_conv.inner = untag_ptr(o);
30184         o_conv.is_owned = ptr_is_owned(o);
30185         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30186         o_conv = NodeAnnouncement_clone(&o_conv);
30187         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
30188         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
30189         return tag_ptr(ret_conv, true);
30190 }
30191
30192 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint64_t e) {
30193         void* e_ptr = untag_ptr(e);
30194         CHECK_ACCESS(e_ptr);
30195         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30196         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30197         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
30198         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
30199         return tag_ptr(ret_conv, true);
30200 }
30201
30202 jboolean  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
30203         LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(o);
30204         jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
30205         return ret_conv;
30206 }
30207
30208 void  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint64_t _res) {
30209         if (!ptr_is_owned(_res)) return;
30210         void* _res_ptr = untag_ptr(_res);
30211         CHECK_ACCESS(_res_ptr);
30212         LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
30213         FREE(untag_ptr(_res));
30214         CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
30215 }
30216
30217 static inline uint64_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
30218         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
30219         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
30220         return tag_ptr(ret_conv, true);
30221 }
30222 int64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
30223         LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
30224         int64_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
30225         return ret_conv;
30226 }
30227
30228 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint64_t orig) {
30229         LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
30230         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
30231         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
30232         return tag_ptr(ret_conv, true);
30233 }
30234
30235 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint64_t o) {
30236         LDKQueryShortChannelIds o_conv;
30237         o_conv.inner = untag_ptr(o);
30238         o_conv.is_owned = ptr_is_owned(o);
30239         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30240         o_conv = QueryShortChannelIds_clone(&o_conv);
30241         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
30242         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
30243         return tag_ptr(ret_conv, true);
30244 }
30245
30246 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint64_t e) {
30247         void* e_ptr = untag_ptr(e);
30248         CHECK_ACCESS(e_ptr);
30249         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30250         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30251         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
30252         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
30253         return tag_ptr(ret_conv, true);
30254 }
30255
30256 jboolean  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(uint64_t o) {
30257         LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(o);
30258         jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
30259         return ret_conv;
30260 }
30261
30262 void  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_free"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint64_t _res) {
30263         if (!ptr_is_owned(_res)) return;
30264         void* _res_ptr = untag_ptr(_res);
30265         CHECK_ACCESS(_res_ptr);
30266         LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
30267         FREE(untag_ptr(_res));
30268         CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
30269 }
30270
30271 static inline uint64_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
30272         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
30273         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
30274         return tag_ptr(ret_conv, true);
30275 }
30276 int64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(uint64_t arg) {
30277         LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(arg);
30278         int64_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
30279         return ret_conv;
30280 }
30281
30282 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint64_t orig) {
30283         LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(orig);
30284         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
30285         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
30286         return tag_ptr(ret_conv, true);
30287 }
30288
30289 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint64_t o) {
30290         LDKReplyShortChannelIdsEnd o_conv;
30291         o_conv.inner = untag_ptr(o);
30292         o_conv.is_owned = ptr_is_owned(o);
30293         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30294         o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
30295         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
30296         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
30297         return tag_ptr(ret_conv, true);
30298 }
30299
30300 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint64_t e) {
30301         void* e_ptr = untag_ptr(e);
30302         CHECK_ACCESS(e_ptr);
30303         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30304         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30305         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
30306         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
30307         return tag_ptr(ret_conv, true);
30308 }
30309
30310 jboolean  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(uint64_t o) {
30311         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(o);
30312         jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
30313         return ret_conv;
30314 }
30315
30316 void  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint64_t _res) {
30317         if (!ptr_is_owned(_res)) return;
30318         void* _res_ptr = untag_ptr(_res);
30319         CHECK_ACCESS(_res_ptr);
30320         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
30321         FREE(untag_ptr(_res));
30322         CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
30323 }
30324
30325 static inline uint64_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
30326         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
30327         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
30328         return tag_ptr(ret_conv, true);
30329 }
30330 int64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(uint64_t arg) {
30331         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(arg);
30332         int64_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
30333         return ret_conv;
30334 }
30335
30336 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint64_t orig) {
30337         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(orig);
30338         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
30339         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
30340         return tag_ptr(ret_conv, true);
30341 }
30342
30343 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint64_t o) {
30344         LDKQueryChannelRange o_conv;
30345         o_conv.inner = untag_ptr(o);
30346         o_conv.is_owned = ptr_is_owned(o);
30347         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30348         o_conv = QueryChannelRange_clone(&o_conv);
30349         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
30350         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
30351         return tag_ptr(ret_conv, true);
30352 }
30353
30354 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint64_t e) {
30355         void* e_ptr = untag_ptr(e);
30356         CHECK_ACCESS(e_ptr);
30357         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30358         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30359         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
30360         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
30361         return tag_ptr(ret_conv, true);
30362 }
30363
30364 jboolean  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok(uint64_t o) {
30365         LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(o);
30366         jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
30367         return ret_conv;
30368 }
30369
30370 void  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_free"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint64_t _res) {
30371         if (!ptr_is_owned(_res)) return;
30372         void* _res_ptr = untag_ptr(_res);
30373         CHECK_ACCESS(_res_ptr);
30374         LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
30375         FREE(untag_ptr(_res));
30376         CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
30377 }
30378
30379 static inline uint64_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
30380         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
30381         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
30382         return tag_ptr(ret_conv, true);
30383 }
30384 int64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
30385         LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(arg);
30386         int64_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
30387         return ret_conv;
30388 }
30389
30390 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint64_t orig) {
30391         LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(orig);
30392         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
30393         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
30394         return tag_ptr(ret_conv, true);
30395 }
30396
30397 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint64_t o) {
30398         LDKReplyChannelRange o_conv;
30399         o_conv.inner = untag_ptr(o);
30400         o_conv.is_owned = ptr_is_owned(o);
30401         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30402         o_conv = ReplyChannelRange_clone(&o_conv);
30403         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
30404         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
30405         return tag_ptr(ret_conv, true);
30406 }
30407
30408 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint64_t e) {
30409         void* e_ptr = untag_ptr(e);
30410         CHECK_ACCESS(e_ptr);
30411         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30412         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30413         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
30414         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
30415         return tag_ptr(ret_conv, true);
30416 }
30417
30418 jboolean  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok(uint64_t o) {
30419         LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(o);
30420         jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
30421         return ret_conv;
30422 }
30423
30424 void  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_free"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint64_t _res) {
30425         if (!ptr_is_owned(_res)) return;
30426         void* _res_ptr = untag_ptr(_res);
30427         CHECK_ACCESS(_res_ptr);
30428         LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
30429         FREE(untag_ptr(_res));
30430         CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
30431 }
30432
30433 static inline uint64_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
30434         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
30435         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
30436         return tag_ptr(ret_conv, true);
30437 }
30438 int64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
30439         LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(arg);
30440         int64_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
30441         return ret_conv;
30442 }
30443
30444 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint64_t orig) {
30445         LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(orig);
30446         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
30447         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
30448         return tag_ptr(ret_conv, true);
30449 }
30450
30451 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint64_t o) {
30452         LDKGossipTimestampFilter o_conv;
30453         o_conv.inner = untag_ptr(o);
30454         o_conv.is_owned = ptr_is_owned(o);
30455         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30456         o_conv = GossipTimestampFilter_clone(&o_conv);
30457         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
30458         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
30459         return tag_ptr(ret_conv, true);
30460 }
30461
30462 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint64_t e) {
30463         void* e_ptr = untag_ptr(e);
30464         CHECK_ACCESS(e_ptr);
30465         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30466         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30467         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
30468         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
30469         return tag_ptr(ret_conv, true);
30470 }
30471
30472 jboolean  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok(uint64_t o) {
30473         LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(o);
30474         jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
30475         return ret_conv;
30476 }
30477
30478 void  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_free"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint64_t _res) {
30479         if (!ptr_is_owned(_res)) return;
30480         void* _res_ptr = untag_ptr(_res);
30481         CHECK_ACCESS(_res_ptr);
30482         LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
30483         FREE(untag_ptr(_res));
30484         CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
30485 }
30486
30487 static inline uint64_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
30488         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
30489         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
30490         return tag_ptr(ret_conv, true);
30491 }
30492 int64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(uint64_t arg) {
30493         LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(arg);
30494         int64_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
30495         return ret_conv;
30496 }
30497
30498 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint64_t orig) {
30499         LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(orig);
30500         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
30501         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
30502         return tag_ptr(ret_conv, true);
30503 }
30504
30505 void  __attribute__((export_name("TS_CVec_PhantomRouteHintsZ_free"))) TS_CVec_PhantomRouteHintsZ_free(uint64_tArray _res) {
30506         LDKCVec_PhantomRouteHintsZ _res_constr;
30507         _res_constr.datalen = _res->arr_len;
30508         if (_res_constr.datalen > 0)
30509                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
30510         else
30511                 _res_constr.data = NULL;
30512         uint64_t* _res_vals = _res->elems;
30513         for (size_t t = 0; t < _res_constr.datalen; t++) {
30514                 uint64_t _res_conv_19 = _res_vals[t];
30515                 LDKPhantomRouteHints _res_conv_19_conv;
30516                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
30517                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
30518                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
30519                 _res_constr.data[t] = _res_conv_19_conv;
30520         }
30521         FREE(_res);
30522         CVec_PhantomRouteHintsZ_free(_res_constr);
30523 }
30524
30525 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_ok"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(uint64_t o) {
30526         LDKBolt11Invoice o_conv;
30527         o_conv.inner = untag_ptr(o);
30528         o_conv.is_owned = ptr_is_owned(o);
30529         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30530         o_conv = Bolt11Invoice_clone(&o_conv);
30531         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
30532         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(o_conv);
30533         return tag_ptr(ret_conv, true);
30534 }
30535
30536 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_err"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_err(uint64_t e) {
30537         void* e_ptr = untag_ptr(e);
30538         CHECK_ACCESS(e_ptr);
30539         LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
30540         e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)untag_ptr(e));
30541         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
30542         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_err(e_conv);
30543         return tag_ptr(ret_conv, true);
30544 }
30545
30546 jboolean  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(uint64_t o) {
30547         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(o);
30548         jboolean ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(o_conv);
30549         return ret_conv;
30550 }
30551
30552 void  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_free"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_free(uint64_t _res) {
30553         if (!ptr_is_owned(_res)) return;
30554         void* _res_ptr = untag_ptr(_res);
30555         CHECK_ACCESS(_res_ptr);
30556         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)(_res_ptr);
30557         FREE(untag_ptr(_res));
30558         CResult_Bolt11InvoiceSignOrCreationErrorZ_free(_res_conv);
30559 }
30560
30561 static inline uint64_t CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
30562         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
30563         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(arg);
30564         return tag_ptr(ret_conv, true);
30565 }
30566 int64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(uint64_t arg) {
30567         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(arg);
30568         int64_t ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
30569         return ret_conv;
30570 }
30571
30572 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_clone"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(uint64_t orig) {
30573         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(orig);
30574         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
30575         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(orig_conv);
30576         return tag_ptr(ret_conv, true);
30577 }
30578
30579 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_ok"))) TS_CResult_OffersMessageDecodeErrorZ_ok(uint64_t o) {
30580         void* o_ptr = untag_ptr(o);
30581         CHECK_ACCESS(o_ptr);
30582         LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr);
30583         o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o));
30584         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
30585         *ret_conv = CResult_OffersMessageDecodeErrorZ_ok(o_conv);
30586         return tag_ptr(ret_conv, true);
30587 }
30588
30589 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_err"))) TS_CResult_OffersMessageDecodeErrorZ_err(uint64_t e) {
30590         void* e_ptr = untag_ptr(e);
30591         CHECK_ACCESS(e_ptr);
30592         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30593         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30594         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
30595         *ret_conv = CResult_OffersMessageDecodeErrorZ_err(e_conv);
30596         return tag_ptr(ret_conv, true);
30597 }
30598
30599 jboolean  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_is_ok"))) TS_CResult_OffersMessageDecodeErrorZ_is_ok(uint64_t o) {
30600         LDKCResult_OffersMessageDecodeErrorZ* o_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(o);
30601         jboolean ret_conv = CResult_OffersMessageDecodeErrorZ_is_ok(o_conv);
30602         return ret_conv;
30603 }
30604
30605 void  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_free"))) TS_CResult_OffersMessageDecodeErrorZ_free(uint64_t _res) {
30606         if (!ptr_is_owned(_res)) return;
30607         void* _res_ptr = untag_ptr(_res);
30608         CHECK_ACCESS(_res_ptr);
30609         LDKCResult_OffersMessageDecodeErrorZ _res_conv = *(LDKCResult_OffersMessageDecodeErrorZ*)(_res_ptr);
30610         FREE(untag_ptr(_res));
30611         CResult_OffersMessageDecodeErrorZ_free(_res_conv);
30612 }
30613
30614 static inline uint64_t CResult_OffersMessageDecodeErrorZ_clone_ptr(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR arg) {
30615         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
30616         *ret_conv = CResult_OffersMessageDecodeErrorZ_clone(arg);
30617         return tag_ptr(ret_conv, true);
30618 }
30619 int64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_clone_ptr"))) TS_CResult_OffersMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
30620         LDKCResult_OffersMessageDecodeErrorZ* arg_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(arg);
30621         int64_t ret_conv = CResult_OffersMessageDecodeErrorZ_clone_ptr(arg_conv);
30622         return ret_conv;
30623 }
30624
30625 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_clone"))) TS_CResult_OffersMessageDecodeErrorZ_clone(uint64_t orig) {
30626         LDKCResult_OffersMessageDecodeErrorZ* orig_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(orig);
30627         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
30628         *ret_conv = CResult_OffersMessageDecodeErrorZ_clone(orig_conv);
30629         return tag_ptr(ret_conv, true);
30630 }
30631
30632 uint64_t  __attribute__((export_name("TS_COption_HTLCClaimZ_some"))) TS_COption_HTLCClaimZ_some(uint32_t o) {
30633         LDKHTLCClaim o_conv = LDKHTLCClaim_from_js(o);
30634         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
30635         *ret_copy = COption_HTLCClaimZ_some(o_conv);
30636         uint64_t ret_ref = tag_ptr(ret_copy, true);
30637         return ret_ref;
30638 }
30639
30640 uint64_t  __attribute__((export_name("TS_COption_HTLCClaimZ_none"))) TS_COption_HTLCClaimZ_none() {
30641         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
30642         *ret_copy = COption_HTLCClaimZ_none();
30643         uint64_t ret_ref = tag_ptr(ret_copy, true);
30644         return ret_ref;
30645 }
30646
30647 void  __attribute__((export_name("TS_COption_HTLCClaimZ_free"))) TS_COption_HTLCClaimZ_free(uint64_t _res) {
30648         if (!ptr_is_owned(_res)) return;
30649         void* _res_ptr = untag_ptr(_res);
30650         CHECK_ACCESS(_res_ptr);
30651         LDKCOption_HTLCClaimZ _res_conv = *(LDKCOption_HTLCClaimZ*)(_res_ptr);
30652         FREE(untag_ptr(_res));
30653         COption_HTLCClaimZ_free(_res_conv);
30654 }
30655
30656 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(uint64_t o) {
30657         LDKCounterpartyCommitmentSecrets o_conv;
30658         o_conv.inner = untag_ptr(o);
30659         o_conv.is_owned = ptr_is_owned(o);
30660         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30661         o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
30662         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
30663         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
30664         return tag_ptr(ret_conv, true);
30665 }
30666
30667 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(uint64_t e) {
30668         void* e_ptr = untag_ptr(e);
30669         CHECK_ACCESS(e_ptr);
30670         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30671         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30672         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
30673         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
30674         return tag_ptr(ret_conv, true);
30675 }
30676
30677 jboolean  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(uint64_t o) {
30678         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(o);
30679         jboolean ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
30680         return ret_conv;
30681 }
30682
30683 void  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(uint64_t _res) {
30684         if (!ptr_is_owned(_res)) return;
30685         void* _res_ptr = untag_ptr(_res);
30686         CHECK_ACCESS(_res_ptr);
30687         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
30688         FREE(untag_ptr(_res));
30689         CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
30690 }
30691
30692 static inline uint64_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
30693         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
30694         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
30695         return tag_ptr(ret_conv, true);
30696 }
30697 int64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(uint64_t arg) {
30698         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(arg);
30699         int64_t ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
30700         return ret_conv;
30701 }
30702
30703 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(uint64_t orig) {
30704         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(orig);
30705         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
30706         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
30707         return tag_ptr(ret_conv, true);
30708 }
30709
30710 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint64_t o) {
30711         LDKTxCreationKeys o_conv;
30712         o_conv.inner = untag_ptr(o);
30713         o_conv.is_owned = ptr_is_owned(o);
30714         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30715         o_conv = TxCreationKeys_clone(&o_conv);
30716         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
30717         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
30718         return tag_ptr(ret_conv, true);
30719 }
30720
30721 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint64_t e) {
30722         void* e_ptr = untag_ptr(e);
30723         CHECK_ACCESS(e_ptr);
30724         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30725         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30726         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
30727         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
30728         return tag_ptr(ret_conv, true);
30729 }
30730
30731 jboolean  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_is_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_is_ok(uint64_t o) {
30732         LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(o);
30733         jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
30734         return ret_conv;
30735 }
30736
30737 void  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_free"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint64_t _res) {
30738         if (!ptr_is_owned(_res)) return;
30739         void* _res_ptr = untag_ptr(_res);
30740         CHECK_ACCESS(_res_ptr);
30741         LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
30742         FREE(untag_ptr(_res));
30743         CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
30744 }
30745
30746 static inline uint64_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
30747         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
30748         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
30749         return tag_ptr(ret_conv, true);
30750 }
30751 int64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr(uint64_t arg) {
30752         LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(arg);
30753         int64_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
30754         return ret_conv;
30755 }
30756
30757 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint64_t orig) {
30758         LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(orig);
30759         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
30760         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
30761         return tag_ptr(ret_conv, true);
30762 }
30763
30764 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint64_t o) {
30765         LDKChannelPublicKeys o_conv;
30766         o_conv.inner = untag_ptr(o);
30767         o_conv.is_owned = ptr_is_owned(o);
30768         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30769         o_conv = ChannelPublicKeys_clone(&o_conv);
30770         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
30771         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
30772         return tag_ptr(ret_conv, true);
30773 }
30774
30775 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint64_t e) {
30776         void* e_ptr = untag_ptr(e);
30777         CHECK_ACCESS(e_ptr);
30778         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30779         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30780         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
30781         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
30782         return tag_ptr(ret_conv, true);
30783 }
30784
30785 jboolean  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok(uint64_t o) {
30786         LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(o);
30787         jboolean ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
30788         return ret_conv;
30789 }
30790
30791 void  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_free"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint64_t _res) {
30792         if (!ptr_is_owned(_res)) return;
30793         void* _res_ptr = untag_ptr(_res);
30794         CHECK_ACCESS(_res_ptr);
30795         LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
30796         FREE(untag_ptr(_res));
30797         CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
30798 }
30799
30800 static inline uint64_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
30801         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
30802         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
30803         return tag_ptr(ret_conv, true);
30804 }
30805 int64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(uint64_t arg) {
30806         LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(arg);
30807         int64_t ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
30808         return ret_conv;
30809 }
30810
30811 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint64_t orig) {
30812         LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(orig);
30813         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
30814         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
30815         return tag_ptr(ret_conv, true);
30816 }
30817
30818 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint64_t o) {
30819         LDKHTLCOutputInCommitment o_conv;
30820         o_conv.inner = untag_ptr(o);
30821         o_conv.is_owned = ptr_is_owned(o);
30822         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30823         o_conv = HTLCOutputInCommitment_clone(&o_conv);
30824         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
30825         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
30826         return tag_ptr(ret_conv, true);
30827 }
30828
30829 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint64_t e) {
30830         void* e_ptr = untag_ptr(e);
30831         CHECK_ACCESS(e_ptr);
30832         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30833         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30834         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
30835         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
30836         return tag_ptr(ret_conv, true);
30837 }
30838
30839 jboolean  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(uint64_t o) {
30840         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(o);
30841         jboolean ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
30842         return ret_conv;
30843 }
30844
30845 void  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint64_t _res) {
30846         if (!ptr_is_owned(_res)) return;
30847         void* _res_ptr = untag_ptr(_res);
30848         CHECK_ACCESS(_res_ptr);
30849         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
30850         FREE(untag_ptr(_res));
30851         CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
30852 }
30853
30854 static inline uint64_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
30855         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
30856         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
30857         return tag_ptr(ret_conv, true);
30858 }
30859 int64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(uint64_t arg) {
30860         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(arg);
30861         int64_t ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
30862         return ret_conv;
30863 }
30864
30865 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint64_t orig) {
30866         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(orig);
30867         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
30868         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
30869         return tag_ptr(ret_conv, true);
30870 }
30871
30872 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint64_t o) {
30873         LDKCounterpartyChannelTransactionParameters o_conv;
30874         o_conv.inner = untag_ptr(o);
30875         o_conv.is_owned = ptr_is_owned(o);
30876         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30877         o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
30878         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
30879         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
30880         return tag_ptr(ret_conv, true);
30881 }
30882
30883 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint64_t e) {
30884         void* e_ptr = untag_ptr(e);
30885         CHECK_ACCESS(e_ptr);
30886         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30887         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30888         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
30889         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
30890         return tag_ptr(ret_conv, true);
30891 }
30892
30893 jboolean  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(uint64_t o) {
30894         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
30895         jboolean ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
30896         return ret_conv;
30897 }
30898
30899 void  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint64_t _res) {
30900         if (!ptr_is_owned(_res)) return;
30901         void* _res_ptr = untag_ptr(_res);
30902         CHECK_ACCESS(_res_ptr);
30903         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
30904         FREE(untag_ptr(_res));
30905         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
30906 }
30907
30908 static inline uint64_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
30909         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
30910         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
30911         return tag_ptr(ret_conv, true);
30912 }
30913 int64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
30914         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
30915         int64_t ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
30916         return ret_conv;
30917 }
30918
30919 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint64_t orig) {
30920         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
30921         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
30922         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
30923         return tag_ptr(ret_conv, true);
30924 }
30925
30926 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint64_t o) {
30927         LDKChannelTransactionParameters o_conv;
30928         o_conv.inner = untag_ptr(o);
30929         o_conv.is_owned = ptr_is_owned(o);
30930         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30931         o_conv = ChannelTransactionParameters_clone(&o_conv);
30932         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
30933         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
30934         return tag_ptr(ret_conv, true);
30935 }
30936
30937 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint64_t e) {
30938         void* e_ptr = untag_ptr(e);
30939         CHECK_ACCESS(e_ptr);
30940         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30941         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30942         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
30943         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
30944         return tag_ptr(ret_conv, true);
30945 }
30946
30947 jboolean  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(uint64_t o) {
30948         LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
30949         jboolean ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
30950         return ret_conv;
30951 }
30952
30953 void  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint64_t _res) {
30954         if (!ptr_is_owned(_res)) return;
30955         void* _res_ptr = untag_ptr(_res);
30956         CHECK_ACCESS(_res_ptr);
30957         LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
30958         FREE(untag_ptr(_res));
30959         CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
30960 }
30961
30962 static inline uint64_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
30963         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
30964         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
30965         return tag_ptr(ret_conv, true);
30966 }
30967 int64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
30968         LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
30969         int64_t ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
30970         return ret_conv;
30971 }
30972
30973 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint64_t orig) {
30974         LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
30975         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
30976         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
30977         return tag_ptr(ret_conv, true);
30978 }
30979
30980 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
30981         LDKHolderCommitmentTransaction o_conv;
30982         o_conv.inner = untag_ptr(o);
30983         o_conv.is_owned = ptr_is_owned(o);
30984         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30985         o_conv = HolderCommitmentTransaction_clone(&o_conv);
30986         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
30987         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
30988         return tag_ptr(ret_conv, true);
30989 }
30990
30991 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err(uint64_t e) {
30992         void* e_ptr = untag_ptr(e);
30993         CHECK_ACCESS(e_ptr);
30994         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30995         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30996         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
30997         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
30998         return tag_ptr(ret_conv, true);
30999 }
31000
31001 jboolean  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
31002         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
31003         jboolean ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
31004         return ret_conv;
31005 }
31006
31007 void  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
31008         if (!ptr_is_owned(_res)) return;
31009         void* _res_ptr = untag_ptr(_res);
31010         CHECK_ACCESS(_res_ptr);
31011         LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
31012         FREE(untag_ptr(_res));
31013         CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
31014 }
31015
31016 static inline uint64_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
31017         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
31018         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
31019         return tag_ptr(ret_conv, true);
31020 }
31021 int64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
31022         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
31023         int64_t ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
31024         return ret_conv;
31025 }
31026
31027 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
31028         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
31029         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
31030         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
31031         return tag_ptr(ret_conv, true);
31032 }
31033
31034 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
31035         LDKBuiltCommitmentTransaction o_conv;
31036         o_conv.inner = untag_ptr(o);
31037         o_conv.is_owned = ptr_is_owned(o);
31038         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31039         o_conv = BuiltCommitmentTransaction_clone(&o_conv);
31040         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
31041         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
31042         return tag_ptr(ret_conv, true);
31043 }
31044
31045 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(uint64_t e) {
31046         void* e_ptr = untag_ptr(e);
31047         CHECK_ACCESS(e_ptr);
31048         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31049         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31050         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
31051         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
31052         return tag_ptr(ret_conv, true);
31053 }
31054
31055 jboolean  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
31056         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
31057         jboolean ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
31058         return ret_conv;
31059 }
31060
31061 void  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
31062         if (!ptr_is_owned(_res)) return;
31063         void* _res_ptr = untag_ptr(_res);
31064         CHECK_ACCESS(_res_ptr);
31065         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
31066         FREE(untag_ptr(_res));
31067         CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
31068 }
31069
31070 static inline uint64_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
31071         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
31072         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
31073         return tag_ptr(ret_conv, true);
31074 }
31075 int64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
31076         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
31077         int64_t ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
31078         return ret_conv;
31079 }
31080
31081 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
31082         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
31083         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
31084         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
31085         return tag_ptr(ret_conv, true);
31086 }
31087
31088 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_ok(uint64_t o) {
31089         LDKTrustedClosingTransaction o_conv;
31090         o_conv.inner = untag_ptr(o);
31091         o_conv.is_owned = ptr_is_owned(o);
31092         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31093         // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
31094         
31095         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
31096         *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
31097         return tag_ptr(ret_conv, true);
31098 }
31099
31100 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_err"))) TS_CResult_TrustedClosingTransactionNoneZ_err() {
31101         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
31102         *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
31103         return tag_ptr(ret_conv, true);
31104 }
31105
31106 jboolean  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_is_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_is_ok(uint64_t o) {
31107         LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(o);
31108         jboolean ret_conv = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
31109         return ret_conv;
31110 }
31111
31112 void  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_free"))) TS_CResult_TrustedClosingTransactionNoneZ_free(uint64_t _res) {
31113         if (!ptr_is_owned(_res)) return;
31114         void* _res_ptr = untag_ptr(_res);
31115         CHECK_ACCESS(_res_ptr);
31116         LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
31117         FREE(untag_ptr(_res));
31118         CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
31119 }
31120
31121 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
31122         LDKCommitmentTransaction o_conv;
31123         o_conv.inner = untag_ptr(o);
31124         o_conv.is_owned = ptr_is_owned(o);
31125         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31126         o_conv = CommitmentTransaction_clone(&o_conv);
31127         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
31128         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
31129         return tag_ptr(ret_conv, true);
31130 }
31131
31132 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint64_t e) {
31133         void* e_ptr = untag_ptr(e);
31134         CHECK_ACCESS(e_ptr);
31135         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31136         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31137         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
31138         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
31139         return tag_ptr(ret_conv, true);
31140 }
31141
31142 jboolean  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
31143         LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(o);
31144         jboolean ret_conv = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
31145         return ret_conv;
31146 }
31147
31148 void  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_free"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
31149         if (!ptr_is_owned(_res)) return;
31150         void* _res_ptr = untag_ptr(_res);
31151         CHECK_ACCESS(_res_ptr);
31152         LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
31153         FREE(untag_ptr(_res));
31154         CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
31155 }
31156
31157 static inline uint64_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
31158         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
31159         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
31160         return tag_ptr(ret_conv, true);
31161 }
31162 int64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
31163         LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
31164         int64_t ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
31165         return ret_conv;
31166 }
31167
31168 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
31169         LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
31170         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
31171         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
31172         return tag_ptr(ret_conv, true);
31173 }
31174
31175 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint64_t o) {
31176         LDKTrustedCommitmentTransaction o_conv;
31177         o_conv.inner = untag_ptr(o);
31178         o_conv.is_owned = ptr_is_owned(o);
31179         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31180         // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
31181         
31182         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
31183         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
31184         return tag_ptr(ret_conv, true);
31185 }
31186
31187 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
31188         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
31189         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
31190         return tag_ptr(ret_conv, true);
31191 }
31192
31193 jboolean  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok(uint64_t o) {
31194         LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(o);
31195         jboolean ret_conv = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
31196         return ret_conv;
31197 }
31198
31199 void  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_free"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint64_t _res) {
31200         if (!ptr_is_owned(_res)) return;
31201         void* _res_ptr = untag_ptr(_res);
31202         CHECK_ACCESS(_res_ptr);
31203         LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
31204         FREE(untag_ptr(_res));
31205         CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
31206 }
31207
31208 uint64_t  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_ok"))) TS_CResult_CVec_ECDSASignatureZNoneZ_ok(ptrArray o) {
31209         LDKCVec_ECDSASignatureZ o_constr;
31210         o_constr.datalen = o->arr_len;
31211         if (o_constr.datalen > 0)
31212                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
31213         else
31214                 o_constr.data = NULL;
31215         int8_tArray* o_vals = (void*) o->elems;
31216         for (size_t m = 0; m < o_constr.datalen; m++) {
31217                 int8_tArray o_conv_12 = o_vals[m];
31218                 LDKECDSASignature o_conv_12_ref;
31219                 CHECK(o_conv_12->arr_len == 64);
31220                 memcpy(o_conv_12_ref.compact_form, o_conv_12->elems, 64); FREE(o_conv_12);
31221                 o_constr.data[m] = o_conv_12_ref;
31222         }
31223         FREE(o);
31224         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
31225         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_ok(o_constr);
31226         return tag_ptr(ret_conv, true);
31227 }
31228
31229 uint64_t  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_err"))) TS_CResult_CVec_ECDSASignatureZNoneZ_err() {
31230         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
31231         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_err();
31232         return tag_ptr(ret_conv, true);
31233 }
31234
31235 jboolean  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_is_ok"))) TS_CResult_CVec_ECDSASignatureZNoneZ_is_ok(uint64_t o) {
31236         LDKCResult_CVec_ECDSASignatureZNoneZ* o_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(o);
31237         jboolean ret_conv = CResult_CVec_ECDSASignatureZNoneZ_is_ok(o_conv);
31238         return ret_conv;
31239 }
31240
31241 void  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_free"))) TS_CResult_CVec_ECDSASignatureZNoneZ_free(uint64_t _res) {
31242         if (!ptr_is_owned(_res)) return;
31243         void* _res_ptr = untag_ptr(_res);
31244         CHECK_ACCESS(_res_ptr);
31245         LDKCResult_CVec_ECDSASignatureZNoneZ _res_conv = *(LDKCResult_CVec_ECDSASignatureZNoneZ*)(_res_ptr);
31246         FREE(untag_ptr(_res));
31247         CResult_CVec_ECDSASignatureZNoneZ_free(_res_conv);
31248 }
31249
31250 static inline uint64_t CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR arg) {
31251         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
31252         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone(arg);
31253         return tag_ptr(ret_conv, true);
31254 }
31255 int64_t  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_clone_ptr"))) TS_CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(uint64_t arg) {
31256         LDKCResult_CVec_ECDSASignatureZNoneZ* arg_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(arg);
31257         int64_t ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(arg_conv);
31258         return ret_conv;
31259 }
31260
31261 uint64_t  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_clone"))) TS_CResult_CVec_ECDSASignatureZNoneZ_clone(uint64_t orig) {
31262         LDKCResult_CVec_ECDSASignatureZNoneZ* orig_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(orig);
31263         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
31264         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone(orig_conv);
31265         return tag_ptr(ret_conv, true);
31266 }
31267
31268 uint64_t  __attribute__((export_name("TS_COption_usizeZ_some"))) TS_COption_usizeZ_some(uint32_t o) {
31269         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
31270         *ret_copy = COption_usizeZ_some(o);
31271         uint64_t ret_ref = tag_ptr(ret_copy, true);
31272         return ret_ref;
31273 }
31274
31275 uint64_t  __attribute__((export_name("TS_COption_usizeZ_none"))) TS_COption_usizeZ_none() {
31276         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
31277         *ret_copy = COption_usizeZ_none();
31278         uint64_t ret_ref = tag_ptr(ret_copy, true);
31279         return ret_ref;
31280 }
31281
31282 void  __attribute__((export_name("TS_COption_usizeZ_free"))) TS_COption_usizeZ_free(uint64_t _res) {
31283         if (!ptr_is_owned(_res)) return;
31284         void* _res_ptr = untag_ptr(_res);
31285         CHECK_ACCESS(_res_ptr);
31286         LDKCOption_usizeZ _res_conv = *(LDKCOption_usizeZ*)(_res_ptr);
31287         FREE(untag_ptr(_res));
31288         COption_usizeZ_free(_res_conv);
31289 }
31290
31291 static inline uint64_t COption_usizeZ_clone_ptr(LDKCOption_usizeZ *NONNULL_PTR arg) {
31292         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
31293         *ret_copy = COption_usizeZ_clone(arg);
31294         uint64_t ret_ref = tag_ptr(ret_copy, true);
31295         return ret_ref;
31296 }
31297 int64_t  __attribute__((export_name("TS_COption_usizeZ_clone_ptr"))) TS_COption_usizeZ_clone_ptr(uint64_t arg) {
31298         LDKCOption_usizeZ* arg_conv = (LDKCOption_usizeZ*)untag_ptr(arg);
31299         int64_t ret_conv = COption_usizeZ_clone_ptr(arg_conv);
31300         return ret_conv;
31301 }
31302
31303 uint64_t  __attribute__((export_name("TS_COption_usizeZ_clone"))) TS_COption_usizeZ_clone(uint64_t orig) {
31304         LDKCOption_usizeZ* orig_conv = (LDKCOption_usizeZ*)untag_ptr(orig);
31305         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
31306         *ret_copy = COption_usizeZ_clone(orig_conv);
31307         uint64_t ret_ref = tag_ptr(ret_copy, true);
31308         return ret_ref;
31309 }
31310
31311 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_ok(uint64_t o) {
31312         LDKShutdownScript o_conv;
31313         o_conv.inner = untag_ptr(o);
31314         o_conv.is_owned = ptr_is_owned(o);
31315         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31316         o_conv = ShutdownScript_clone(&o_conv);
31317         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
31318         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
31319         return tag_ptr(ret_conv, true);
31320 }
31321
31322 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_err(uint64_t e) {
31323         void* e_ptr = untag_ptr(e);
31324         CHECK_ACCESS(e_ptr);
31325         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31326         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31327         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
31328         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
31329         return tag_ptr(ret_conv, true);
31330 }
31331
31332 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_is_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_is_ok(uint64_t o) {
31333         LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(o);
31334         jboolean ret_conv = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
31335         return ret_conv;
31336 }
31337
31338 void  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_free"))) TS_CResult_ShutdownScriptDecodeErrorZ_free(uint64_t _res) {
31339         if (!ptr_is_owned(_res)) return;
31340         void* _res_ptr = untag_ptr(_res);
31341         CHECK_ACCESS(_res_ptr);
31342         LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
31343         FREE(untag_ptr(_res));
31344         CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
31345 }
31346
31347 static inline uint64_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
31348         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
31349         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
31350         return tag_ptr(ret_conv, true);
31351 }
31352 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr(uint64_t arg) {
31353         LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(arg);
31354         int64_t ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
31355         return ret_conv;
31356 }
31357
31358 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone(uint64_t orig) {
31359         LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(orig);
31360         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
31361         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
31362         return tag_ptr(ret_conv, true);
31363 }
31364
31365 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok(uint64_t o) {
31366         LDKShutdownScript o_conv;
31367         o_conv.inner = untag_ptr(o);
31368         o_conv.is_owned = ptr_is_owned(o);
31369         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31370         o_conv = ShutdownScript_clone(&o_conv);
31371         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
31372         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
31373         return tag_ptr(ret_conv, true);
31374 }
31375
31376 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err(uint64_t e) {
31377         LDKInvalidShutdownScript e_conv;
31378         e_conv.inner = untag_ptr(e);
31379         e_conv.is_owned = ptr_is_owned(e);
31380         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
31381         e_conv = InvalidShutdownScript_clone(&e_conv);
31382         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
31383         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
31384         return tag_ptr(ret_conv, true);
31385 }
31386
31387 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(uint64_t o) {
31388         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(o);
31389         jboolean ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
31390         return ret_conv;
31391 }
31392
31393 void  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free(uint64_t _res) {
31394         if (!ptr_is_owned(_res)) return;
31395         void* _res_ptr = untag_ptr(_res);
31396         CHECK_ACCESS(_res_ptr);
31397         LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
31398         FREE(untag_ptr(_res));
31399         CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
31400 }
31401
31402 static inline uint64_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
31403         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
31404         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
31405         return tag_ptr(ret_conv, true);
31406 }
31407 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(uint64_t arg) {
31408         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(arg);
31409         int64_t ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
31410         return ret_conv;
31411 }
31412
31413 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone(uint64_t orig) {
31414         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(orig);
31415         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
31416         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
31417         return tag_ptr(ret_conv, true);
31418 }
31419
31420 void  __attribute__((export_name("TS_CVec_TransactionZ_free"))) TS_CVec_TransactionZ_free(ptrArray _res) {
31421         LDKCVec_TransactionZ _res_constr;
31422         _res_constr.datalen = _res->arr_len;
31423         if (_res_constr.datalen > 0)
31424                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
31425         else
31426                 _res_constr.data = NULL;
31427         int8_tArray* _res_vals = (void*) _res->elems;
31428         for (size_t m = 0; m < _res_constr.datalen; m++) {
31429                 int8_tArray _res_conv_12 = _res_vals[m];
31430                 LDKTransaction _res_conv_12_ref;
31431                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
31432                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
31433                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
31434                 _res_conv_12_ref.data_is_owned = true;
31435                 _res_constr.data[m] = _res_conv_12_ref;
31436         }
31437         FREE(_res);
31438         CVec_TransactionZ_free(_res_constr);
31439 }
31440
31441 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_ok(uint64_t o) {
31442         void* o_ptr = untag_ptr(o);
31443         CHECK_ACCESS(o_ptr);
31444         LDKPaymentPurpose o_conv = *(LDKPaymentPurpose*)(o_ptr);
31445         o_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(o));
31446         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
31447         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_ok(o_conv);
31448         return tag_ptr(ret_conv, true);
31449 }
31450
31451 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_err(uint64_t e) {
31452         void* e_ptr = untag_ptr(e);
31453         CHECK_ACCESS(e_ptr);
31454         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31455         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31456         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
31457         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_err(e_conv);
31458         return tag_ptr(ret_conv, true);
31459 }
31460
31461 jboolean  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_is_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_is_ok(uint64_t o) {
31462         LDKCResult_PaymentPurposeDecodeErrorZ* o_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(o);
31463         jboolean ret_conv = CResult_PaymentPurposeDecodeErrorZ_is_ok(o_conv);
31464         return ret_conv;
31465 }
31466
31467 void  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_free"))) TS_CResult_PaymentPurposeDecodeErrorZ_free(uint64_t _res) {
31468         if (!ptr_is_owned(_res)) return;
31469         void* _res_ptr = untag_ptr(_res);
31470         CHECK_ACCESS(_res_ptr);
31471         LDKCResult_PaymentPurposeDecodeErrorZ _res_conv = *(LDKCResult_PaymentPurposeDecodeErrorZ*)(_res_ptr);
31472         FREE(untag_ptr(_res));
31473         CResult_PaymentPurposeDecodeErrorZ_free(_res_conv);
31474 }
31475
31476 static inline uint64_t CResult_PaymentPurposeDecodeErrorZ_clone_ptr(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR arg) {
31477         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
31478         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(arg);
31479         return tag_ptr(ret_conv, true);
31480 }
31481 int64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr(uint64_t arg) {
31482         LDKCResult_PaymentPurposeDecodeErrorZ* arg_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(arg);
31483         int64_t ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone_ptr(arg_conv);
31484         return ret_conv;
31485 }
31486
31487 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone(uint64_t orig) {
31488         LDKCResult_PaymentPurposeDecodeErrorZ* orig_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(orig);
31489         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
31490         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(orig_conv);
31491         return tag_ptr(ret_conv, true);
31492 }
31493
31494 uint64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_ok"))) TS_CResult_ClaimedHTLCDecodeErrorZ_ok(uint64_t o) {
31495         LDKClaimedHTLC o_conv;
31496         o_conv.inner = untag_ptr(o);
31497         o_conv.is_owned = ptr_is_owned(o);
31498         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31499         o_conv = ClaimedHTLC_clone(&o_conv);
31500         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
31501         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_ok(o_conv);
31502         return tag_ptr(ret_conv, true);
31503 }
31504
31505 uint64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_err"))) TS_CResult_ClaimedHTLCDecodeErrorZ_err(uint64_t e) {
31506         void* e_ptr = untag_ptr(e);
31507         CHECK_ACCESS(e_ptr);
31508         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31509         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31510         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
31511         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_err(e_conv);
31512         return tag_ptr(ret_conv, true);
31513 }
31514
31515 jboolean  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_is_ok"))) TS_CResult_ClaimedHTLCDecodeErrorZ_is_ok(uint64_t o) {
31516         LDKCResult_ClaimedHTLCDecodeErrorZ* o_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(o);
31517         jboolean ret_conv = CResult_ClaimedHTLCDecodeErrorZ_is_ok(o_conv);
31518         return ret_conv;
31519 }
31520
31521 void  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_free"))) TS_CResult_ClaimedHTLCDecodeErrorZ_free(uint64_t _res) {
31522         if (!ptr_is_owned(_res)) return;
31523         void* _res_ptr = untag_ptr(_res);
31524         CHECK_ACCESS(_res_ptr);
31525         LDKCResult_ClaimedHTLCDecodeErrorZ _res_conv = *(LDKCResult_ClaimedHTLCDecodeErrorZ*)(_res_ptr);
31526         FREE(untag_ptr(_res));
31527         CResult_ClaimedHTLCDecodeErrorZ_free(_res_conv);
31528 }
31529
31530 static inline uint64_t CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR arg) {
31531         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
31532         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone(arg);
31533         return tag_ptr(ret_conv, true);
31534 }
31535 int64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
31536         LDKCResult_ClaimedHTLCDecodeErrorZ* arg_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(arg);
31537         int64_t ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(arg_conv);
31538         return ret_conv;
31539 }
31540
31541 uint64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_clone"))) TS_CResult_ClaimedHTLCDecodeErrorZ_clone(uint64_t orig) {
31542         LDKCResult_ClaimedHTLCDecodeErrorZ* orig_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(orig);
31543         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
31544         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone(orig_conv);
31545         return tag_ptr(ret_conv, true);
31546 }
31547
31548 uint64_t  __attribute__((export_name("TS_COption_PathFailureZ_some"))) TS_COption_PathFailureZ_some(uint64_t o) {
31549         void* o_ptr = untag_ptr(o);
31550         CHECK_ACCESS(o_ptr);
31551         LDKPathFailure o_conv = *(LDKPathFailure*)(o_ptr);
31552         o_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(o));
31553         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
31554         *ret_copy = COption_PathFailureZ_some(o_conv);
31555         uint64_t ret_ref = tag_ptr(ret_copy, true);
31556         return ret_ref;
31557 }
31558
31559 uint64_t  __attribute__((export_name("TS_COption_PathFailureZ_none"))) TS_COption_PathFailureZ_none() {
31560         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
31561         *ret_copy = COption_PathFailureZ_none();
31562         uint64_t ret_ref = tag_ptr(ret_copy, true);
31563         return ret_ref;
31564 }
31565
31566 void  __attribute__((export_name("TS_COption_PathFailureZ_free"))) TS_COption_PathFailureZ_free(uint64_t _res) {
31567         if (!ptr_is_owned(_res)) return;
31568         void* _res_ptr = untag_ptr(_res);
31569         CHECK_ACCESS(_res_ptr);
31570         LDKCOption_PathFailureZ _res_conv = *(LDKCOption_PathFailureZ*)(_res_ptr);
31571         FREE(untag_ptr(_res));
31572         COption_PathFailureZ_free(_res_conv);
31573 }
31574
31575 static inline uint64_t COption_PathFailureZ_clone_ptr(LDKCOption_PathFailureZ *NONNULL_PTR arg) {
31576         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
31577         *ret_copy = COption_PathFailureZ_clone(arg);
31578         uint64_t ret_ref = tag_ptr(ret_copy, true);
31579         return ret_ref;
31580 }
31581 int64_t  __attribute__((export_name("TS_COption_PathFailureZ_clone_ptr"))) TS_COption_PathFailureZ_clone_ptr(uint64_t arg) {
31582         LDKCOption_PathFailureZ* arg_conv = (LDKCOption_PathFailureZ*)untag_ptr(arg);
31583         int64_t ret_conv = COption_PathFailureZ_clone_ptr(arg_conv);
31584         return ret_conv;
31585 }
31586
31587 uint64_t  __attribute__((export_name("TS_COption_PathFailureZ_clone"))) TS_COption_PathFailureZ_clone(uint64_t orig) {
31588         LDKCOption_PathFailureZ* orig_conv = (LDKCOption_PathFailureZ*)untag_ptr(orig);
31589         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
31590         *ret_copy = COption_PathFailureZ_clone(orig_conv);
31591         uint64_t ret_ref = tag_ptr(ret_copy, true);
31592         return ret_ref;
31593 }
31594
31595 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_ok"))) TS_CResult_COption_PathFailureZDecodeErrorZ_ok(uint64_t o) {
31596         void* o_ptr = untag_ptr(o);
31597         CHECK_ACCESS(o_ptr);
31598         LDKCOption_PathFailureZ o_conv = *(LDKCOption_PathFailureZ*)(o_ptr);
31599         o_conv = COption_PathFailureZ_clone((LDKCOption_PathFailureZ*)untag_ptr(o));
31600         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
31601         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_ok(o_conv);
31602         return tag_ptr(ret_conv, true);
31603 }
31604
31605 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_err"))) TS_CResult_COption_PathFailureZDecodeErrorZ_err(uint64_t e) {
31606         void* e_ptr = untag_ptr(e);
31607         CHECK_ACCESS(e_ptr);
31608         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31609         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31610         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
31611         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_err(e_conv);
31612         return tag_ptr(ret_conv, true);
31613 }
31614
31615 jboolean  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_is_ok"))) TS_CResult_COption_PathFailureZDecodeErrorZ_is_ok(uint64_t o) {
31616         LDKCResult_COption_PathFailureZDecodeErrorZ* o_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(o);
31617         jboolean ret_conv = CResult_COption_PathFailureZDecodeErrorZ_is_ok(o_conv);
31618         return ret_conv;
31619 }
31620
31621 void  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_free"))) TS_CResult_COption_PathFailureZDecodeErrorZ_free(uint64_t _res) {
31622         if (!ptr_is_owned(_res)) return;
31623         void* _res_ptr = untag_ptr(_res);
31624         CHECK_ACCESS(_res_ptr);
31625         LDKCResult_COption_PathFailureZDecodeErrorZ _res_conv = *(LDKCResult_COption_PathFailureZDecodeErrorZ*)(_res_ptr);
31626         FREE(untag_ptr(_res));
31627         CResult_COption_PathFailureZDecodeErrorZ_free(_res_conv);
31628 }
31629
31630 static inline uint64_t CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR arg) {
31631         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
31632         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(arg);
31633         return tag_ptr(ret_conv, true);
31634 }
31635 int64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(uint64_t arg) {
31636         LDKCResult_COption_PathFailureZDecodeErrorZ* arg_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(arg);
31637         int64_t ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(arg_conv);
31638         return ret_conv;
31639 }
31640
31641 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_clone"))) TS_CResult_COption_PathFailureZDecodeErrorZ_clone(uint64_t orig) {
31642         LDKCResult_COption_PathFailureZDecodeErrorZ* orig_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(orig);
31643         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
31644         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(orig_conv);
31645         return tag_ptr(ret_conv, true);
31646 }
31647
31648 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_some"))) TS_COption_ClosureReasonZ_some(uint64_t o) {
31649         void* o_ptr = untag_ptr(o);
31650         CHECK_ACCESS(o_ptr);
31651         LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
31652         o_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(o));
31653         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
31654         *ret_copy = COption_ClosureReasonZ_some(o_conv);
31655         uint64_t ret_ref = tag_ptr(ret_copy, true);
31656         return ret_ref;
31657 }
31658
31659 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_none"))) TS_COption_ClosureReasonZ_none() {
31660         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
31661         *ret_copy = COption_ClosureReasonZ_none();
31662         uint64_t ret_ref = tag_ptr(ret_copy, true);
31663         return ret_ref;
31664 }
31665
31666 void  __attribute__((export_name("TS_COption_ClosureReasonZ_free"))) TS_COption_ClosureReasonZ_free(uint64_t _res) {
31667         if (!ptr_is_owned(_res)) return;
31668         void* _res_ptr = untag_ptr(_res);
31669         CHECK_ACCESS(_res_ptr);
31670         LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
31671         FREE(untag_ptr(_res));
31672         COption_ClosureReasonZ_free(_res_conv);
31673 }
31674
31675 static inline uint64_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
31676         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
31677         *ret_copy = COption_ClosureReasonZ_clone(arg);
31678         uint64_t ret_ref = tag_ptr(ret_copy, true);
31679         return ret_ref;
31680 }
31681 int64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_clone_ptr"))) TS_COption_ClosureReasonZ_clone_ptr(uint64_t arg) {
31682         LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(arg);
31683         int64_t ret_conv = COption_ClosureReasonZ_clone_ptr(arg_conv);
31684         return ret_conv;
31685 }
31686
31687 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_clone"))) TS_COption_ClosureReasonZ_clone(uint64_t orig) {
31688         LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(orig);
31689         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
31690         *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
31691         uint64_t ret_ref = tag_ptr(ret_copy, true);
31692         return ret_ref;
31693 }
31694
31695 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok(uint64_t o) {
31696         void* o_ptr = untag_ptr(o);
31697         CHECK_ACCESS(o_ptr);
31698         LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
31699         o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)untag_ptr(o));
31700         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
31701         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
31702         return tag_ptr(ret_conv, true);
31703 }
31704
31705 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_err(uint64_t e) {
31706         void* e_ptr = untag_ptr(e);
31707         CHECK_ACCESS(e_ptr);
31708         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31709         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31710         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
31711         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
31712         return tag_ptr(ret_conv, true);
31713 }
31714
31715 jboolean  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(uint64_t o) {
31716         LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(o);
31717         jboolean ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
31718         return ret_conv;
31719 }
31720
31721 void  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_free"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_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_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
31726         FREE(untag_ptr(_res));
31727         CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
31728 }
31729
31730 static inline uint64_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
31731         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
31732         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
31733         return tag_ptr(ret_conv, true);
31734 }
31735 int64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(uint64_t arg) {
31736         LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(arg);
31737         int64_t ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
31738         return ret_conv;
31739 }
31740
31741 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone(uint64_t orig) {
31742         LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(orig);
31743         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
31744         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
31745         return tag_ptr(ret_conv, true);
31746 }
31747
31748 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_some"))) TS_COption_HTLCDestinationZ_some(uint64_t o) {
31749         void* o_ptr = untag_ptr(o);
31750         CHECK_ACCESS(o_ptr);
31751         LDKHTLCDestination o_conv = *(LDKHTLCDestination*)(o_ptr);
31752         o_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(o));
31753         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
31754         *ret_copy = COption_HTLCDestinationZ_some(o_conv);
31755         uint64_t ret_ref = tag_ptr(ret_copy, true);
31756         return ret_ref;
31757 }
31758
31759 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_none"))) TS_COption_HTLCDestinationZ_none() {
31760         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
31761         *ret_copy = COption_HTLCDestinationZ_none();
31762         uint64_t ret_ref = tag_ptr(ret_copy, true);
31763         return ret_ref;
31764 }
31765
31766 void  __attribute__((export_name("TS_COption_HTLCDestinationZ_free"))) TS_COption_HTLCDestinationZ_free(uint64_t _res) {
31767         if (!ptr_is_owned(_res)) return;
31768         void* _res_ptr = untag_ptr(_res);
31769         CHECK_ACCESS(_res_ptr);
31770         LDKCOption_HTLCDestinationZ _res_conv = *(LDKCOption_HTLCDestinationZ*)(_res_ptr);
31771         FREE(untag_ptr(_res));
31772         COption_HTLCDestinationZ_free(_res_conv);
31773 }
31774
31775 static inline uint64_t COption_HTLCDestinationZ_clone_ptr(LDKCOption_HTLCDestinationZ *NONNULL_PTR arg) {
31776         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
31777         *ret_copy = COption_HTLCDestinationZ_clone(arg);
31778         uint64_t ret_ref = tag_ptr(ret_copy, true);
31779         return ret_ref;
31780 }
31781 int64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_clone_ptr"))) TS_COption_HTLCDestinationZ_clone_ptr(uint64_t arg) {
31782         LDKCOption_HTLCDestinationZ* arg_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(arg);
31783         int64_t ret_conv = COption_HTLCDestinationZ_clone_ptr(arg_conv);
31784         return ret_conv;
31785 }
31786
31787 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_clone"))) TS_COption_HTLCDestinationZ_clone(uint64_t orig) {
31788         LDKCOption_HTLCDestinationZ* orig_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(orig);
31789         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
31790         *ret_copy = COption_HTLCDestinationZ_clone(orig_conv);
31791         uint64_t ret_ref = tag_ptr(ret_copy, true);
31792         return ret_ref;
31793 }
31794
31795 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_ok(uint64_t o) {
31796         void* o_ptr = untag_ptr(o);
31797         CHECK_ACCESS(o_ptr);
31798         LDKCOption_HTLCDestinationZ o_conv = *(LDKCOption_HTLCDestinationZ*)(o_ptr);
31799         o_conv = COption_HTLCDestinationZ_clone((LDKCOption_HTLCDestinationZ*)untag_ptr(o));
31800         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
31801         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o_conv);
31802         return tag_ptr(ret_conv, true);
31803 }
31804
31805 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_err"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_err(uint64_t e) {
31806         void* e_ptr = untag_ptr(e);
31807         CHECK_ACCESS(e_ptr);
31808         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31809         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31810         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
31811         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_err(e_conv);
31812         return tag_ptr(ret_conv, true);
31813 }
31814
31815 jboolean  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(uint64_t o) {
31816         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* o_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(o);
31817         jboolean ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o_conv);
31818         return ret_conv;
31819 }
31820
31821 void  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_free"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_free(uint64_t _res) {
31822         if (!ptr_is_owned(_res)) return;
31823         void* _res_ptr = untag_ptr(_res);
31824         CHECK_ACCESS(_res_ptr);
31825         LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res_conv = *(LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(_res_ptr);
31826         FREE(untag_ptr(_res));
31827         CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res_conv);
31828 }
31829
31830 static inline uint64_t CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR arg) {
31831         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
31832         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(arg);
31833         return tag_ptr(ret_conv, true);
31834 }
31835 int64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(uint64_t arg) {
31836         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* arg_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(arg);
31837         int64_t ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(arg_conv);
31838         return ret_conv;
31839 }
31840
31841 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone(uint64_t orig) {
31842         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* orig_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(orig);
31843         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
31844         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig_conv);
31845         return tag_ptr(ret_conv, true);
31846 }
31847
31848 uint64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_ok"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_ok(uint32_t o) {
31849         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_js(o);
31850         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
31851         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_ok(o_conv);
31852         return tag_ptr(ret_conv, true);
31853 }
31854
31855 uint64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_err"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_err(uint64_t e) {
31856         void* e_ptr = untag_ptr(e);
31857         CHECK_ACCESS(e_ptr);
31858         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31859         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31860         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
31861         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_err(e_conv);
31862         return tag_ptr(ret_conv, true);
31863 }
31864
31865 jboolean  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_is_ok"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_is_ok(uint64_t o) {
31866         LDKCResult_PaymentFailureReasonDecodeErrorZ* o_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(o);
31867         jboolean ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_is_ok(o_conv);
31868         return ret_conv;
31869 }
31870
31871 void  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_free"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_free(uint64_t _res) {
31872         if (!ptr_is_owned(_res)) return;
31873         void* _res_ptr = untag_ptr(_res);
31874         CHECK_ACCESS(_res_ptr);
31875         LDKCResult_PaymentFailureReasonDecodeErrorZ _res_conv = *(LDKCResult_PaymentFailureReasonDecodeErrorZ*)(_res_ptr);
31876         FREE(untag_ptr(_res));
31877         CResult_PaymentFailureReasonDecodeErrorZ_free(_res_conv);
31878 }
31879
31880 static inline uint64_t CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR arg) {
31881         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
31882         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(arg);
31883         return tag_ptr(ret_conv, true);
31884 }
31885 int64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(uint64_t arg) {
31886         LDKCResult_PaymentFailureReasonDecodeErrorZ* arg_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(arg);
31887         int64_t ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(arg_conv);
31888         return ret_conv;
31889 }
31890
31891 uint64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_clone"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_clone(uint64_t orig) {
31892         LDKCResult_PaymentFailureReasonDecodeErrorZ* orig_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(orig);
31893         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
31894         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(orig_conv);
31895         return tag_ptr(ret_conv, true);
31896 }
31897
31898 uint64_t  __attribute__((export_name("TS_COption_U128Z_some"))) TS_COption_U128Z_some(int8_tArray o) {
31899         LDKU128 o_ref;
31900         CHECK(o->arr_len == 16);
31901         memcpy(o_ref.le_bytes, o->elems, 16); FREE(o);
31902         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
31903         *ret_copy = COption_U128Z_some(o_ref);
31904         uint64_t ret_ref = tag_ptr(ret_copy, true);
31905         return ret_ref;
31906 }
31907
31908 uint64_t  __attribute__((export_name("TS_COption_U128Z_none"))) TS_COption_U128Z_none() {
31909         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
31910         *ret_copy = COption_U128Z_none();
31911         uint64_t ret_ref = tag_ptr(ret_copy, true);
31912         return ret_ref;
31913 }
31914
31915 void  __attribute__((export_name("TS_COption_U128Z_free"))) TS_COption_U128Z_free(uint64_t _res) {
31916         if (!ptr_is_owned(_res)) return;
31917         void* _res_ptr = untag_ptr(_res);
31918         CHECK_ACCESS(_res_ptr);
31919         LDKCOption_U128Z _res_conv = *(LDKCOption_U128Z*)(_res_ptr);
31920         FREE(untag_ptr(_res));
31921         COption_U128Z_free(_res_conv);
31922 }
31923
31924 static inline uint64_t COption_U128Z_clone_ptr(LDKCOption_U128Z *NONNULL_PTR arg) {
31925         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
31926         *ret_copy = COption_U128Z_clone(arg);
31927         uint64_t ret_ref = tag_ptr(ret_copy, true);
31928         return ret_ref;
31929 }
31930 int64_t  __attribute__((export_name("TS_COption_U128Z_clone_ptr"))) TS_COption_U128Z_clone_ptr(uint64_t arg) {
31931         LDKCOption_U128Z* arg_conv = (LDKCOption_U128Z*)untag_ptr(arg);
31932         int64_t ret_conv = COption_U128Z_clone_ptr(arg_conv);
31933         return ret_conv;
31934 }
31935
31936 uint64_t  __attribute__((export_name("TS_COption_U128Z_clone"))) TS_COption_U128Z_clone(uint64_t orig) {
31937         LDKCOption_U128Z* orig_conv = (LDKCOption_U128Z*)untag_ptr(orig);
31938         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
31939         *ret_copy = COption_U128Z_clone(orig_conv);
31940         uint64_t ret_ref = tag_ptr(ret_copy, true);
31941         return ret_ref;
31942 }
31943
31944 void  __attribute__((export_name("TS_CVec_ClaimedHTLCZ_free"))) TS_CVec_ClaimedHTLCZ_free(uint64_tArray _res) {
31945         LDKCVec_ClaimedHTLCZ _res_constr;
31946         _res_constr.datalen = _res->arr_len;
31947         if (_res_constr.datalen > 0)
31948                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKClaimedHTLC), "LDKCVec_ClaimedHTLCZ Elements");
31949         else
31950                 _res_constr.data = NULL;
31951         uint64_t* _res_vals = _res->elems;
31952         for (size_t n = 0; n < _res_constr.datalen; n++) {
31953                 uint64_t _res_conv_13 = _res_vals[n];
31954                 LDKClaimedHTLC _res_conv_13_conv;
31955                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
31956                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
31957                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
31958                 _res_constr.data[n] = _res_conv_13_conv;
31959         }
31960         FREE(_res);
31961         CVec_ClaimedHTLCZ_free(_res_constr);
31962 }
31963
31964 uint64_t  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_some"))) TS_COption_PaymentFailureReasonZ_some(uint32_t o) {
31965         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_js(o);
31966         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
31967         *ret_copy = COption_PaymentFailureReasonZ_some(o_conv);
31968         uint64_t ret_ref = tag_ptr(ret_copy, true);
31969         return ret_ref;
31970 }
31971
31972 uint64_t  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_none"))) TS_COption_PaymentFailureReasonZ_none() {
31973         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
31974         *ret_copy = COption_PaymentFailureReasonZ_none();
31975         uint64_t ret_ref = tag_ptr(ret_copy, true);
31976         return ret_ref;
31977 }
31978
31979 void  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_free"))) TS_COption_PaymentFailureReasonZ_free(uint64_t _res) {
31980         if (!ptr_is_owned(_res)) return;
31981         void* _res_ptr = untag_ptr(_res);
31982         CHECK_ACCESS(_res_ptr);
31983         LDKCOption_PaymentFailureReasonZ _res_conv = *(LDKCOption_PaymentFailureReasonZ*)(_res_ptr);
31984         FREE(untag_ptr(_res));
31985         COption_PaymentFailureReasonZ_free(_res_conv);
31986 }
31987
31988 static inline uint64_t COption_PaymentFailureReasonZ_clone_ptr(LDKCOption_PaymentFailureReasonZ *NONNULL_PTR arg) {
31989         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
31990         *ret_copy = COption_PaymentFailureReasonZ_clone(arg);
31991         uint64_t ret_ref = tag_ptr(ret_copy, true);
31992         return ret_ref;
31993 }
31994 int64_t  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_clone_ptr"))) TS_COption_PaymentFailureReasonZ_clone_ptr(uint64_t arg) {
31995         LDKCOption_PaymentFailureReasonZ* arg_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(arg);
31996         int64_t ret_conv = COption_PaymentFailureReasonZ_clone_ptr(arg_conv);
31997         return ret_conv;
31998 }
31999
32000 uint64_t  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_clone"))) TS_COption_PaymentFailureReasonZ_clone(uint64_t orig) {
32001         LDKCOption_PaymentFailureReasonZ* orig_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(orig);
32002         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
32003         *ret_copy = COption_PaymentFailureReasonZ_clone(orig_conv);
32004         uint64_t ret_ref = tag_ptr(ret_copy, true);
32005         return ret_ref;
32006 }
32007
32008 uint64_t  __attribute__((export_name("TS_COption_EventZ_some"))) TS_COption_EventZ_some(uint64_t o) {
32009         void* o_ptr = untag_ptr(o);
32010         CHECK_ACCESS(o_ptr);
32011         LDKEvent o_conv = *(LDKEvent*)(o_ptr);
32012         o_conv = Event_clone((LDKEvent*)untag_ptr(o));
32013         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
32014         *ret_copy = COption_EventZ_some(o_conv);
32015         uint64_t ret_ref = tag_ptr(ret_copy, true);
32016         return ret_ref;
32017 }
32018
32019 uint64_t  __attribute__((export_name("TS_COption_EventZ_none"))) TS_COption_EventZ_none() {
32020         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
32021         *ret_copy = COption_EventZ_none();
32022         uint64_t ret_ref = tag_ptr(ret_copy, true);
32023         return ret_ref;
32024 }
32025
32026 void  __attribute__((export_name("TS_COption_EventZ_free"))) TS_COption_EventZ_free(uint64_t _res) {
32027         if (!ptr_is_owned(_res)) return;
32028         void* _res_ptr = untag_ptr(_res);
32029         CHECK_ACCESS(_res_ptr);
32030         LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
32031         FREE(untag_ptr(_res));
32032         COption_EventZ_free(_res_conv);
32033 }
32034
32035 static inline uint64_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
32036         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
32037         *ret_copy = COption_EventZ_clone(arg);
32038         uint64_t ret_ref = tag_ptr(ret_copy, true);
32039         return ret_ref;
32040 }
32041 int64_t  __attribute__((export_name("TS_COption_EventZ_clone_ptr"))) TS_COption_EventZ_clone_ptr(uint64_t arg) {
32042         LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)untag_ptr(arg);
32043         int64_t ret_conv = COption_EventZ_clone_ptr(arg_conv);
32044         return ret_conv;
32045 }
32046
32047 uint64_t  __attribute__((export_name("TS_COption_EventZ_clone"))) TS_COption_EventZ_clone(uint64_t orig) {
32048         LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)untag_ptr(orig);
32049         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
32050         *ret_copy = COption_EventZ_clone(orig_conv);
32051         uint64_t ret_ref = tag_ptr(ret_copy, true);
32052         return ret_ref;
32053 }
32054
32055 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_ok"))) TS_CResult_COption_EventZDecodeErrorZ_ok(uint64_t o) {
32056         void* o_ptr = untag_ptr(o);
32057         CHECK_ACCESS(o_ptr);
32058         LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
32059         o_conv = COption_EventZ_clone((LDKCOption_EventZ*)untag_ptr(o));
32060         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
32061         *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
32062         return tag_ptr(ret_conv, true);
32063 }
32064
32065 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_err"))) TS_CResult_COption_EventZDecodeErrorZ_err(uint64_t e) {
32066         void* e_ptr = untag_ptr(e);
32067         CHECK_ACCESS(e_ptr);
32068         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32069         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32070         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
32071         *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
32072         return tag_ptr(ret_conv, true);
32073 }
32074
32075 jboolean  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_is_ok"))) TS_CResult_COption_EventZDecodeErrorZ_is_ok(uint64_t o) {
32076         LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(o);
32077         jboolean ret_conv = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
32078         return ret_conv;
32079 }
32080
32081 void  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_free"))) TS_CResult_COption_EventZDecodeErrorZ_free(uint64_t _res) {
32082         if (!ptr_is_owned(_res)) return;
32083         void* _res_ptr = untag_ptr(_res);
32084         CHECK_ACCESS(_res_ptr);
32085         LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
32086         FREE(untag_ptr(_res));
32087         CResult_COption_EventZDecodeErrorZ_free(_res_conv);
32088 }
32089
32090 static inline uint64_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
32091         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
32092         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
32093         return tag_ptr(ret_conv, true);
32094 }
32095 int64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_EventZDecodeErrorZ_clone_ptr(uint64_t arg) {
32096         LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(arg);
32097         int64_t ret_conv = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
32098         return ret_conv;
32099 }
32100
32101 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone"))) TS_CResult_COption_EventZDecodeErrorZ_clone(uint64_t orig) {
32102         LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(orig);
32103         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
32104         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
32105         return tag_ptr(ret_conv, true);
32106 }
32107
32108 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_ok"))) TS_CResult_SiPrefixBolt11ParseErrorZ_ok(uint32_t o) {
32109         LDKSiPrefix o_conv = LDKSiPrefix_from_js(o);
32110         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
32111         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_ok(o_conv);
32112         return tag_ptr(ret_conv, true);
32113 }
32114
32115 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_err"))) TS_CResult_SiPrefixBolt11ParseErrorZ_err(uint64_t e) {
32116         void* e_ptr = untag_ptr(e);
32117         CHECK_ACCESS(e_ptr);
32118         LDKBolt11ParseError e_conv = *(LDKBolt11ParseError*)(e_ptr);
32119         e_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(e));
32120         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
32121         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_err(e_conv);
32122         return tag_ptr(ret_conv, true);
32123 }
32124
32125 jboolean  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_is_ok"))) TS_CResult_SiPrefixBolt11ParseErrorZ_is_ok(uint64_t o) {
32126         LDKCResult_SiPrefixBolt11ParseErrorZ* o_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(o);
32127         jboolean ret_conv = CResult_SiPrefixBolt11ParseErrorZ_is_ok(o_conv);
32128         return ret_conv;
32129 }
32130
32131 void  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_free"))) TS_CResult_SiPrefixBolt11ParseErrorZ_free(uint64_t _res) {
32132         if (!ptr_is_owned(_res)) return;
32133         void* _res_ptr = untag_ptr(_res);
32134         CHECK_ACCESS(_res_ptr);
32135         LDKCResult_SiPrefixBolt11ParseErrorZ _res_conv = *(LDKCResult_SiPrefixBolt11ParseErrorZ*)(_res_ptr);
32136         FREE(untag_ptr(_res));
32137         CResult_SiPrefixBolt11ParseErrorZ_free(_res_conv);
32138 }
32139
32140 static inline uint64_t CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR arg) {
32141         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
32142         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone(arg);
32143         return tag_ptr(ret_conv, true);
32144 }
32145 int64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_clone_ptr"))) TS_CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(uint64_t arg) {
32146         LDKCResult_SiPrefixBolt11ParseErrorZ* arg_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(arg);
32147         int64_t ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(arg_conv);
32148         return ret_conv;
32149 }
32150
32151 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_clone"))) TS_CResult_SiPrefixBolt11ParseErrorZ_clone(uint64_t orig) {
32152         LDKCResult_SiPrefixBolt11ParseErrorZ* orig_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(orig);
32153         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
32154         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone(orig_conv);
32155         return tag_ptr(ret_conv, true);
32156 }
32157
32158 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(uint64_t o) {
32159         LDKBolt11Invoice o_conv;
32160         o_conv.inner = untag_ptr(o);
32161         o_conv.is_owned = ptr_is_owned(o);
32162         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32163         o_conv = Bolt11Invoice_clone(&o_conv);
32164         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
32165         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(o_conv);
32166         return tag_ptr(ret_conv, true);
32167 }
32168
32169 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_err"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(uint64_t e) {
32170         void* e_ptr = untag_ptr(e);
32171         CHECK_ACCESS(e_ptr);
32172         LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
32173         e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)untag_ptr(e));
32174         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
32175         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(e_conv);
32176         return tag_ptr(ret_conv, true);
32177 }
32178
32179 jboolean  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(uint64_t o) {
32180         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(o);
32181         jboolean ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
32182         return ret_conv;
32183 }
32184
32185 void  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_free"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(uint64_t _res) {
32186         if (!ptr_is_owned(_res)) return;
32187         void* _res_ptr = untag_ptr(_res);
32188         CHECK_ACCESS(_res_ptr);
32189         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)(_res_ptr);
32190         FREE(untag_ptr(_res));
32191         CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(_res_conv);
32192 }
32193
32194 static inline uint64_t CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
32195         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
32196         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(arg);
32197         return tag_ptr(ret_conv, true);
32198 }
32199 int64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(uint64_t arg) {
32200         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(arg);
32201         int64_t ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
32202         return ret_conv;
32203 }
32204
32205 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(uint64_t orig) {
32206         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(orig);
32207         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
32208         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(orig_conv);
32209         return tag_ptr(ret_conv, true);
32210 }
32211
32212 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(uint64_t o) {
32213         LDKSignedRawBolt11Invoice o_conv;
32214         o_conv.inner = untag_ptr(o);
32215         o_conv.is_owned = ptr_is_owned(o);
32216         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32217         o_conv = SignedRawBolt11Invoice_clone(&o_conv);
32218         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
32219         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(o_conv);
32220         return tag_ptr(ret_conv, true);
32221 }
32222
32223 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(uint64_t e) {
32224         void* e_ptr = untag_ptr(e);
32225         CHECK_ACCESS(e_ptr);
32226         LDKBolt11ParseError e_conv = *(LDKBolt11ParseError*)(e_ptr);
32227         e_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(e));
32228         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
32229         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(e_conv);
32230         return tag_ptr(ret_conv, true);
32231 }
32232
32233 jboolean  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(uint64_t o) {
32234         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* o_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(o);
32235         jboolean ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(o_conv);
32236         return ret_conv;
32237 }
32238
32239 void  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(uint64_t _res) {
32240         if (!ptr_is_owned(_res)) return;
32241         void* _res_ptr = untag_ptr(_res);
32242         CHECK_ACCESS(_res_ptr);
32243         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ _res_conv = *(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)(_res_ptr);
32244         FREE(untag_ptr(_res));
32245         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(_res_conv);
32246 }
32247
32248 static inline uint64_t CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR arg) {
32249         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
32250         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(arg);
32251         return tag_ptr(ret_conv, true);
32252 }
32253 int64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(uint64_t arg) {
32254         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* arg_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(arg);
32255         int64_t ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(arg_conv);
32256         return ret_conv;
32257 }
32258
32259 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(uint64_t orig) {
32260         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* orig_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(orig);
32261         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
32262         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(orig_conv);
32263         return tag_ptr(ret_conv, true);
32264 }
32265
32266 static inline uint64_t C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR arg) {
32267         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
32268         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(arg);
32269         return tag_ptr(ret_conv, true);
32270 }
32271 int64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(uint64_t arg) {
32272         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(arg);
32273         int64_t ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(arg_conv);
32274         return ret_conv;
32275 }
32276
32277 uint64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(uint64_t orig) {
32278         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(orig);
32279         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
32280         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(orig_conv);
32281         return tag_ptr(ret_conv, true);
32282 }
32283
32284 uint64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(uint64_t a, int8_tArray b, uint64_t c) {
32285         LDKRawBolt11Invoice a_conv;
32286         a_conv.inner = untag_ptr(a);
32287         a_conv.is_owned = ptr_is_owned(a);
32288         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32289         a_conv = RawBolt11Invoice_clone(&a_conv);
32290         LDKThirtyTwoBytes b_ref;
32291         CHECK(b->arr_len == 32);
32292         memcpy(b_ref.data, b->elems, 32); FREE(b);
32293         LDKBolt11InvoiceSignature c_conv;
32294         c_conv.inner = untag_ptr(c);
32295         c_conv.is_owned = ptr_is_owned(c);
32296         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
32297         c_conv = Bolt11InvoiceSignature_clone(&c_conv);
32298         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
32299         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
32300         return tag_ptr(ret_conv, true);
32301 }
32302
32303 void  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(uint64_t _res) {
32304         if (!ptr_is_owned(_res)) return;
32305         void* _res_ptr = untag_ptr(_res);
32306         CHECK_ACCESS(_res_ptr);
32307         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)(_res_ptr);
32308         FREE(untag_ptr(_res));
32309         C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(_res_conv);
32310 }
32311
32312 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_ok"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_ok(uint64_t o) {
32313         LDKPayeePubKey o_conv;
32314         o_conv.inner = untag_ptr(o);
32315         o_conv.is_owned = ptr_is_owned(o);
32316         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32317         o_conv = PayeePubKey_clone(&o_conv);
32318         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
32319         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_ok(o_conv);
32320         return tag_ptr(ret_conv, true);
32321 }
32322
32323 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_err"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_err(uint32_t e) {
32324         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
32325         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
32326         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_err(e_conv);
32327         return tag_ptr(ret_conv, true);
32328 }
32329
32330 jboolean  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_is_ok"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_is_ok(uint64_t o) {
32331         LDKCResult_PayeePubKeySecp256k1ErrorZ* o_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(o);
32332         jboolean ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_is_ok(o_conv);
32333         return ret_conv;
32334 }
32335
32336 void  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_free"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_free(uint64_t _res) {
32337         if (!ptr_is_owned(_res)) return;
32338         void* _res_ptr = untag_ptr(_res);
32339         CHECK_ACCESS(_res_ptr);
32340         LDKCResult_PayeePubKeySecp256k1ErrorZ _res_conv = *(LDKCResult_PayeePubKeySecp256k1ErrorZ*)(_res_ptr);
32341         FREE(untag_ptr(_res));
32342         CResult_PayeePubKeySecp256k1ErrorZ_free(_res_conv);
32343 }
32344
32345 static inline uint64_t CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR arg) {
32346         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
32347         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone(arg);
32348         return tag_ptr(ret_conv, true);
32349 }
32350 int64_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(uint64_t arg) {
32351         LDKCResult_PayeePubKeySecp256k1ErrorZ* arg_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(arg);
32352         int64_t ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(arg_conv);
32353         return ret_conv;
32354 }
32355
32356 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_clone"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_clone(uint64_t orig) {
32357         LDKCResult_PayeePubKeySecp256k1ErrorZ* orig_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(orig);
32358         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
32359         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone(orig_conv);
32360         return tag_ptr(ret_conv, true);
32361 }
32362
32363 void  __attribute__((export_name("TS_CVec_PrivateRouteZ_free"))) TS_CVec_PrivateRouteZ_free(uint64_tArray _res) {
32364         LDKCVec_PrivateRouteZ _res_constr;
32365         _res_constr.datalen = _res->arr_len;
32366         if (_res_constr.datalen > 0)
32367                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
32368         else
32369                 _res_constr.data = NULL;
32370         uint64_t* _res_vals = _res->elems;
32371         for (size_t o = 0; o < _res_constr.datalen; o++) {
32372                 uint64_t _res_conv_14 = _res_vals[o];
32373                 LDKPrivateRoute _res_conv_14_conv;
32374                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
32375                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
32376                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
32377                 _res_constr.data[o] = _res_conv_14_conv;
32378         }
32379         FREE(_res);
32380         CVec_PrivateRouteZ_free(_res_constr);
32381 }
32382
32383 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_ok(uint64_t o) {
32384         LDKPositiveTimestamp o_conv;
32385         o_conv.inner = untag_ptr(o);
32386         o_conv.is_owned = ptr_is_owned(o);
32387         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32388         o_conv = PositiveTimestamp_clone(&o_conv);
32389         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
32390         *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
32391         return tag_ptr(ret_conv, true);
32392 }
32393
32394 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_err"))) TS_CResult_PositiveTimestampCreationErrorZ_err(uint32_t e) {
32395         LDKCreationError e_conv = LDKCreationError_from_js(e);
32396         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
32397         *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
32398         return tag_ptr(ret_conv, true);
32399 }
32400
32401 jboolean  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_is_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_is_ok(uint64_t o) {
32402         LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(o);
32403         jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
32404         return ret_conv;
32405 }
32406
32407 void  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_free"))) TS_CResult_PositiveTimestampCreationErrorZ_free(uint64_t _res) {
32408         if (!ptr_is_owned(_res)) return;
32409         void* _res_ptr = untag_ptr(_res);
32410         CHECK_ACCESS(_res_ptr);
32411         LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
32412         FREE(untag_ptr(_res));
32413         CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
32414 }
32415
32416 static inline uint64_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
32417         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
32418         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
32419         return tag_ptr(ret_conv, true);
32420 }
32421 int64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr"))) TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr(uint64_t arg) {
32422         LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(arg);
32423         int64_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
32424         return ret_conv;
32425 }
32426
32427 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone"))) TS_CResult_PositiveTimestampCreationErrorZ_clone(uint64_t orig) {
32428         LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(orig);
32429         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
32430         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
32431         return tag_ptr(ret_conv, true);
32432 }
32433
32434 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_ok"))) TS_CResult_NoneBolt11SemanticErrorZ_ok() {
32435         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
32436         *ret_conv = CResult_NoneBolt11SemanticErrorZ_ok();
32437         return tag_ptr(ret_conv, true);
32438 }
32439
32440 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_err"))) TS_CResult_NoneBolt11SemanticErrorZ_err(uint32_t e) {
32441         LDKBolt11SemanticError e_conv = LDKBolt11SemanticError_from_js(e);
32442         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
32443         *ret_conv = CResult_NoneBolt11SemanticErrorZ_err(e_conv);
32444         return tag_ptr(ret_conv, true);
32445 }
32446
32447 jboolean  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_is_ok"))) TS_CResult_NoneBolt11SemanticErrorZ_is_ok(uint64_t o) {
32448         LDKCResult_NoneBolt11SemanticErrorZ* o_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(o);
32449         jboolean ret_conv = CResult_NoneBolt11SemanticErrorZ_is_ok(o_conv);
32450         return ret_conv;
32451 }
32452
32453 void  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_free"))) TS_CResult_NoneBolt11SemanticErrorZ_free(uint64_t _res) {
32454         if (!ptr_is_owned(_res)) return;
32455         void* _res_ptr = untag_ptr(_res);
32456         CHECK_ACCESS(_res_ptr);
32457         LDKCResult_NoneBolt11SemanticErrorZ _res_conv = *(LDKCResult_NoneBolt11SemanticErrorZ*)(_res_ptr);
32458         FREE(untag_ptr(_res));
32459         CResult_NoneBolt11SemanticErrorZ_free(_res_conv);
32460 }
32461
32462 static inline uint64_t CResult_NoneBolt11SemanticErrorZ_clone_ptr(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR arg) {
32463         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
32464         *ret_conv = CResult_NoneBolt11SemanticErrorZ_clone(arg);
32465         return tag_ptr(ret_conv, true);
32466 }
32467 int64_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_clone_ptr"))) TS_CResult_NoneBolt11SemanticErrorZ_clone_ptr(uint64_t arg) {
32468         LDKCResult_NoneBolt11SemanticErrorZ* arg_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(arg);
32469         int64_t ret_conv = CResult_NoneBolt11SemanticErrorZ_clone_ptr(arg_conv);
32470         return ret_conv;
32471 }
32472
32473 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_clone"))) TS_CResult_NoneBolt11SemanticErrorZ_clone(uint64_t orig) {
32474         LDKCResult_NoneBolt11SemanticErrorZ* orig_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(orig);
32475         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
32476         *ret_conv = CResult_NoneBolt11SemanticErrorZ_clone(orig_conv);
32477         return tag_ptr(ret_conv, true);
32478 }
32479
32480 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(uint64_t o) {
32481         LDKBolt11Invoice o_conv;
32482         o_conv.inner = untag_ptr(o);
32483         o_conv.is_owned = ptr_is_owned(o);
32484         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32485         o_conv = Bolt11Invoice_clone(&o_conv);
32486         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
32487         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(o_conv);
32488         return tag_ptr(ret_conv, true);
32489 }
32490
32491 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_err"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(uint32_t e) {
32492         LDKBolt11SemanticError e_conv = LDKBolt11SemanticError_from_js(e);
32493         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
32494         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(e_conv);
32495         return tag_ptr(ret_conv, true);
32496 }
32497
32498 jboolean  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(uint64_t o) {
32499         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* o_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(o);
32500         jboolean ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(o_conv);
32501         return ret_conv;
32502 }
32503
32504 void  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_free"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(uint64_t _res) {
32505         if (!ptr_is_owned(_res)) return;
32506         void* _res_ptr = untag_ptr(_res);
32507         CHECK_ACCESS(_res_ptr);
32508         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)(_res_ptr);
32509         FREE(untag_ptr(_res));
32510         CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(_res_conv);
32511 }
32512
32513 static inline uint64_t CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR arg) {
32514         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
32515         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(arg);
32516         return tag_ptr(ret_conv, true);
32517 }
32518 int64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(uint64_t arg) {
32519         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(arg);
32520         int64_t ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(arg_conv);
32521         return ret_conv;
32522 }
32523
32524 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(uint64_t orig) {
32525         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(orig);
32526         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
32527         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(orig_conv);
32528         return tag_ptr(ret_conv, true);
32529 }
32530
32531 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_ok"))) TS_CResult_DescriptionCreationErrorZ_ok(uint64_t o) {
32532         LDKDescription o_conv;
32533         o_conv.inner = untag_ptr(o);
32534         o_conv.is_owned = ptr_is_owned(o);
32535         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32536         o_conv = Description_clone(&o_conv);
32537         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
32538         *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
32539         return tag_ptr(ret_conv, true);
32540 }
32541
32542 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_err"))) TS_CResult_DescriptionCreationErrorZ_err(uint32_t e) {
32543         LDKCreationError e_conv = LDKCreationError_from_js(e);
32544         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
32545         *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
32546         return tag_ptr(ret_conv, true);
32547 }
32548
32549 jboolean  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_is_ok"))) TS_CResult_DescriptionCreationErrorZ_is_ok(uint64_t o) {
32550         LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(o);
32551         jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
32552         return ret_conv;
32553 }
32554
32555 void  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_free"))) TS_CResult_DescriptionCreationErrorZ_free(uint64_t _res) {
32556         if (!ptr_is_owned(_res)) return;
32557         void* _res_ptr = untag_ptr(_res);
32558         CHECK_ACCESS(_res_ptr);
32559         LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
32560         FREE(untag_ptr(_res));
32561         CResult_DescriptionCreationErrorZ_free(_res_conv);
32562 }
32563
32564 static inline uint64_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
32565         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
32566         *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
32567         return tag_ptr(ret_conv, true);
32568 }
32569 int64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone_ptr"))) TS_CResult_DescriptionCreationErrorZ_clone_ptr(uint64_t arg) {
32570         LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(arg);
32571         int64_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
32572         return ret_conv;
32573 }
32574
32575 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone"))) TS_CResult_DescriptionCreationErrorZ_clone(uint64_t orig) {
32576         LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(orig);
32577         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
32578         *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
32579         return tag_ptr(ret_conv, true);
32580 }
32581
32582 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_ok"))) TS_CResult_PrivateRouteCreationErrorZ_ok(uint64_t o) {
32583         LDKPrivateRoute o_conv;
32584         o_conv.inner = untag_ptr(o);
32585         o_conv.is_owned = ptr_is_owned(o);
32586         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32587         o_conv = PrivateRoute_clone(&o_conv);
32588         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
32589         *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
32590         return tag_ptr(ret_conv, true);
32591 }
32592
32593 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_err"))) TS_CResult_PrivateRouteCreationErrorZ_err(uint32_t e) {
32594         LDKCreationError e_conv = LDKCreationError_from_js(e);
32595         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
32596         *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
32597         return tag_ptr(ret_conv, true);
32598 }
32599
32600 jboolean  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_is_ok"))) TS_CResult_PrivateRouteCreationErrorZ_is_ok(uint64_t o) {
32601         LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(o);
32602         jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
32603         return ret_conv;
32604 }
32605
32606 void  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_free"))) TS_CResult_PrivateRouteCreationErrorZ_free(uint64_t _res) {
32607         if (!ptr_is_owned(_res)) return;
32608         void* _res_ptr = untag_ptr(_res);
32609         CHECK_ACCESS(_res_ptr);
32610         LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
32611         FREE(untag_ptr(_res));
32612         CResult_PrivateRouteCreationErrorZ_free(_res_conv);
32613 }
32614
32615 static inline uint64_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
32616         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
32617         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
32618         return tag_ptr(ret_conv, true);
32619 }
32620 int64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone_ptr"))) TS_CResult_PrivateRouteCreationErrorZ_clone_ptr(uint64_t arg) {
32621         LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(arg);
32622         int64_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
32623         return ret_conv;
32624 }
32625
32626 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone"))) TS_CResult_PrivateRouteCreationErrorZ_clone(uint64_t orig) {
32627         LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(orig);
32628         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
32629         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
32630         return tag_ptr(ret_conv, true);
32631 }
32632
32633 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_ok"))) TS_CResult_OutPointDecodeErrorZ_ok(uint64_t o) {
32634         LDKOutPoint o_conv;
32635         o_conv.inner = untag_ptr(o);
32636         o_conv.is_owned = ptr_is_owned(o);
32637         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32638         o_conv = OutPoint_clone(&o_conv);
32639         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
32640         *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
32641         return tag_ptr(ret_conv, true);
32642 }
32643
32644 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_err"))) TS_CResult_OutPointDecodeErrorZ_err(uint64_t e) {
32645         void* e_ptr = untag_ptr(e);
32646         CHECK_ACCESS(e_ptr);
32647         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32648         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32649         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
32650         *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
32651         return tag_ptr(ret_conv, true);
32652 }
32653
32654 jboolean  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_is_ok"))) TS_CResult_OutPointDecodeErrorZ_is_ok(uint64_t o) {
32655         LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(o);
32656         jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
32657         return ret_conv;
32658 }
32659
32660 void  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_free"))) TS_CResult_OutPointDecodeErrorZ_free(uint64_t _res) {
32661         if (!ptr_is_owned(_res)) return;
32662         void* _res_ptr = untag_ptr(_res);
32663         CHECK_ACCESS(_res_ptr);
32664         LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
32665         FREE(untag_ptr(_res));
32666         CResult_OutPointDecodeErrorZ_free(_res_conv);
32667 }
32668
32669 static inline uint64_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
32670         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
32671         *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
32672         return tag_ptr(ret_conv, true);
32673 }
32674 int64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone_ptr"))) TS_CResult_OutPointDecodeErrorZ_clone_ptr(uint64_t arg) {
32675         LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(arg);
32676         int64_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
32677         return ret_conv;
32678 }
32679
32680 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone"))) TS_CResult_OutPointDecodeErrorZ_clone(uint64_t orig) {
32681         LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(orig);
32682         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
32683         *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
32684         return tag_ptr(ret_conv, true);
32685 }
32686
32687 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_ok"))) TS_CResult_BigSizeDecodeErrorZ_ok(uint64_t o) {
32688         LDKBigSize o_conv;
32689         o_conv.inner = untag_ptr(o);
32690         o_conv.is_owned = ptr_is_owned(o);
32691         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32692         o_conv = BigSize_clone(&o_conv);
32693         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
32694         *ret_conv = CResult_BigSizeDecodeErrorZ_ok(o_conv);
32695         return tag_ptr(ret_conv, true);
32696 }
32697
32698 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_err"))) TS_CResult_BigSizeDecodeErrorZ_err(uint64_t e) {
32699         void* e_ptr = untag_ptr(e);
32700         CHECK_ACCESS(e_ptr);
32701         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32702         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32703         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
32704         *ret_conv = CResult_BigSizeDecodeErrorZ_err(e_conv);
32705         return tag_ptr(ret_conv, true);
32706 }
32707
32708 jboolean  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_is_ok"))) TS_CResult_BigSizeDecodeErrorZ_is_ok(uint64_t o) {
32709         LDKCResult_BigSizeDecodeErrorZ* o_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(o);
32710         jboolean ret_conv = CResult_BigSizeDecodeErrorZ_is_ok(o_conv);
32711         return ret_conv;
32712 }
32713
32714 void  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_free"))) TS_CResult_BigSizeDecodeErrorZ_free(uint64_t _res) {
32715         if (!ptr_is_owned(_res)) return;
32716         void* _res_ptr = untag_ptr(_res);
32717         CHECK_ACCESS(_res_ptr);
32718         LDKCResult_BigSizeDecodeErrorZ _res_conv = *(LDKCResult_BigSizeDecodeErrorZ*)(_res_ptr);
32719         FREE(untag_ptr(_res));
32720         CResult_BigSizeDecodeErrorZ_free(_res_conv);
32721 }
32722
32723 static inline uint64_t CResult_BigSizeDecodeErrorZ_clone_ptr(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR arg) {
32724         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
32725         *ret_conv = CResult_BigSizeDecodeErrorZ_clone(arg);
32726         return tag_ptr(ret_conv, true);
32727 }
32728 int64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_clone_ptr"))) TS_CResult_BigSizeDecodeErrorZ_clone_ptr(uint64_t arg) {
32729         LDKCResult_BigSizeDecodeErrorZ* arg_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(arg);
32730         int64_t ret_conv = CResult_BigSizeDecodeErrorZ_clone_ptr(arg_conv);
32731         return ret_conv;
32732 }
32733
32734 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_clone"))) TS_CResult_BigSizeDecodeErrorZ_clone(uint64_t orig) {
32735         LDKCResult_BigSizeDecodeErrorZ* orig_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(orig);
32736         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
32737         *ret_conv = CResult_BigSizeDecodeErrorZ_clone(orig_conv);
32738         return tag_ptr(ret_conv, true);
32739 }
32740
32741 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_ok"))) TS_CResult_HostnameDecodeErrorZ_ok(uint64_t o) {
32742         LDKHostname o_conv;
32743         o_conv.inner = untag_ptr(o);
32744         o_conv.is_owned = ptr_is_owned(o);
32745         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32746         o_conv = Hostname_clone(&o_conv);
32747         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
32748         *ret_conv = CResult_HostnameDecodeErrorZ_ok(o_conv);
32749         return tag_ptr(ret_conv, true);
32750 }
32751
32752 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_err"))) TS_CResult_HostnameDecodeErrorZ_err(uint64_t e) {
32753         void* e_ptr = untag_ptr(e);
32754         CHECK_ACCESS(e_ptr);
32755         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32756         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32757         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
32758         *ret_conv = CResult_HostnameDecodeErrorZ_err(e_conv);
32759         return tag_ptr(ret_conv, true);
32760 }
32761
32762 jboolean  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_is_ok"))) TS_CResult_HostnameDecodeErrorZ_is_ok(uint64_t o) {
32763         LDKCResult_HostnameDecodeErrorZ* o_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(o);
32764         jboolean ret_conv = CResult_HostnameDecodeErrorZ_is_ok(o_conv);
32765         return ret_conv;
32766 }
32767
32768 void  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_free"))) TS_CResult_HostnameDecodeErrorZ_free(uint64_t _res) {
32769         if (!ptr_is_owned(_res)) return;
32770         void* _res_ptr = untag_ptr(_res);
32771         CHECK_ACCESS(_res_ptr);
32772         LDKCResult_HostnameDecodeErrorZ _res_conv = *(LDKCResult_HostnameDecodeErrorZ*)(_res_ptr);
32773         FREE(untag_ptr(_res));
32774         CResult_HostnameDecodeErrorZ_free(_res_conv);
32775 }
32776
32777 static inline uint64_t CResult_HostnameDecodeErrorZ_clone_ptr(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR arg) {
32778         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
32779         *ret_conv = CResult_HostnameDecodeErrorZ_clone(arg);
32780         return tag_ptr(ret_conv, true);
32781 }
32782 int64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_clone_ptr"))) TS_CResult_HostnameDecodeErrorZ_clone_ptr(uint64_t arg) {
32783         LDKCResult_HostnameDecodeErrorZ* arg_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(arg);
32784         int64_t ret_conv = CResult_HostnameDecodeErrorZ_clone_ptr(arg_conv);
32785         return ret_conv;
32786 }
32787
32788 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_clone"))) TS_CResult_HostnameDecodeErrorZ_clone(uint64_t orig) {
32789         LDKCResult_HostnameDecodeErrorZ* orig_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(orig);
32790         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
32791         *ret_conv = CResult_HostnameDecodeErrorZ_clone(orig_conv);
32792         return tag_ptr(ret_conv, true);
32793 }
32794
32795 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_ok"))) TS_CResult_TransactionU16LenLimitedNoneZ_ok(uint64_t o) {
32796         LDKTransactionU16LenLimited o_conv;
32797         o_conv.inner = untag_ptr(o);
32798         o_conv.is_owned = ptr_is_owned(o);
32799         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32800         o_conv = TransactionU16LenLimited_clone(&o_conv);
32801         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
32802         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_ok(o_conv);
32803         return tag_ptr(ret_conv, true);
32804 }
32805
32806 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_err"))) TS_CResult_TransactionU16LenLimitedNoneZ_err() {
32807         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
32808         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_err();
32809         return tag_ptr(ret_conv, true);
32810 }
32811
32812 jboolean  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_is_ok"))) TS_CResult_TransactionU16LenLimitedNoneZ_is_ok(uint64_t o) {
32813         LDKCResult_TransactionU16LenLimitedNoneZ* o_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(o);
32814         jboolean ret_conv = CResult_TransactionU16LenLimitedNoneZ_is_ok(o_conv);
32815         return ret_conv;
32816 }
32817
32818 void  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_free"))) TS_CResult_TransactionU16LenLimitedNoneZ_free(uint64_t _res) {
32819         if (!ptr_is_owned(_res)) return;
32820         void* _res_ptr = untag_ptr(_res);
32821         CHECK_ACCESS(_res_ptr);
32822         LDKCResult_TransactionU16LenLimitedNoneZ _res_conv = *(LDKCResult_TransactionU16LenLimitedNoneZ*)(_res_ptr);
32823         FREE(untag_ptr(_res));
32824         CResult_TransactionU16LenLimitedNoneZ_free(_res_conv);
32825 }
32826
32827 static inline uint64_t CResult_TransactionU16LenLimitedNoneZ_clone_ptr(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR arg) {
32828         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
32829         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone(arg);
32830         return tag_ptr(ret_conv, true);
32831 }
32832 int64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_clone_ptr"))) TS_CResult_TransactionU16LenLimitedNoneZ_clone_ptr(uint64_t arg) {
32833         LDKCResult_TransactionU16LenLimitedNoneZ* arg_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(arg);
32834         int64_t ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone_ptr(arg_conv);
32835         return ret_conv;
32836 }
32837
32838 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_clone"))) TS_CResult_TransactionU16LenLimitedNoneZ_clone(uint64_t orig) {
32839         LDKCResult_TransactionU16LenLimitedNoneZ* orig_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(orig);
32840         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
32841         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone(orig_conv);
32842         return tag_ptr(ret_conv, true);
32843 }
32844
32845 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_ok"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_ok(uint64_t o) {
32846         LDKTransactionU16LenLimited o_conv;
32847         o_conv.inner = untag_ptr(o);
32848         o_conv.is_owned = ptr_is_owned(o);
32849         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32850         o_conv = TransactionU16LenLimited_clone(&o_conv);
32851         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
32852         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_ok(o_conv);
32853         return tag_ptr(ret_conv, true);
32854 }
32855
32856 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_err"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_err(uint64_t e) {
32857         void* e_ptr = untag_ptr(e);
32858         CHECK_ACCESS(e_ptr);
32859         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32860         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32861         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
32862         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_err(e_conv);
32863         return tag_ptr(ret_conv, true);
32864 }
32865
32866 jboolean  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(uint64_t o) {
32867         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* o_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(o);
32868         jboolean ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(o_conv);
32869         return ret_conv;
32870 }
32871
32872 void  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_free"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_free(uint64_t _res) {
32873         if (!ptr_is_owned(_res)) return;
32874         void* _res_ptr = untag_ptr(_res);
32875         CHECK_ACCESS(_res_ptr);
32876         LDKCResult_TransactionU16LenLimitedDecodeErrorZ _res_conv = *(LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)(_res_ptr);
32877         FREE(untag_ptr(_res));
32878         CResult_TransactionU16LenLimitedDecodeErrorZ_free(_res_conv);
32879 }
32880
32881 static inline uint64_t CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR arg) {
32882         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
32883         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone(arg);
32884         return tag_ptr(ret_conv, true);
32885 }
32886 int64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(uint64_t arg) {
32887         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* arg_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(arg);
32888         int64_t ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(arg_conv);
32889         return ret_conv;
32890 }
32891
32892 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_clone"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_clone(uint64_t orig) {
32893         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* orig_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(orig);
32894         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
32895         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone(orig_conv);
32896         return tag_ptr(ret_conv, true);
32897 }
32898
32899 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_ok"))) TS_CResult_UntrustedStringDecodeErrorZ_ok(uint64_t o) {
32900         LDKUntrustedString o_conv;
32901         o_conv.inner = untag_ptr(o);
32902         o_conv.is_owned = ptr_is_owned(o);
32903         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32904         o_conv = UntrustedString_clone(&o_conv);
32905         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
32906         *ret_conv = CResult_UntrustedStringDecodeErrorZ_ok(o_conv);
32907         return tag_ptr(ret_conv, true);
32908 }
32909
32910 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_err"))) TS_CResult_UntrustedStringDecodeErrorZ_err(uint64_t e) {
32911         void* e_ptr = untag_ptr(e);
32912         CHECK_ACCESS(e_ptr);
32913         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32914         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32915         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
32916         *ret_conv = CResult_UntrustedStringDecodeErrorZ_err(e_conv);
32917         return tag_ptr(ret_conv, true);
32918 }
32919
32920 jboolean  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_is_ok"))) TS_CResult_UntrustedStringDecodeErrorZ_is_ok(uint64_t o) {
32921         LDKCResult_UntrustedStringDecodeErrorZ* o_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(o);
32922         jboolean ret_conv = CResult_UntrustedStringDecodeErrorZ_is_ok(o_conv);
32923         return ret_conv;
32924 }
32925
32926 void  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_free"))) TS_CResult_UntrustedStringDecodeErrorZ_free(uint64_t _res) {
32927         if (!ptr_is_owned(_res)) return;
32928         void* _res_ptr = untag_ptr(_res);
32929         CHECK_ACCESS(_res_ptr);
32930         LDKCResult_UntrustedStringDecodeErrorZ _res_conv = *(LDKCResult_UntrustedStringDecodeErrorZ*)(_res_ptr);
32931         FREE(untag_ptr(_res));
32932         CResult_UntrustedStringDecodeErrorZ_free(_res_conv);
32933 }
32934
32935 static inline uint64_t CResult_UntrustedStringDecodeErrorZ_clone_ptr(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR arg) {
32936         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
32937         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(arg);
32938         return tag_ptr(ret_conv, true);
32939 }
32940 int64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_clone_ptr"))) TS_CResult_UntrustedStringDecodeErrorZ_clone_ptr(uint64_t arg) {
32941         LDKCResult_UntrustedStringDecodeErrorZ* arg_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(arg);
32942         int64_t ret_conv = CResult_UntrustedStringDecodeErrorZ_clone_ptr(arg_conv);
32943         return ret_conv;
32944 }
32945
32946 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_clone"))) TS_CResult_UntrustedStringDecodeErrorZ_clone(uint64_t orig) {
32947         LDKCResult_UntrustedStringDecodeErrorZ* orig_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(orig);
32948         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
32949         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(orig_conv);
32950         return tag_ptr(ret_conv, true);
32951 }
32952
32953 uint64_t  __attribute__((export_name("TS_CResult_ChannelIdDecodeErrorZ_ok"))) TS_CResult_ChannelIdDecodeErrorZ_ok(uint64_t o) {
32954         LDKChannelId o_conv;
32955         o_conv.inner = untag_ptr(o);
32956         o_conv.is_owned = ptr_is_owned(o);
32957         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32958         o_conv = ChannelId_clone(&o_conv);
32959         LDKCResult_ChannelIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdDecodeErrorZ), "LDKCResult_ChannelIdDecodeErrorZ");
32960         *ret_conv = CResult_ChannelIdDecodeErrorZ_ok(o_conv);
32961         return tag_ptr(ret_conv, true);
32962 }
32963
32964 uint64_t  __attribute__((export_name("TS_CResult_ChannelIdDecodeErrorZ_err"))) TS_CResult_ChannelIdDecodeErrorZ_err(uint64_t e) {
32965         void* e_ptr = untag_ptr(e);
32966         CHECK_ACCESS(e_ptr);
32967         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32968         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32969         LDKCResult_ChannelIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdDecodeErrorZ), "LDKCResult_ChannelIdDecodeErrorZ");
32970         *ret_conv = CResult_ChannelIdDecodeErrorZ_err(e_conv);
32971         return tag_ptr(ret_conv, true);
32972 }
32973
32974 jboolean  __attribute__((export_name("TS_CResult_ChannelIdDecodeErrorZ_is_ok"))) TS_CResult_ChannelIdDecodeErrorZ_is_ok(uint64_t o) {
32975         LDKCResult_ChannelIdDecodeErrorZ* o_conv = (LDKCResult_ChannelIdDecodeErrorZ*)untag_ptr(o);
32976         jboolean ret_conv = CResult_ChannelIdDecodeErrorZ_is_ok(o_conv);
32977         return ret_conv;
32978 }
32979
32980 void  __attribute__((export_name("TS_CResult_ChannelIdDecodeErrorZ_free"))) TS_CResult_ChannelIdDecodeErrorZ_free(uint64_t _res) {
32981         if (!ptr_is_owned(_res)) return;
32982         void* _res_ptr = untag_ptr(_res);
32983         CHECK_ACCESS(_res_ptr);
32984         LDKCResult_ChannelIdDecodeErrorZ _res_conv = *(LDKCResult_ChannelIdDecodeErrorZ*)(_res_ptr);
32985         FREE(untag_ptr(_res));
32986         CResult_ChannelIdDecodeErrorZ_free(_res_conv);
32987 }
32988
32989 static inline uint64_t CResult_ChannelIdDecodeErrorZ_clone_ptr(LDKCResult_ChannelIdDecodeErrorZ *NONNULL_PTR arg) {
32990         LDKCResult_ChannelIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdDecodeErrorZ), "LDKCResult_ChannelIdDecodeErrorZ");
32991         *ret_conv = CResult_ChannelIdDecodeErrorZ_clone(arg);
32992         return tag_ptr(ret_conv, true);
32993 }
32994 int64_t  __attribute__((export_name("TS_CResult_ChannelIdDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelIdDecodeErrorZ_clone_ptr(uint64_t arg) {
32995         LDKCResult_ChannelIdDecodeErrorZ* arg_conv = (LDKCResult_ChannelIdDecodeErrorZ*)untag_ptr(arg);
32996         int64_t ret_conv = CResult_ChannelIdDecodeErrorZ_clone_ptr(arg_conv);
32997         return ret_conv;
32998 }
32999
33000 uint64_t  __attribute__((export_name("TS_CResult_ChannelIdDecodeErrorZ_clone"))) TS_CResult_ChannelIdDecodeErrorZ_clone(uint64_t orig) {
33001         LDKCResult_ChannelIdDecodeErrorZ* orig_conv = (LDKCResult_ChannelIdDecodeErrorZ*)untag_ptr(orig);
33002         LDKCResult_ChannelIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdDecodeErrorZ), "LDKCResult_ChannelIdDecodeErrorZ");
33003         *ret_conv = CResult_ChannelIdDecodeErrorZ_clone(orig_conv);
33004         return tag_ptr(ret_conv, true);
33005 }
33006
33007 static inline uint64_t C2Tuple__u832u16Z_clone_ptr(LDKC2Tuple__u832u16Z *NONNULL_PTR arg) {
33008         LDKC2Tuple__u832u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u832u16Z), "LDKC2Tuple__u832u16Z");
33009         *ret_conv = C2Tuple__u832u16Z_clone(arg);
33010         return tag_ptr(ret_conv, true);
33011 }
33012 int64_t  __attribute__((export_name("TS_C2Tuple__u832u16Z_clone_ptr"))) TS_C2Tuple__u832u16Z_clone_ptr(uint64_t arg) {
33013         LDKC2Tuple__u832u16Z* arg_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(arg);
33014         int64_t ret_conv = C2Tuple__u832u16Z_clone_ptr(arg_conv);
33015         return ret_conv;
33016 }
33017
33018 uint64_t  __attribute__((export_name("TS_C2Tuple__u832u16Z_clone"))) TS_C2Tuple__u832u16Z_clone(uint64_t orig) {
33019         LDKC2Tuple__u832u16Z* orig_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(orig);
33020         LDKC2Tuple__u832u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u832u16Z), "LDKC2Tuple__u832u16Z");
33021         *ret_conv = C2Tuple__u832u16Z_clone(orig_conv);
33022         return tag_ptr(ret_conv, true);
33023 }
33024
33025 uint64_t  __attribute__((export_name("TS_C2Tuple__u832u16Z_new"))) TS_C2Tuple__u832u16Z_new(int8_tArray a, int16_t b) {
33026         LDKThirtyTwoBytes a_ref;
33027         CHECK(a->arr_len == 32);
33028         memcpy(a_ref.data, a->elems, 32); FREE(a);
33029         LDKC2Tuple__u832u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u832u16Z), "LDKC2Tuple__u832u16Z");
33030         *ret_conv = C2Tuple__u832u16Z_new(a_ref, b);
33031         return tag_ptr(ret_conv, true);
33032 }
33033
33034 void  __attribute__((export_name("TS_C2Tuple__u832u16Z_free"))) TS_C2Tuple__u832u16Z_free(uint64_t _res) {
33035         if (!ptr_is_owned(_res)) return;
33036         void* _res_ptr = untag_ptr(_res);
33037         CHECK_ACCESS(_res_ptr);
33038         LDKC2Tuple__u832u16Z _res_conv = *(LDKC2Tuple__u832u16Z*)(_res_ptr);
33039         FREE(untag_ptr(_res));
33040         C2Tuple__u832u16Z_free(_res_conv);
33041 }
33042
33043 uint64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_ok"))) TS_CResult_PaymentRelayDecodeErrorZ_ok(uint64_t o) {
33044         LDKPaymentRelay o_conv;
33045         o_conv.inner = untag_ptr(o);
33046         o_conv.is_owned = ptr_is_owned(o);
33047         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33048         o_conv = PaymentRelay_clone(&o_conv);
33049         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
33050         *ret_conv = CResult_PaymentRelayDecodeErrorZ_ok(o_conv);
33051         return tag_ptr(ret_conv, true);
33052 }
33053
33054 uint64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_err"))) TS_CResult_PaymentRelayDecodeErrorZ_err(uint64_t e) {
33055         void* e_ptr = untag_ptr(e);
33056         CHECK_ACCESS(e_ptr);
33057         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33058         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33059         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
33060         *ret_conv = CResult_PaymentRelayDecodeErrorZ_err(e_conv);
33061         return tag_ptr(ret_conv, true);
33062 }
33063
33064 jboolean  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_is_ok"))) TS_CResult_PaymentRelayDecodeErrorZ_is_ok(uint64_t o) {
33065         LDKCResult_PaymentRelayDecodeErrorZ* o_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(o);
33066         jboolean ret_conv = CResult_PaymentRelayDecodeErrorZ_is_ok(o_conv);
33067         return ret_conv;
33068 }
33069
33070 void  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_free"))) TS_CResult_PaymentRelayDecodeErrorZ_free(uint64_t _res) {
33071         if (!ptr_is_owned(_res)) return;
33072         void* _res_ptr = untag_ptr(_res);
33073         CHECK_ACCESS(_res_ptr);
33074         LDKCResult_PaymentRelayDecodeErrorZ _res_conv = *(LDKCResult_PaymentRelayDecodeErrorZ*)(_res_ptr);
33075         FREE(untag_ptr(_res));
33076         CResult_PaymentRelayDecodeErrorZ_free(_res_conv);
33077 }
33078
33079 static inline uint64_t CResult_PaymentRelayDecodeErrorZ_clone_ptr(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR arg) {
33080         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
33081         *ret_conv = CResult_PaymentRelayDecodeErrorZ_clone(arg);
33082         return tag_ptr(ret_conv, true);
33083 }
33084 int64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentRelayDecodeErrorZ_clone_ptr(uint64_t arg) {
33085         LDKCResult_PaymentRelayDecodeErrorZ* arg_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(arg);
33086         int64_t ret_conv = CResult_PaymentRelayDecodeErrorZ_clone_ptr(arg_conv);
33087         return ret_conv;
33088 }
33089
33090 uint64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_clone"))) TS_CResult_PaymentRelayDecodeErrorZ_clone(uint64_t orig) {
33091         LDKCResult_PaymentRelayDecodeErrorZ* orig_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(orig);
33092         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
33093         *ret_conv = CResult_PaymentRelayDecodeErrorZ_clone(orig_conv);
33094         return tag_ptr(ret_conv, true);
33095 }
33096
33097 uint64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_ok"))) TS_CResult_PaymentConstraintsDecodeErrorZ_ok(uint64_t o) {
33098         LDKPaymentConstraints o_conv;
33099         o_conv.inner = untag_ptr(o);
33100         o_conv.is_owned = ptr_is_owned(o);
33101         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33102         o_conv = PaymentConstraints_clone(&o_conv);
33103         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
33104         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_ok(o_conv);
33105         return tag_ptr(ret_conv, true);
33106 }
33107
33108 uint64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_err"))) TS_CResult_PaymentConstraintsDecodeErrorZ_err(uint64_t e) {
33109         void* e_ptr = untag_ptr(e);
33110         CHECK_ACCESS(e_ptr);
33111         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33112         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33113         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
33114         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_err(e_conv);
33115         return tag_ptr(ret_conv, true);
33116 }
33117
33118 jboolean  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_is_ok"))) TS_CResult_PaymentConstraintsDecodeErrorZ_is_ok(uint64_t o) {
33119         LDKCResult_PaymentConstraintsDecodeErrorZ* o_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(o);
33120         jboolean ret_conv = CResult_PaymentConstraintsDecodeErrorZ_is_ok(o_conv);
33121         return ret_conv;
33122 }
33123
33124 void  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_free"))) TS_CResult_PaymentConstraintsDecodeErrorZ_free(uint64_t _res) {
33125         if (!ptr_is_owned(_res)) return;
33126         void* _res_ptr = untag_ptr(_res);
33127         CHECK_ACCESS(_res_ptr);
33128         LDKCResult_PaymentConstraintsDecodeErrorZ _res_conv = *(LDKCResult_PaymentConstraintsDecodeErrorZ*)(_res_ptr);
33129         FREE(untag_ptr(_res));
33130         CResult_PaymentConstraintsDecodeErrorZ_free(_res_conv);
33131 }
33132
33133 static inline uint64_t CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR arg) {
33134         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
33135         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone(arg);
33136         return tag_ptr(ret_conv, true);
33137 }
33138 int64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(uint64_t arg) {
33139         LDKCResult_PaymentConstraintsDecodeErrorZ* arg_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(arg);
33140         int64_t ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(arg_conv);
33141         return ret_conv;
33142 }
33143
33144 uint64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_clone"))) TS_CResult_PaymentConstraintsDecodeErrorZ_clone(uint64_t orig) {
33145         LDKCResult_PaymentConstraintsDecodeErrorZ* orig_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(orig);
33146         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
33147         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone(orig_conv);
33148         return tag_ptr(ret_conv, true);
33149 }
33150
33151 uint64_t  __attribute__((export_name("TS_CResult_PaymentContextDecodeErrorZ_ok"))) TS_CResult_PaymentContextDecodeErrorZ_ok(uint64_t o) {
33152         void* o_ptr = untag_ptr(o);
33153         CHECK_ACCESS(o_ptr);
33154         LDKPaymentContext o_conv = *(LDKPaymentContext*)(o_ptr);
33155         o_conv = PaymentContext_clone((LDKPaymentContext*)untag_ptr(o));
33156         LDKCResult_PaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentContextDecodeErrorZ), "LDKCResult_PaymentContextDecodeErrorZ");
33157         *ret_conv = CResult_PaymentContextDecodeErrorZ_ok(o_conv);
33158         return tag_ptr(ret_conv, true);
33159 }
33160
33161 uint64_t  __attribute__((export_name("TS_CResult_PaymentContextDecodeErrorZ_err"))) TS_CResult_PaymentContextDecodeErrorZ_err(uint64_t e) {
33162         void* e_ptr = untag_ptr(e);
33163         CHECK_ACCESS(e_ptr);
33164         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33165         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33166         LDKCResult_PaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentContextDecodeErrorZ), "LDKCResult_PaymentContextDecodeErrorZ");
33167         *ret_conv = CResult_PaymentContextDecodeErrorZ_err(e_conv);
33168         return tag_ptr(ret_conv, true);
33169 }
33170
33171 jboolean  __attribute__((export_name("TS_CResult_PaymentContextDecodeErrorZ_is_ok"))) TS_CResult_PaymentContextDecodeErrorZ_is_ok(uint64_t o) {
33172         LDKCResult_PaymentContextDecodeErrorZ* o_conv = (LDKCResult_PaymentContextDecodeErrorZ*)untag_ptr(o);
33173         jboolean ret_conv = CResult_PaymentContextDecodeErrorZ_is_ok(o_conv);
33174         return ret_conv;
33175 }
33176
33177 void  __attribute__((export_name("TS_CResult_PaymentContextDecodeErrorZ_free"))) TS_CResult_PaymentContextDecodeErrorZ_free(uint64_t _res) {
33178         if (!ptr_is_owned(_res)) return;
33179         void* _res_ptr = untag_ptr(_res);
33180         CHECK_ACCESS(_res_ptr);
33181         LDKCResult_PaymentContextDecodeErrorZ _res_conv = *(LDKCResult_PaymentContextDecodeErrorZ*)(_res_ptr);
33182         FREE(untag_ptr(_res));
33183         CResult_PaymentContextDecodeErrorZ_free(_res_conv);
33184 }
33185
33186 static inline uint64_t CResult_PaymentContextDecodeErrorZ_clone_ptr(LDKCResult_PaymentContextDecodeErrorZ *NONNULL_PTR arg) {
33187         LDKCResult_PaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentContextDecodeErrorZ), "LDKCResult_PaymentContextDecodeErrorZ");
33188         *ret_conv = CResult_PaymentContextDecodeErrorZ_clone(arg);
33189         return tag_ptr(ret_conv, true);
33190 }
33191 int64_t  __attribute__((export_name("TS_CResult_PaymentContextDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentContextDecodeErrorZ_clone_ptr(uint64_t arg) {
33192         LDKCResult_PaymentContextDecodeErrorZ* arg_conv = (LDKCResult_PaymentContextDecodeErrorZ*)untag_ptr(arg);
33193         int64_t ret_conv = CResult_PaymentContextDecodeErrorZ_clone_ptr(arg_conv);
33194         return ret_conv;
33195 }
33196
33197 uint64_t  __attribute__((export_name("TS_CResult_PaymentContextDecodeErrorZ_clone"))) TS_CResult_PaymentContextDecodeErrorZ_clone(uint64_t orig) {
33198         LDKCResult_PaymentContextDecodeErrorZ* orig_conv = (LDKCResult_PaymentContextDecodeErrorZ*)untag_ptr(orig);
33199         LDKCResult_PaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentContextDecodeErrorZ), "LDKCResult_PaymentContextDecodeErrorZ");
33200         *ret_conv = CResult_PaymentContextDecodeErrorZ_clone(orig_conv);
33201         return tag_ptr(ret_conv, true);
33202 }
33203
33204 uint64_t  __attribute__((export_name("TS_CResult_UnknownPaymentContextDecodeErrorZ_ok"))) TS_CResult_UnknownPaymentContextDecodeErrorZ_ok(uint64_t o) {
33205         LDKUnknownPaymentContext o_conv;
33206         o_conv.inner = untag_ptr(o);
33207         o_conv.is_owned = ptr_is_owned(o);
33208         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33209         o_conv = UnknownPaymentContext_clone(&o_conv);
33210         LDKCResult_UnknownPaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnknownPaymentContextDecodeErrorZ), "LDKCResult_UnknownPaymentContextDecodeErrorZ");
33211         *ret_conv = CResult_UnknownPaymentContextDecodeErrorZ_ok(o_conv);
33212         return tag_ptr(ret_conv, true);
33213 }
33214
33215 uint64_t  __attribute__((export_name("TS_CResult_UnknownPaymentContextDecodeErrorZ_err"))) TS_CResult_UnknownPaymentContextDecodeErrorZ_err(uint64_t e) {
33216         void* e_ptr = untag_ptr(e);
33217         CHECK_ACCESS(e_ptr);
33218         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33219         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33220         LDKCResult_UnknownPaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnknownPaymentContextDecodeErrorZ), "LDKCResult_UnknownPaymentContextDecodeErrorZ");
33221         *ret_conv = CResult_UnknownPaymentContextDecodeErrorZ_err(e_conv);
33222         return tag_ptr(ret_conv, true);
33223 }
33224
33225 jboolean  __attribute__((export_name("TS_CResult_UnknownPaymentContextDecodeErrorZ_is_ok"))) TS_CResult_UnknownPaymentContextDecodeErrorZ_is_ok(uint64_t o) {
33226         LDKCResult_UnknownPaymentContextDecodeErrorZ* o_conv = (LDKCResult_UnknownPaymentContextDecodeErrorZ*)untag_ptr(o);
33227         jboolean ret_conv = CResult_UnknownPaymentContextDecodeErrorZ_is_ok(o_conv);
33228         return ret_conv;
33229 }
33230
33231 void  __attribute__((export_name("TS_CResult_UnknownPaymentContextDecodeErrorZ_free"))) TS_CResult_UnknownPaymentContextDecodeErrorZ_free(uint64_t _res) {
33232         if (!ptr_is_owned(_res)) return;
33233         void* _res_ptr = untag_ptr(_res);
33234         CHECK_ACCESS(_res_ptr);
33235         LDKCResult_UnknownPaymentContextDecodeErrorZ _res_conv = *(LDKCResult_UnknownPaymentContextDecodeErrorZ*)(_res_ptr);
33236         FREE(untag_ptr(_res));
33237         CResult_UnknownPaymentContextDecodeErrorZ_free(_res_conv);
33238 }
33239
33240 static inline uint64_t CResult_UnknownPaymentContextDecodeErrorZ_clone_ptr(LDKCResult_UnknownPaymentContextDecodeErrorZ *NONNULL_PTR arg) {
33241         LDKCResult_UnknownPaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnknownPaymentContextDecodeErrorZ), "LDKCResult_UnknownPaymentContextDecodeErrorZ");
33242         *ret_conv = CResult_UnknownPaymentContextDecodeErrorZ_clone(arg);
33243         return tag_ptr(ret_conv, true);
33244 }
33245 int64_t  __attribute__((export_name("TS_CResult_UnknownPaymentContextDecodeErrorZ_clone_ptr"))) TS_CResult_UnknownPaymentContextDecodeErrorZ_clone_ptr(uint64_t arg) {
33246         LDKCResult_UnknownPaymentContextDecodeErrorZ* arg_conv = (LDKCResult_UnknownPaymentContextDecodeErrorZ*)untag_ptr(arg);
33247         int64_t ret_conv = CResult_UnknownPaymentContextDecodeErrorZ_clone_ptr(arg_conv);
33248         return ret_conv;
33249 }
33250
33251 uint64_t  __attribute__((export_name("TS_CResult_UnknownPaymentContextDecodeErrorZ_clone"))) TS_CResult_UnknownPaymentContextDecodeErrorZ_clone(uint64_t orig) {
33252         LDKCResult_UnknownPaymentContextDecodeErrorZ* orig_conv = (LDKCResult_UnknownPaymentContextDecodeErrorZ*)untag_ptr(orig);
33253         LDKCResult_UnknownPaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnknownPaymentContextDecodeErrorZ), "LDKCResult_UnknownPaymentContextDecodeErrorZ");
33254         *ret_conv = CResult_UnknownPaymentContextDecodeErrorZ_clone(orig_conv);
33255         return tag_ptr(ret_conv, true);
33256 }
33257
33258 uint64_t  __attribute__((export_name("TS_CResult_Bolt12OfferContextDecodeErrorZ_ok"))) TS_CResult_Bolt12OfferContextDecodeErrorZ_ok(uint64_t o) {
33259         LDKBolt12OfferContext o_conv;
33260         o_conv.inner = untag_ptr(o);
33261         o_conv.is_owned = ptr_is_owned(o);
33262         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33263         o_conv = Bolt12OfferContext_clone(&o_conv);
33264         LDKCResult_Bolt12OfferContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12OfferContextDecodeErrorZ), "LDKCResult_Bolt12OfferContextDecodeErrorZ");
33265         *ret_conv = CResult_Bolt12OfferContextDecodeErrorZ_ok(o_conv);
33266         return tag_ptr(ret_conv, true);
33267 }
33268
33269 uint64_t  __attribute__((export_name("TS_CResult_Bolt12OfferContextDecodeErrorZ_err"))) TS_CResult_Bolt12OfferContextDecodeErrorZ_err(uint64_t e) {
33270         void* e_ptr = untag_ptr(e);
33271         CHECK_ACCESS(e_ptr);
33272         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33273         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33274         LDKCResult_Bolt12OfferContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12OfferContextDecodeErrorZ), "LDKCResult_Bolt12OfferContextDecodeErrorZ");
33275         *ret_conv = CResult_Bolt12OfferContextDecodeErrorZ_err(e_conv);
33276         return tag_ptr(ret_conv, true);
33277 }
33278
33279 jboolean  __attribute__((export_name("TS_CResult_Bolt12OfferContextDecodeErrorZ_is_ok"))) TS_CResult_Bolt12OfferContextDecodeErrorZ_is_ok(uint64_t o) {
33280         LDKCResult_Bolt12OfferContextDecodeErrorZ* o_conv = (LDKCResult_Bolt12OfferContextDecodeErrorZ*)untag_ptr(o);
33281         jboolean ret_conv = CResult_Bolt12OfferContextDecodeErrorZ_is_ok(o_conv);
33282         return ret_conv;
33283 }
33284
33285 void  __attribute__((export_name("TS_CResult_Bolt12OfferContextDecodeErrorZ_free"))) TS_CResult_Bolt12OfferContextDecodeErrorZ_free(uint64_t _res) {
33286         if (!ptr_is_owned(_res)) return;
33287         void* _res_ptr = untag_ptr(_res);
33288         CHECK_ACCESS(_res_ptr);
33289         LDKCResult_Bolt12OfferContextDecodeErrorZ _res_conv = *(LDKCResult_Bolt12OfferContextDecodeErrorZ*)(_res_ptr);
33290         FREE(untag_ptr(_res));
33291         CResult_Bolt12OfferContextDecodeErrorZ_free(_res_conv);
33292 }
33293
33294 static inline uint64_t CResult_Bolt12OfferContextDecodeErrorZ_clone_ptr(LDKCResult_Bolt12OfferContextDecodeErrorZ *NONNULL_PTR arg) {
33295         LDKCResult_Bolt12OfferContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12OfferContextDecodeErrorZ), "LDKCResult_Bolt12OfferContextDecodeErrorZ");
33296         *ret_conv = CResult_Bolt12OfferContextDecodeErrorZ_clone(arg);
33297         return tag_ptr(ret_conv, true);
33298 }
33299 int64_t  __attribute__((export_name("TS_CResult_Bolt12OfferContextDecodeErrorZ_clone_ptr"))) TS_CResult_Bolt12OfferContextDecodeErrorZ_clone_ptr(uint64_t arg) {
33300         LDKCResult_Bolt12OfferContextDecodeErrorZ* arg_conv = (LDKCResult_Bolt12OfferContextDecodeErrorZ*)untag_ptr(arg);
33301         int64_t ret_conv = CResult_Bolt12OfferContextDecodeErrorZ_clone_ptr(arg_conv);
33302         return ret_conv;
33303 }
33304
33305 uint64_t  __attribute__((export_name("TS_CResult_Bolt12OfferContextDecodeErrorZ_clone"))) TS_CResult_Bolt12OfferContextDecodeErrorZ_clone(uint64_t orig) {
33306         LDKCResult_Bolt12OfferContextDecodeErrorZ* orig_conv = (LDKCResult_Bolt12OfferContextDecodeErrorZ*)untag_ptr(orig);
33307         LDKCResult_Bolt12OfferContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12OfferContextDecodeErrorZ), "LDKCResult_Bolt12OfferContextDecodeErrorZ");
33308         *ret_conv = CResult_Bolt12OfferContextDecodeErrorZ_clone(orig_conv);
33309         return tag_ptr(ret_conv, true);
33310 }
33311
33312 uint64_t  __attribute__((export_name("TS_CResult_Bolt12RefundContextDecodeErrorZ_ok"))) TS_CResult_Bolt12RefundContextDecodeErrorZ_ok(uint64_t o) {
33313         LDKBolt12RefundContext o_conv;
33314         o_conv.inner = untag_ptr(o);
33315         o_conv.is_owned = ptr_is_owned(o);
33316         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33317         o_conv = Bolt12RefundContext_clone(&o_conv);
33318         LDKCResult_Bolt12RefundContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12RefundContextDecodeErrorZ), "LDKCResult_Bolt12RefundContextDecodeErrorZ");
33319         *ret_conv = CResult_Bolt12RefundContextDecodeErrorZ_ok(o_conv);
33320         return tag_ptr(ret_conv, true);
33321 }
33322
33323 uint64_t  __attribute__((export_name("TS_CResult_Bolt12RefundContextDecodeErrorZ_err"))) TS_CResult_Bolt12RefundContextDecodeErrorZ_err(uint64_t e) {
33324         void* e_ptr = untag_ptr(e);
33325         CHECK_ACCESS(e_ptr);
33326         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33327         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33328         LDKCResult_Bolt12RefundContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12RefundContextDecodeErrorZ), "LDKCResult_Bolt12RefundContextDecodeErrorZ");
33329         *ret_conv = CResult_Bolt12RefundContextDecodeErrorZ_err(e_conv);
33330         return tag_ptr(ret_conv, true);
33331 }
33332
33333 jboolean  __attribute__((export_name("TS_CResult_Bolt12RefundContextDecodeErrorZ_is_ok"))) TS_CResult_Bolt12RefundContextDecodeErrorZ_is_ok(uint64_t o) {
33334         LDKCResult_Bolt12RefundContextDecodeErrorZ* o_conv = (LDKCResult_Bolt12RefundContextDecodeErrorZ*)untag_ptr(o);
33335         jboolean ret_conv = CResult_Bolt12RefundContextDecodeErrorZ_is_ok(o_conv);
33336         return ret_conv;
33337 }
33338
33339 void  __attribute__((export_name("TS_CResult_Bolt12RefundContextDecodeErrorZ_free"))) TS_CResult_Bolt12RefundContextDecodeErrorZ_free(uint64_t _res) {
33340         if (!ptr_is_owned(_res)) return;
33341         void* _res_ptr = untag_ptr(_res);
33342         CHECK_ACCESS(_res_ptr);
33343         LDKCResult_Bolt12RefundContextDecodeErrorZ _res_conv = *(LDKCResult_Bolt12RefundContextDecodeErrorZ*)(_res_ptr);
33344         FREE(untag_ptr(_res));
33345         CResult_Bolt12RefundContextDecodeErrorZ_free(_res_conv);
33346 }
33347
33348 static inline uint64_t CResult_Bolt12RefundContextDecodeErrorZ_clone_ptr(LDKCResult_Bolt12RefundContextDecodeErrorZ *NONNULL_PTR arg) {
33349         LDKCResult_Bolt12RefundContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12RefundContextDecodeErrorZ), "LDKCResult_Bolt12RefundContextDecodeErrorZ");
33350         *ret_conv = CResult_Bolt12RefundContextDecodeErrorZ_clone(arg);
33351         return tag_ptr(ret_conv, true);
33352 }
33353 int64_t  __attribute__((export_name("TS_CResult_Bolt12RefundContextDecodeErrorZ_clone_ptr"))) TS_CResult_Bolt12RefundContextDecodeErrorZ_clone_ptr(uint64_t arg) {
33354         LDKCResult_Bolt12RefundContextDecodeErrorZ* arg_conv = (LDKCResult_Bolt12RefundContextDecodeErrorZ*)untag_ptr(arg);
33355         int64_t ret_conv = CResult_Bolt12RefundContextDecodeErrorZ_clone_ptr(arg_conv);
33356         return ret_conv;
33357 }
33358
33359 uint64_t  __attribute__((export_name("TS_CResult_Bolt12RefundContextDecodeErrorZ_clone"))) TS_CResult_Bolt12RefundContextDecodeErrorZ_clone(uint64_t orig) {
33360         LDKCResult_Bolt12RefundContextDecodeErrorZ* orig_conv = (LDKCResult_Bolt12RefundContextDecodeErrorZ*)untag_ptr(orig);
33361         LDKCResult_Bolt12RefundContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12RefundContextDecodeErrorZ), "LDKCResult_Bolt12RefundContextDecodeErrorZ");
33362         *ret_conv = CResult_Bolt12RefundContextDecodeErrorZ_clone(orig_conv);
33363         return tag_ptr(ret_conv, true);
33364 }
33365
33366 uint64_t  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_ok"))) TS_CResult_StrSecp256k1ErrorZ_ok(jstring o) {
33367         LDKStr o_conv = str_ref_to_owned_c(o);
33368         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
33369         *ret_conv = CResult_StrSecp256k1ErrorZ_ok(o_conv);
33370         return tag_ptr(ret_conv, true);
33371 }
33372
33373 uint64_t  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_err"))) TS_CResult_StrSecp256k1ErrorZ_err(uint32_t e) {
33374         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
33375         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
33376         *ret_conv = CResult_StrSecp256k1ErrorZ_err(e_conv);
33377         return tag_ptr(ret_conv, true);
33378 }
33379
33380 jboolean  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_is_ok"))) TS_CResult_StrSecp256k1ErrorZ_is_ok(uint64_t o) {
33381         LDKCResult_StrSecp256k1ErrorZ* o_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(o);
33382         jboolean ret_conv = CResult_StrSecp256k1ErrorZ_is_ok(o_conv);
33383         return ret_conv;
33384 }
33385
33386 void  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_free"))) TS_CResult_StrSecp256k1ErrorZ_free(uint64_t _res) {
33387         if (!ptr_is_owned(_res)) return;
33388         void* _res_ptr = untag_ptr(_res);
33389         CHECK_ACCESS(_res_ptr);
33390         LDKCResult_StrSecp256k1ErrorZ _res_conv = *(LDKCResult_StrSecp256k1ErrorZ*)(_res_ptr);
33391         FREE(untag_ptr(_res));
33392         CResult_StrSecp256k1ErrorZ_free(_res_conv);
33393 }
33394
33395 static inline uint64_t CResult_StrSecp256k1ErrorZ_clone_ptr(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR arg) {
33396         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
33397         *ret_conv = CResult_StrSecp256k1ErrorZ_clone(arg);
33398         return tag_ptr(ret_conv, true);
33399 }
33400 int64_t  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_clone_ptr"))) TS_CResult_StrSecp256k1ErrorZ_clone_ptr(uint64_t arg) {
33401         LDKCResult_StrSecp256k1ErrorZ* arg_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(arg);
33402         int64_t ret_conv = CResult_StrSecp256k1ErrorZ_clone_ptr(arg_conv);
33403         return ret_conv;
33404 }
33405
33406 uint64_t  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_clone"))) TS_CResult_StrSecp256k1ErrorZ_clone(uint64_t orig) {
33407         LDKCResult_StrSecp256k1ErrorZ* orig_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(orig);
33408         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
33409         *ret_conv = CResult_StrSecp256k1ErrorZ_clone(orig_conv);
33410         return tag_ptr(ret_conv, true);
33411 }
33412
33413 static inline uint64_t C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone_ptr(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR arg) {
33414         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
33415         *ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(arg);
33416         return tag_ptr(ret_conv, true);
33417 }
33418 int64_t  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone_ptr"))) TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone_ptr(uint64_t arg) {
33419         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* arg_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(arg);
33420         int64_t ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone_ptr(arg_conv);
33421         return ret_conv;
33422 }
33423
33424 uint64_t  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone"))) TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(uint64_t orig) {
33425         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* orig_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(orig);
33426         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
33427         *ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(orig_conv);
33428         return tag_ptr(ret_conv, true);
33429 }
33430
33431 uint64_t  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_new"))) TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_new(int8_tArray a, uint64_t b, uint64_t c) {
33432         LDKThirtyTwoBytes a_ref;
33433         CHECK(a->arr_len == 32);
33434         memcpy(a_ref.data, a->elems, 32); FREE(a);
33435         LDKRecipientOnionFields b_conv;
33436         b_conv.inner = untag_ptr(b);
33437         b_conv.is_owned = ptr_is_owned(b);
33438         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33439         b_conv = RecipientOnionFields_clone(&b_conv);
33440         LDKRouteParameters c_conv;
33441         c_conv.inner = untag_ptr(c);
33442         c_conv.is_owned = ptr_is_owned(c);
33443         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
33444         c_conv = RouteParameters_clone(&c_conv);
33445         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
33446         *ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_new(a_ref, b_conv, c_conv);
33447         return tag_ptr(ret_conv, true);
33448 }
33449
33450 void  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_free"))) TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_free(uint64_t _res) {
33451         if (!ptr_is_owned(_res)) return;
33452         void* _res_ptr = untag_ptr(_res);
33453         CHECK_ACCESS(_res_ptr);
33454         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ _res_conv = *(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)(_res_ptr);
33455         FREE(untag_ptr(_res));
33456         C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_free(_res_conv);
33457 }
33458
33459 uint64_t  __attribute__((export_name("TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_ok"))) TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_ok(uint64_t o) {
33460         void* o_ptr = untag_ptr(o);
33461         CHECK_ACCESS(o_ptr);
33462         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ o_conv = *(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)(o_ptr);
33463         o_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone((LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(o));
33464         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
33465         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_ok(o_conv);
33466         return tag_ptr(ret_conv, true);
33467 }
33468
33469 uint64_t  __attribute__((export_name("TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_err"))) TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_err() {
33470         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
33471         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_err();
33472         return tag_ptr(ret_conv, true);
33473 }
33474
33475 jboolean  __attribute__((export_name("TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_is_ok"))) TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_is_ok(uint64_t o) {
33476         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* o_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(o);
33477         jboolean ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_is_ok(o_conv);
33478         return ret_conv;
33479 }
33480
33481 void  __attribute__((export_name("TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_free"))) TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_free(uint64_t _res) {
33482         if (!ptr_is_owned(_res)) return;
33483         void* _res_ptr = untag_ptr(_res);
33484         CHECK_ACCESS(_res_ptr);
33485         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ _res_conv = *(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)(_res_ptr);
33486         FREE(untag_ptr(_res));
33487         CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_free(_res_conv);
33488 }
33489
33490 static inline uint64_t CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone_ptr(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ *NONNULL_PTR arg) {
33491         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
33492         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone(arg);
33493         return tag_ptr(ret_conv, true);
33494 }
33495 int64_t  __attribute__((export_name("TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone_ptr"))) TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone_ptr(uint64_t arg) {
33496         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* arg_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(arg);
33497         int64_t ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone_ptr(arg_conv);
33498         return ret_conv;
33499 }
33500
33501 uint64_t  __attribute__((export_name("TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone"))) TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone(uint64_t orig) {
33502         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* orig_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(orig);
33503         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
33504         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone(orig_conv);
33505         return tag_ptr(ret_conv, true);
33506 }
33507
33508 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_ok"))) TS_CResult_TxOutUtxoLookupErrorZ_ok(uint64_t o) {
33509         void* o_ptr = untag_ptr(o);
33510         CHECK_ACCESS(o_ptr);
33511         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
33512         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
33513         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
33514         *ret_conv = CResult_TxOutUtxoLookupErrorZ_ok(o_conv);
33515         return tag_ptr(ret_conv, true);
33516 }
33517
33518 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_err"))) TS_CResult_TxOutUtxoLookupErrorZ_err(uint32_t e) {
33519         LDKUtxoLookupError e_conv = LDKUtxoLookupError_from_js(e);
33520         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
33521         *ret_conv = CResult_TxOutUtxoLookupErrorZ_err(e_conv);
33522         return tag_ptr(ret_conv, true);
33523 }
33524
33525 jboolean  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_is_ok"))) TS_CResult_TxOutUtxoLookupErrorZ_is_ok(uint64_t o) {
33526         LDKCResult_TxOutUtxoLookupErrorZ* o_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(o);
33527         jboolean ret_conv = CResult_TxOutUtxoLookupErrorZ_is_ok(o_conv);
33528         return ret_conv;
33529 }
33530
33531 void  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_free"))) TS_CResult_TxOutUtxoLookupErrorZ_free(uint64_t _res) {
33532         if (!ptr_is_owned(_res)) return;
33533         void* _res_ptr = untag_ptr(_res);
33534         CHECK_ACCESS(_res_ptr);
33535         LDKCResult_TxOutUtxoLookupErrorZ _res_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(_res_ptr);
33536         FREE(untag_ptr(_res));
33537         CResult_TxOutUtxoLookupErrorZ_free(_res_conv);
33538 }
33539
33540 static inline uint64_t CResult_TxOutUtxoLookupErrorZ_clone_ptr(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR arg) {
33541         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
33542         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(arg);
33543         return tag_ptr(ret_conv, true);
33544 }
33545 int64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_clone_ptr"))) TS_CResult_TxOutUtxoLookupErrorZ_clone_ptr(uint64_t arg) {
33546         LDKCResult_TxOutUtxoLookupErrorZ* arg_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(arg);
33547         int64_t ret_conv = CResult_TxOutUtxoLookupErrorZ_clone_ptr(arg_conv);
33548         return ret_conv;
33549 }
33550
33551 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_clone"))) TS_CResult_TxOutUtxoLookupErrorZ_clone(uint64_t orig) {
33552         LDKCResult_TxOutUtxoLookupErrorZ* orig_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(orig);
33553         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
33554         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(orig_conv);
33555         return tag_ptr(ret_conv, true);
33556 }
33557
33558 static inline uint64_t C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone_ptr(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR arg) {
33559         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
33560         *ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(arg);
33561         return tag_ptr(ret_conv, true);
33562 }
33563 int64_t  __attribute__((export_name("TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone_ptr"))) TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone_ptr(uint64_t arg) {
33564         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* arg_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(arg);
33565         int64_t ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone_ptr(arg_conv);
33566         return ret_conv;
33567 }
33568
33569 uint64_t  __attribute__((export_name("TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone"))) TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(uint64_t orig) {
33570         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* orig_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(orig);
33571         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
33572         *ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(orig_conv);
33573         return tag_ptr(ret_conv, true);
33574 }
33575
33576 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) {
33577         LDKPublicKey a_ref;
33578         CHECK(a->arr_len == 33);
33579         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
33580         LDKOnionMessage b_conv;
33581         b_conv.inner = untag_ptr(b);
33582         b_conv.is_owned = ptr_is_owned(b);
33583         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33584         b_conv = OnionMessage_clone(&b_conv);
33585         void* c_ptr = untag_ptr(c);
33586         CHECK_ACCESS(c_ptr);
33587         LDKCOption_CVec_SocketAddressZZ c_conv = *(LDKCOption_CVec_SocketAddressZZ*)(c_ptr);
33588         c_conv = COption_CVec_SocketAddressZZ_clone((LDKCOption_CVec_SocketAddressZZ*)untag_ptr(c));
33589         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
33590         *ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_new(a_ref, b_conv, c_conv);
33591         return tag_ptr(ret_conv, true);
33592 }
33593
33594 void  __attribute__((export_name("TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_free"))) TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_free(uint64_t _res) {
33595         if (!ptr_is_owned(_res)) return;
33596         void* _res_ptr = untag_ptr(_res);
33597         CHECK_ACCESS(_res_ptr);
33598         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ _res_conv = *(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)(_res_ptr);
33599         FREE(untag_ptr(_res));
33600         C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_free(_res_conv);
33601 }
33602
33603 uint64_t  __attribute__((export_name("TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_ok"))) TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_ok(uint64_t o) {
33604         void* o_ptr = untag_ptr(o);
33605         CHECK_ACCESS(o_ptr);
33606         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ o_conv = *(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)(o_ptr);
33607         o_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone((LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(o));
33608         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
33609         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_ok(o_conv);
33610         return tag_ptr(ret_conv, true);
33611 }
33612
33613 uint64_t  __attribute__((export_name("TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_err"))) TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_err(uint64_t e) {
33614         void* e_ptr = untag_ptr(e);
33615         CHECK_ACCESS(e_ptr);
33616         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
33617         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
33618         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
33619         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_err(e_conv);
33620         return tag_ptr(ret_conv, true);
33621 }
33622
33623 jboolean  __attribute__((export_name("TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_is_ok"))) TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_is_ok(uint64_t o) {
33624         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* o_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(o);
33625         jboolean ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_is_ok(o_conv);
33626         return ret_conv;
33627 }
33628
33629 void  __attribute__((export_name("TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_free"))) TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_free(uint64_t _res) {
33630         if (!ptr_is_owned(_res)) return;
33631         void* _res_ptr = untag_ptr(_res);
33632         CHECK_ACCESS(_res_ptr);
33633         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ _res_conv = *(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)(_res_ptr);
33634         FREE(untag_ptr(_res));
33635         CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_free(_res_conv);
33636 }
33637
33638 static inline uint64_t CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone_ptr(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ *NONNULL_PTR arg) {
33639         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
33640         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone(arg);
33641         return tag_ptr(ret_conv, true);
33642 }
33643 int64_t  __attribute__((export_name("TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone_ptr"))) TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone_ptr(uint64_t arg) {
33644         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* arg_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(arg);
33645         int64_t ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone_ptr(arg_conv);
33646         return ret_conv;
33647 }
33648
33649 uint64_t  __attribute__((export_name("TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone"))) TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone(uint64_t orig) {
33650         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* orig_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(orig);
33651         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
33652         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone(orig_conv);
33653         return tag_ptr(ret_conv, true);
33654 }
33655
33656 uint64_t  __attribute__((export_name("TS_CResult_PeeledOnionNoneZ_ok"))) TS_CResult_PeeledOnionNoneZ_ok(uint64_t o) {
33657         void* o_ptr = untag_ptr(o);
33658         CHECK_ACCESS(o_ptr);
33659         LDKPeeledOnion o_conv = *(LDKPeeledOnion*)(o_ptr);
33660         o_conv = PeeledOnion_clone((LDKPeeledOnion*)untag_ptr(o));
33661         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
33662         *ret_conv = CResult_PeeledOnionNoneZ_ok(o_conv);
33663         return tag_ptr(ret_conv, true);
33664 }
33665
33666 uint64_t  __attribute__((export_name("TS_CResult_PeeledOnionNoneZ_err"))) TS_CResult_PeeledOnionNoneZ_err() {
33667         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
33668         *ret_conv = CResult_PeeledOnionNoneZ_err();
33669         return tag_ptr(ret_conv, true);
33670 }
33671
33672 jboolean  __attribute__((export_name("TS_CResult_PeeledOnionNoneZ_is_ok"))) TS_CResult_PeeledOnionNoneZ_is_ok(uint64_t o) {
33673         LDKCResult_PeeledOnionNoneZ* o_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(o);
33674         jboolean ret_conv = CResult_PeeledOnionNoneZ_is_ok(o_conv);
33675         return ret_conv;
33676 }
33677
33678 void  __attribute__((export_name("TS_CResult_PeeledOnionNoneZ_free"))) TS_CResult_PeeledOnionNoneZ_free(uint64_t _res) {
33679         if (!ptr_is_owned(_res)) return;
33680         void* _res_ptr = untag_ptr(_res);
33681         CHECK_ACCESS(_res_ptr);
33682         LDKCResult_PeeledOnionNoneZ _res_conv = *(LDKCResult_PeeledOnionNoneZ*)(_res_ptr);
33683         FREE(untag_ptr(_res));
33684         CResult_PeeledOnionNoneZ_free(_res_conv);
33685 }
33686
33687 static inline uint64_t CResult_PeeledOnionNoneZ_clone_ptr(LDKCResult_PeeledOnionNoneZ *NONNULL_PTR arg) {
33688         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
33689         *ret_conv = CResult_PeeledOnionNoneZ_clone(arg);
33690         return tag_ptr(ret_conv, true);
33691 }
33692 int64_t  __attribute__((export_name("TS_CResult_PeeledOnionNoneZ_clone_ptr"))) TS_CResult_PeeledOnionNoneZ_clone_ptr(uint64_t arg) {
33693         LDKCResult_PeeledOnionNoneZ* arg_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(arg);
33694         int64_t ret_conv = CResult_PeeledOnionNoneZ_clone_ptr(arg_conv);
33695         return ret_conv;
33696 }
33697
33698 uint64_t  __attribute__((export_name("TS_CResult_PeeledOnionNoneZ_clone"))) TS_CResult_PeeledOnionNoneZ_clone(uint64_t orig) {
33699         LDKCResult_PeeledOnionNoneZ* orig_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(orig);
33700         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
33701         *ret_conv = CResult_PeeledOnionNoneZ_clone(orig_conv);
33702         return tag_ptr(ret_conv, true);
33703 }
33704
33705 uint64_t  __attribute__((export_name("TS_CResult_SendSuccessSendErrorZ_ok"))) TS_CResult_SendSuccessSendErrorZ_ok(uint64_t o) {
33706         void* o_ptr = untag_ptr(o);
33707         CHECK_ACCESS(o_ptr);
33708         LDKSendSuccess o_conv = *(LDKSendSuccess*)(o_ptr);
33709         o_conv = SendSuccess_clone((LDKSendSuccess*)untag_ptr(o));
33710         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
33711         *ret_conv = CResult_SendSuccessSendErrorZ_ok(o_conv);
33712         return tag_ptr(ret_conv, true);
33713 }
33714
33715 uint64_t  __attribute__((export_name("TS_CResult_SendSuccessSendErrorZ_err"))) TS_CResult_SendSuccessSendErrorZ_err(uint64_t e) {
33716         void* e_ptr = untag_ptr(e);
33717         CHECK_ACCESS(e_ptr);
33718         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
33719         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
33720         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
33721         *ret_conv = CResult_SendSuccessSendErrorZ_err(e_conv);
33722         return tag_ptr(ret_conv, true);
33723 }
33724
33725 jboolean  __attribute__((export_name("TS_CResult_SendSuccessSendErrorZ_is_ok"))) TS_CResult_SendSuccessSendErrorZ_is_ok(uint64_t o) {
33726         LDKCResult_SendSuccessSendErrorZ* o_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(o);
33727         jboolean ret_conv = CResult_SendSuccessSendErrorZ_is_ok(o_conv);
33728         return ret_conv;
33729 }
33730
33731 void  __attribute__((export_name("TS_CResult_SendSuccessSendErrorZ_free"))) TS_CResult_SendSuccessSendErrorZ_free(uint64_t _res) {
33732         if (!ptr_is_owned(_res)) return;
33733         void* _res_ptr = untag_ptr(_res);
33734         CHECK_ACCESS(_res_ptr);
33735         LDKCResult_SendSuccessSendErrorZ _res_conv = *(LDKCResult_SendSuccessSendErrorZ*)(_res_ptr);
33736         FREE(untag_ptr(_res));
33737         CResult_SendSuccessSendErrorZ_free(_res_conv);
33738 }
33739
33740 static inline uint64_t CResult_SendSuccessSendErrorZ_clone_ptr(LDKCResult_SendSuccessSendErrorZ *NONNULL_PTR arg) {
33741         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
33742         *ret_conv = CResult_SendSuccessSendErrorZ_clone(arg);
33743         return tag_ptr(ret_conv, true);
33744 }
33745 int64_t  __attribute__((export_name("TS_CResult_SendSuccessSendErrorZ_clone_ptr"))) TS_CResult_SendSuccessSendErrorZ_clone_ptr(uint64_t arg) {
33746         LDKCResult_SendSuccessSendErrorZ* arg_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(arg);
33747         int64_t ret_conv = CResult_SendSuccessSendErrorZ_clone_ptr(arg_conv);
33748         return ret_conv;
33749 }
33750
33751 uint64_t  __attribute__((export_name("TS_CResult_SendSuccessSendErrorZ_clone"))) TS_CResult_SendSuccessSendErrorZ_clone(uint64_t orig) {
33752         LDKCResult_SendSuccessSendErrorZ* orig_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(orig);
33753         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
33754         *ret_conv = CResult_SendSuccessSendErrorZ_clone(orig_conv);
33755         return tag_ptr(ret_conv, true);
33756 }
33757
33758 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_ok"))) TS_CResult_BlindedPathNoneZ_ok(uint64_t o) {
33759         LDKBlindedPath o_conv;
33760         o_conv.inner = untag_ptr(o);
33761         o_conv.is_owned = ptr_is_owned(o);
33762         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33763         o_conv = BlindedPath_clone(&o_conv);
33764         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
33765         *ret_conv = CResult_BlindedPathNoneZ_ok(o_conv);
33766         return tag_ptr(ret_conv, true);
33767 }
33768
33769 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_err"))) TS_CResult_BlindedPathNoneZ_err() {
33770         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
33771         *ret_conv = CResult_BlindedPathNoneZ_err();
33772         return tag_ptr(ret_conv, true);
33773 }
33774
33775 jboolean  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_is_ok"))) TS_CResult_BlindedPathNoneZ_is_ok(uint64_t o) {
33776         LDKCResult_BlindedPathNoneZ* o_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(o);
33777         jboolean ret_conv = CResult_BlindedPathNoneZ_is_ok(o_conv);
33778         return ret_conv;
33779 }
33780
33781 void  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_free"))) TS_CResult_BlindedPathNoneZ_free(uint64_t _res) {
33782         if (!ptr_is_owned(_res)) return;
33783         void* _res_ptr = untag_ptr(_res);
33784         CHECK_ACCESS(_res_ptr);
33785         LDKCResult_BlindedPathNoneZ _res_conv = *(LDKCResult_BlindedPathNoneZ*)(_res_ptr);
33786         FREE(untag_ptr(_res));
33787         CResult_BlindedPathNoneZ_free(_res_conv);
33788 }
33789
33790 static inline uint64_t CResult_BlindedPathNoneZ_clone_ptr(LDKCResult_BlindedPathNoneZ *NONNULL_PTR arg) {
33791         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
33792         *ret_conv = CResult_BlindedPathNoneZ_clone(arg);
33793         return tag_ptr(ret_conv, true);
33794 }
33795 int64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_clone_ptr"))) TS_CResult_BlindedPathNoneZ_clone_ptr(uint64_t arg) {
33796         LDKCResult_BlindedPathNoneZ* arg_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(arg);
33797         int64_t ret_conv = CResult_BlindedPathNoneZ_clone_ptr(arg_conv);
33798         return ret_conv;
33799 }
33800
33801 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_clone"))) TS_CResult_BlindedPathNoneZ_clone(uint64_t orig) {
33802         LDKCResult_BlindedPathNoneZ* orig_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(orig);
33803         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
33804         *ret_conv = CResult_BlindedPathNoneZ_clone(orig_conv);
33805         return tag_ptr(ret_conv, true);
33806 }
33807
33808 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok(uint64_t o) {
33809         void* o_ptr = untag_ptr(o);
33810         CHECK_ACCESS(o_ptr);
33811         LDKC2Tuple_BlindedPayInfoBlindedPathZ o_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(o_ptr);
33812         o_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(o));
33813         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
33814         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok(o_conv);
33815         return tag_ptr(ret_conv, true);
33816 }
33817
33818 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err() {
33819         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
33820         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err();
33821         return tag_ptr(ret_conv, true);
33822 }
33823
33824 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok(uint64_t o) {
33825         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* o_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(o);
33826         jboolean ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok(o_conv);
33827         return ret_conv;
33828 }
33829
33830 void  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(uint64_t _res) {
33831         if (!ptr_is_owned(_res)) return;
33832         void* _res_ptr = untag_ptr(_res);
33833         CHECK_ACCESS(_res_ptr);
33834         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ _res_conv = *(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)(_res_ptr);
33835         FREE(untag_ptr(_res));
33836         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(_res_conv);
33837 }
33838
33839 static inline uint64_t CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR arg) {
33840         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
33841         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(arg);
33842         return tag_ptr(ret_conv, true);
33843 }
33844 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(uint64_t arg) {
33845         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* arg_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(arg);
33846         int64_t ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(arg_conv);
33847         return ret_conv;
33848 }
33849
33850 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(uint64_t orig) {
33851         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* orig_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(orig);
33852         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
33853         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(orig_conv);
33854         return tag_ptr(ret_conv, true);
33855 }
33856
33857 void  __attribute__((export_name("TS_CVec_ForwardNodeZ_free"))) TS_CVec_ForwardNodeZ_free(uint64_tArray _res) {
33858         LDKCVec_ForwardNodeZ _res_constr;
33859         _res_constr.datalen = _res->arr_len;
33860         if (_res_constr.datalen > 0)
33861                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKForwardNode), "LDKCVec_ForwardNodeZ Elements");
33862         else
33863                 _res_constr.data = NULL;
33864         uint64_t* _res_vals = _res->elems;
33865         for (size_t n = 0; n < _res_constr.datalen; n++) {
33866                 uint64_t _res_conv_13 = _res_vals[n];
33867                 LDKForwardNode _res_conv_13_conv;
33868                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
33869                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
33870                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
33871                 _res_constr.data[n] = _res_conv_13_conv;
33872         }
33873         FREE(_res);
33874         CVec_ForwardNodeZ_free(_res_constr);
33875 }
33876
33877 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_ok"))) TS_CResult_BlindedPathDecodeErrorZ_ok(uint64_t o) {
33878         LDKBlindedPath o_conv;
33879         o_conv.inner = untag_ptr(o);
33880         o_conv.is_owned = ptr_is_owned(o);
33881         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33882         o_conv = BlindedPath_clone(&o_conv);
33883         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
33884         *ret_conv = CResult_BlindedPathDecodeErrorZ_ok(o_conv);
33885         return tag_ptr(ret_conv, true);
33886 }
33887
33888 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_err"))) TS_CResult_BlindedPathDecodeErrorZ_err(uint64_t e) {
33889         void* e_ptr = untag_ptr(e);
33890         CHECK_ACCESS(e_ptr);
33891         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33892         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33893         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
33894         *ret_conv = CResult_BlindedPathDecodeErrorZ_err(e_conv);
33895         return tag_ptr(ret_conv, true);
33896 }
33897
33898 jboolean  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_is_ok"))) TS_CResult_BlindedPathDecodeErrorZ_is_ok(uint64_t o) {
33899         LDKCResult_BlindedPathDecodeErrorZ* o_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(o);
33900         jboolean ret_conv = CResult_BlindedPathDecodeErrorZ_is_ok(o_conv);
33901         return ret_conv;
33902 }
33903
33904 void  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_free"))) TS_CResult_BlindedPathDecodeErrorZ_free(uint64_t _res) {
33905         if (!ptr_is_owned(_res)) return;
33906         void* _res_ptr = untag_ptr(_res);
33907         CHECK_ACCESS(_res_ptr);
33908         LDKCResult_BlindedPathDecodeErrorZ _res_conv = *(LDKCResult_BlindedPathDecodeErrorZ*)(_res_ptr);
33909         FREE(untag_ptr(_res));
33910         CResult_BlindedPathDecodeErrorZ_free(_res_conv);
33911 }
33912
33913 static inline uint64_t CResult_BlindedPathDecodeErrorZ_clone_ptr(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR arg) {
33914         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
33915         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(arg);
33916         return tag_ptr(ret_conv, true);
33917 }
33918 int64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedPathDecodeErrorZ_clone_ptr(uint64_t arg) {
33919         LDKCResult_BlindedPathDecodeErrorZ* arg_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(arg);
33920         int64_t ret_conv = CResult_BlindedPathDecodeErrorZ_clone_ptr(arg_conv);
33921         return ret_conv;
33922 }
33923
33924 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_clone"))) TS_CResult_BlindedPathDecodeErrorZ_clone(uint64_t orig) {
33925         LDKCResult_BlindedPathDecodeErrorZ* orig_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(orig);
33926         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
33927         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(orig_conv);
33928         return tag_ptr(ret_conv, true);
33929 }
33930
33931 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_ok"))) TS_CResult_BlindedHopDecodeErrorZ_ok(uint64_t o) {
33932         LDKBlindedHop o_conv;
33933         o_conv.inner = untag_ptr(o);
33934         o_conv.is_owned = ptr_is_owned(o);
33935         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33936         o_conv = BlindedHop_clone(&o_conv);
33937         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
33938         *ret_conv = CResult_BlindedHopDecodeErrorZ_ok(o_conv);
33939         return tag_ptr(ret_conv, true);
33940 }
33941
33942 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_err"))) TS_CResult_BlindedHopDecodeErrorZ_err(uint64_t e) {
33943         void* e_ptr = untag_ptr(e);
33944         CHECK_ACCESS(e_ptr);
33945         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33946         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33947         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
33948         *ret_conv = CResult_BlindedHopDecodeErrorZ_err(e_conv);
33949         return tag_ptr(ret_conv, true);
33950 }
33951
33952 jboolean  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_is_ok"))) TS_CResult_BlindedHopDecodeErrorZ_is_ok(uint64_t o) {
33953         LDKCResult_BlindedHopDecodeErrorZ* o_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(o);
33954         jboolean ret_conv = CResult_BlindedHopDecodeErrorZ_is_ok(o_conv);
33955         return ret_conv;
33956 }
33957
33958 void  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_free"))) TS_CResult_BlindedHopDecodeErrorZ_free(uint64_t _res) {
33959         if (!ptr_is_owned(_res)) return;
33960         void* _res_ptr = untag_ptr(_res);
33961         CHECK_ACCESS(_res_ptr);
33962         LDKCResult_BlindedHopDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopDecodeErrorZ*)(_res_ptr);
33963         FREE(untag_ptr(_res));
33964         CResult_BlindedHopDecodeErrorZ_free(_res_conv);
33965 }
33966
33967 static inline uint64_t CResult_BlindedHopDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR arg) {
33968         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
33969         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(arg);
33970         return tag_ptr(ret_conv, true);
33971 }
33972 int64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedHopDecodeErrorZ_clone_ptr(uint64_t arg) {
33973         LDKCResult_BlindedHopDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(arg);
33974         int64_t ret_conv = CResult_BlindedHopDecodeErrorZ_clone_ptr(arg_conv);
33975         return ret_conv;
33976 }
33977
33978 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_clone"))) TS_CResult_BlindedHopDecodeErrorZ_clone(uint64_t orig) {
33979         LDKCResult_BlindedHopDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(orig);
33980         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
33981         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(orig_conv);
33982         return tag_ptr(ret_conv, true);
33983 }
33984
33985 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_ok"))) TS_CResult_InvoiceErrorDecodeErrorZ_ok(uint64_t o) {
33986         LDKInvoiceError o_conv;
33987         o_conv.inner = untag_ptr(o);
33988         o_conv.is_owned = ptr_is_owned(o);
33989         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33990         o_conv = InvoiceError_clone(&o_conv);
33991         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
33992         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_ok(o_conv);
33993         return tag_ptr(ret_conv, true);
33994 }
33995
33996 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_err"))) TS_CResult_InvoiceErrorDecodeErrorZ_err(uint64_t e) {
33997         void* e_ptr = untag_ptr(e);
33998         CHECK_ACCESS(e_ptr);
33999         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34000         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34001         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
34002         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_err(e_conv);
34003         return tag_ptr(ret_conv, true);
34004 }
34005
34006 jboolean  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_is_ok"))) TS_CResult_InvoiceErrorDecodeErrorZ_is_ok(uint64_t o) {
34007         LDKCResult_InvoiceErrorDecodeErrorZ* o_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(o);
34008         jboolean ret_conv = CResult_InvoiceErrorDecodeErrorZ_is_ok(o_conv);
34009         return ret_conv;
34010 }
34011
34012 void  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_free"))) TS_CResult_InvoiceErrorDecodeErrorZ_free(uint64_t _res) {
34013         if (!ptr_is_owned(_res)) return;
34014         void* _res_ptr = untag_ptr(_res);
34015         CHECK_ACCESS(_res_ptr);
34016         LDKCResult_InvoiceErrorDecodeErrorZ _res_conv = *(LDKCResult_InvoiceErrorDecodeErrorZ*)(_res_ptr);
34017         FREE(untag_ptr(_res));
34018         CResult_InvoiceErrorDecodeErrorZ_free(_res_conv);
34019 }
34020
34021 static inline uint64_t CResult_InvoiceErrorDecodeErrorZ_clone_ptr(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR arg) {
34022         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
34023         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone(arg);
34024         return tag_ptr(ret_conv, true);
34025 }
34026 int64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_clone_ptr"))) TS_CResult_InvoiceErrorDecodeErrorZ_clone_ptr(uint64_t arg) {
34027         LDKCResult_InvoiceErrorDecodeErrorZ* arg_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(arg);
34028         int64_t ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone_ptr(arg_conv);
34029         return ret_conv;
34030 }
34031
34032 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_clone"))) TS_CResult_InvoiceErrorDecodeErrorZ_clone(uint64_t orig) {
34033         LDKCResult_InvoiceErrorDecodeErrorZ* orig_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(orig);
34034         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
34035         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone(orig_conv);
34036         return tag_ptr(ret_conv, true);
34037 }
34038
34039 uint64_t  __attribute__((export_name("TS_CResult_TrackedSpendableOutputDecodeErrorZ_ok"))) TS_CResult_TrackedSpendableOutputDecodeErrorZ_ok(uint64_t o) {
34040         LDKTrackedSpendableOutput o_conv;
34041         o_conv.inner = untag_ptr(o);
34042         o_conv.is_owned = ptr_is_owned(o);
34043         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34044         o_conv = TrackedSpendableOutput_clone(&o_conv);
34045         LDKCResult_TrackedSpendableOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TrackedSpendableOutputDecodeErrorZ), "LDKCResult_TrackedSpendableOutputDecodeErrorZ");
34046         *ret_conv = CResult_TrackedSpendableOutputDecodeErrorZ_ok(o_conv);
34047         return tag_ptr(ret_conv, true);
34048 }
34049
34050 uint64_t  __attribute__((export_name("TS_CResult_TrackedSpendableOutputDecodeErrorZ_err"))) TS_CResult_TrackedSpendableOutputDecodeErrorZ_err(uint64_t e) {
34051         void* e_ptr = untag_ptr(e);
34052         CHECK_ACCESS(e_ptr);
34053         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34054         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34055         LDKCResult_TrackedSpendableOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TrackedSpendableOutputDecodeErrorZ), "LDKCResult_TrackedSpendableOutputDecodeErrorZ");
34056         *ret_conv = CResult_TrackedSpendableOutputDecodeErrorZ_err(e_conv);
34057         return tag_ptr(ret_conv, true);
34058 }
34059
34060 jboolean  __attribute__((export_name("TS_CResult_TrackedSpendableOutputDecodeErrorZ_is_ok"))) TS_CResult_TrackedSpendableOutputDecodeErrorZ_is_ok(uint64_t o) {
34061         LDKCResult_TrackedSpendableOutputDecodeErrorZ* o_conv = (LDKCResult_TrackedSpendableOutputDecodeErrorZ*)untag_ptr(o);
34062         jboolean ret_conv = CResult_TrackedSpendableOutputDecodeErrorZ_is_ok(o_conv);
34063         return ret_conv;
34064 }
34065
34066 void  __attribute__((export_name("TS_CResult_TrackedSpendableOutputDecodeErrorZ_free"))) TS_CResult_TrackedSpendableOutputDecodeErrorZ_free(uint64_t _res) {
34067         if (!ptr_is_owned(_res)) return;
34068         void* _res_ptr = untag_ptr(_res);
34069         CHECK_ACCESS(_res_ptr);
34070         LDKCResult_TrackedSpendableOutputDecodeErrorZ _res_conv = *(LDKCResult_TrackedSpendableOutputDecodeErrorZ*)(_res_ptr);
34071         FREE(untag_ptr(_res));
34072         CResult_TrackedSpendableOutputDecodeErrorZ_free(_res_conv);
34073 }
34074
34075 static inline uint64_t CResult_TrackedSpendableOutputDecodeErrorZ_clone_ptr(LDKCResult_TrackedSpendableOutputDecodeErrorZ *NONNULL_PTR arg) {
34076         LDKCResult_TrackedSpendableOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TrackedSpendableOutputDecodeErrorZ), "LDKCResult_TrackedSpendableOutputDecodeErrorZ");
34077         *ret_conv = CResult_TrackedSpendableOutputDecodeErrorZ_clone(arg);
34078         return tag_ptr(ret_conv, true);
34079 }
34080 int64_t  __attribute__((export_name("TS_CResult_TrackedSpendableOutputDecodeErrorZ_clone_ptr"))) TS_CResult_TrackedSpendableOutputDecodeErrorZ_clone_ptr(uint64_t arg) {
34081         LDKCResult_TrackedSpendableOutputDecodeErrorZ* arg_conv = (LDKCResult_TrackedSpendableOutputDecodeErrorZ*)untag_ptr(arg);
34082         int64_t ret_conv = CResult_TrackedSpendableOutputDecodeErrorZ_clone_ptr(arg_conv);
34083         return ret_conv;
34084 }
34085
34086 uint64_t  __attribute__((export_name("TS_CResult_TrackedSpendableOutputDecodeErrorZ_clone"))) TS_CResult_TrackedSpendableOutputDecodeErrorZ_clone(uint64_t orig) {
34087         LDKCResult_TrackedSpendableOutputDecodeErrorZ* orig_conv = (LDKCResult_TrackedSpendableOutputDecodeErrorZ*)untag_ptr(orig);
34088         LDKCResult_TrackedSpendableOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TrackedSpendableOutputDecodeErrorZ), "LDKCResult_TrackedSpendableOutputDecodeErrorZ");
34089         *ret_conv = CResult_TrackedSpendableOutputDecodeErrorZ_clone(orig_conv);
34090         return tag_ptr(ret_conv, true);
34091 }
34092
34093 uint64_t  __attribute__((export_name("TS_CResult_OutputSpendStatusDecodeErrorZ_ok"))) TS_CResult_OutputSpendStatusDecodeErrorZ_ok(uint64_t o) {
34094         void* o_ptr = untag_ptr(o);
34095         CHECK_ACCESS(o_ptr);
34096         LDKOutputSpendStatus o_conv = *(LDKOutputSpendStatus*)(o_ptr);
34097         o_conv = OutputSpendStatus_clone((LDKOutputSpendStatus*)untag_ptr(o));
34098         LDKCResult_OutputSpendStatusDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSpendStatusDecodeErrorZ), "LDKCResult_OutputSpendStatusDecodeErrorZ");
34099         *ret_conv = CResult_OutputSpendStatusDecodeErrorZ_ok(o_conv);
34100         return tag_ptr(ret_conv, true);
34101 }
34102
34103 uint64_t  __attribute__((export_name("TS_CResult_OutputSpendStatusDecodeErrorZ_err"))) TS_CResult_OutputSpendStatusDecodeErrorZ_err(uint64_t e) {
34104         void* e_ptr = untag_ptr(e);
34105         CHECK_ACCESS(e_ptr);
34106         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34107         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34108         LDKCResult_OutputSpendStatusDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSpendStatusDecodeErrorZ), "LDKCResult_OutputSpendStatusDecodeErrorZ");
34109         *ret_conv = CResult_OutputSpendStatusDecodeErrorZ_err(e_conv);
34110         return tag_ptr(ret_conv, true);
34111 }
34112
34113 jboolean  __attribute__((export_name("TS_CResult_OutputSpendStatusDecodeErrorZ_is_ok"))) TS_CResult_OutputSpendStatusDecodeErrorZ_is_ok(uint64_t o) {
34114         LDKCResult_OutputSpendStatusDecodeErrorZ* o_conv = (LDKCResult_OutputSpendStatusDecodeErrorZ*)untag_ptr(o);
34115         jboolean ret_conv = CResult_OutputSpendStatusDecodeErrorZ_is_ok(o_conv);
34116         return ret_conv;
34117 }
34118
34119 void  __attribute__((export_name("TS_CResult_OutputSpendStatusDecodeErrorZ_free"))) TS_CResult_OutputSpendStatusDecodeErrorZ_free(uint64_t _res) {
34120         if (!ptr_is_owned(_res)) return;
34121         void* _res_ptr = untag_ptr(_res);
34122         CHECK_ACCESS(_res_ptr);
34123         LDKCResult_OutputSpendStatusDecodeErrorZ _res_conv = *(LDKCResult_OutputSpendStatusDecodeErrorZ*)(_res_ptr);
34124         FREE(untag_ptr(_res));
34125         CResult_OutputSpendStatusDecodeErrorZ_free(_res_conv);
34126 }
34127
34128 static inline uint64_t CResult_OutputSpendStatusDecodeErrorZ_clone_ptr(LDKCResult_OutputSpendStatusDecodeErrorZ *NONNULL_PTR arg) {
34129         LDKCResult_OutputSpendStatusDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSpendStatusDecodeErrorZ), "LDKCResult_OutputSpendStatusDecodeErrorZ");
34130         *ret_conv = CResult_OutputSpendStatusDecodeErrorZ_clone(arg);
34131         return tag_ptr(ret_conv, true);
34132 }
34133 int64_t  __attribute__((export_name("TS_CResult_OutputSpendStatusDecodeErrorZ_clone_ptr"))) TS_CResult_OutputSpendStatusDecodeErrorZ_clone_ptr(uint64_t arg) {
34134         LDKCResult_OutputSpendStatusDecodeErrorZ* arg_conv = (LDKCResult_OutputSpendStatusDecodeErrorZ*)untag_ptr(arg);
34135         int64_t ret_conv = CResult_OutputSpendStatusDecodeErrorZ_clone_ptr(arg_conv);
34136         return ret_conv;
34137 }
34138
34139 uint64_t  __attribute__((export_name("TS_CResult_OutputSpendStatusDecodeErrorZ_clone"))) TS_CResult_OutputSpendStatusDecodeErrorZ_clone(uint64_t orig) {
34140         LDKCResult_OutputSpendStatusDecodeErrorZ* orig_conv = (LDKCResult_OutputSpendStatusDecodeErrorZ*)untag_ptr(orig);
34141         LDKCResult_OutputSpendStatusDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSpendStatusDecodeErrorZ), "LDKCResult_OutputSpendStatusDecodeErrorZ");
34142         *ret_conv = CResult_OutputSpendStatusDecodeErrorZ_clone(orig_conv);
34143         return tag_ptr(ret_conv, true);
34144 }
34145
34146 uint64_t  __attribute__((export_name("TS_COption_FilterZ_some"))) TS_COption_FilterZ_some(uint64_t o) {
34147         void* o_ptr = untag_ptr(o);
34148         CHECK_ACCESS(o_ptr);
34149         LDKFilter o_conv = *(LDKFilter*)(o_ptr);
34150         if (o_conv.free == LDKFilter_JCalls_free) {
34151                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34152                 LDKFilter_JCalls_cloned(&o_conv);
34153         }
34154         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
34155         *ret_copy = COption_FilterZ_some(o_conv);
34156         uint64_t ret_ref = tag_ptr(ret_copy, true);
34157         return ret_ref;
34158 }
34159
34160 uint64_t  __attribute__((export_name("TS_COption_FilterZ_none"))) TS_COption_FilterZ_none() {
34161         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
34162         *ret_copy = COption_FilterZ_none();
34163         uint64_t ret_ref = tag_ptr(ret_copy, true);
34164         return ret_ref;
34165 }
34166
34167 void  __attribute__((export_name("TS_COption_FilterZ_free"))) TS_COption_FilterZ_free(uint64_t _res) {
34168         if (!ptr_is_owned(_res)) return;
34169         void* _res_ptr = untag_ptr(_res);
34170         CHECK_ACCESS(_res_ptr);
34171         LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
34172         FREE(untag_ptr(_res));
34173         COption_FilterZ_free(_res_conv);
34174 }
34175
34176 void  __attribute__((export_name("TS_CVec_TrackedSpendableOutputZ_free"))) TS_CVec_TrackedSpendableOutputZ_free(uint64_tArray _res) {
34177         LDKCVec_TrackedSpendableOutputZ _res_constr;
34178         _res_constr.datalen = _res->arr_len;
34179         if (_res_constr.datalen > 0)
34180                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTrackedSpendableOutput), "LDKCVec_TrackedSpendableOutputZ Elements");
34181         else
34182                 _res_constr.data = NULL;
34183         uint64_t* _res_vals = _res->elems;
34184         for (size_t y = 0; y < _res_constr.datalen; y++) {
34185                 uint64_t _res_conv_24 = _res_vals[y];
34186                 LDKTrackedSpendableOutput _res_conv_24_conv;
34187                 _res_conv_24_conv.inner = untag_ptr(_res_conv_24);
34188                 _res_conv_24_conv.is_owned = ptr_is_owned(_res_conv_24);
34189                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_24_conv);
34190                 _res_constr.data[y] = _res_conv_24_conv;
34191         }
34192         FREE(_res);
34193         CVec_TrackedSpendableOutputZ_free(_res_constr);
34194 }
34195
34196 uint64_t  __attribute__((export_name("TS_CResult_OutputSweeperDecodeErrorZ_ok"))) TS_CResult_OutputSweeperDecodeErrorZ_ok(uint64_t o) {
34197         LDKOutputSweeper o_conv;
34198         o_conv.inner = untag_ptr(o);
34199         o_conv.is_owned = ptr_is_owned(o);
34200         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34201         // WARNING: we need a move here but no clone is available for LDKOutputSweeper
34202         
34203         LDKCResult_OutputSweeperDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSweeperDecodeErrorZ), "LDKCResult_OutputSweeperDecodeErrorZ");
34204         *ret_conv = CResult_OutputSweeperDecodeErrorZ_ok(o_conv);
34205         return tag_ptr(ret_conv, true);
34206 }
34207
34208 uint64_t  __attribute__((export_name("TS_CResult_OutputSweeperDecodeErrorZ_err"))) TS_CResult_OutputSweeperDecodeErrorZ_err(uint64_t e) {
34209         void* e_ptr = untag_ptr(e);
34210         CHECK_ACCESS(e_ptr);
34211         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34212         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34213         LDKCResult_OutputSweeperDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSweeperDecodeErrorZ), "LDKCResult_OutputSweeperDecodeErrorZ");
34214         *ret_conv = CResult_OutputSweeperDecodeErrorZ_err(e_conv);
34215         return tag_ptr(ret_conv, true);
34216 }
34217
34218 jboolean  __attribute__((export_name("TS_CResult_OutputSweeperDecodeErrorZ_is_ok"))) TS_CResult_OutputSweeperDecodeErrorZ_is_ok(uint64_t o) {
34219         LDKCResult_OutputSweeperDecodeErrorZ* o_conv = (LDKCResult_OutputSweeperDecodeErrorZ*)untag_ptr(o);
34220         jboolean ret_conv = CResult_OutputSweeperDecodeErrorZ_is_ok(o_conv);
34221         return ret_conv;
34222 }
34223
34224 void  __attribute__((export_name("TS_CResult_OutputSweeperDecodeErrorZ_free"))) TS_CResult_OutputSweeperDecodeErrorZ_free(uint64_t _res) {
34225         if (!ptr_is_owned(_res)) return;
34226         void* _res_ptr = untag_ptr(_res);
34227         CHECK_ACCESS(_res_ptr);
34228         LDKCResult_OutputSweeperDecodeErrorZ _res_conv = *(LDKCResult_OutputSweeperDecodeErrorZ*)(_res_ptr);
34229         FREE(untag_ptr(_res));
34230         CResult_OutputSweeperDecodeErrorZ_free(_res_conv);
34231 }
34232
34233 uint64_t  __attribute__((export_name("TS_C2Tuple_BestBlockOutputSweeperZ_new"))) TS_C2Tuple_BestBlockOutputSweeperZ_new(uint64_t a, uint64_t b) {
34234         LDKBestBlock a_conv;
34235         a_conv.inner = untag_ptr(a);
34236         a_conv.is_owned = ptr_is_owned(a);
34237         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34238         a_conv = BestBlock_clone(&a_conv);
34239         LDKOutputSweeper b_conv;
34240         b_conv.inner = untag_ptr(b);
34241         b_conv.is_owned = ptr_is_owned(b);
34242         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34243         // WARNING: we need a move here but no clone is available for LDKOutputSweeper
34244         
34245         LDKC2Tuple_BestBlockOutputSweeperZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BestBlockOutputSweeperZ), "LDKC2Tuple_BestBlockOutputSweeperZ");
34246         *ret_conv = C2Tuple_BestBlockOutputSweeperZ_new(a_conv, b_conv);
34247         return tag_ptr(ret_conv, true);
34248 }
34249
34250 void  __attribute__((export_name("TS_C2Tuple_BestBlockOutputSweeperZ_free"))) TS_C2Tuple_BestBlockOutputSweeperZ_free(uint64_t _res) {
34251         if (!ptr_is_owned(_res)) return;
34252         void* _res_ptr = untag_ptr(_res);
34253         CHECK_ACCESS(_res_ptr);
34254         LDKC2Tuple_BestBlockOutputSweeperZ _res_conv = *(LDKC2Tuple_BestBlockOutputSweeperZ*)(_res_ptr);
34255         FREE(untag_ptr(_res));
34256         C2Tuple_BestBlockOutputSweeperZ_free(_res_conv);
34257 }
34258
34259 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_ok(uint64_t o) {
34260         void* o_ptr = untag_ptr(o);
34261         CHECK_ACCESS(o_ptr);
34262         LDKC2Tuple_BestBlockOutputSweeperZ o_conv = *(LDKC2Tuple_BestBlockOutputSweeperZ*)(o_ptr);
34263         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_BestBlockOutputSweeperZ
34264         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ), "LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ");
34265         *ret_conv = CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_ok(o_conv);
34266         return tag_ptr(ret_conv, true);
34267 }
34268
34269 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_err"))) TS_CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_err(uint64_t e) {
34270         void* e_ptr = untag_ptr(e);
34271         CHECK_ACCESS(e_ptr);
34272         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34273         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34274         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ), "LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ");
34275         *ret_conv = CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_err(e_conv);
34276         return tag_ptr(ret_conv, true);
34277 }
34278
34279 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_is_ok(uint64_t o) {
34280         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ*)untag_ptr(o);
34281         jboolean ret_conv = CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_is_ok(o_conv);
34282         return ret_conv;
34283 }
34284
34285 void  __attribute__((export_name("TS_CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_free"))) TS_CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_free(uint64_t _res) {
34286         if (!ptr_is_owned(_res)) return;
34287         void* _res_ptr = untag_ptr(_res);
34288         CHECK_ACCESS(_res_ptr);
34289         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ*)(_res_ptr);
34290         FREE(untag_ptr(_res));
34291         CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_free(_res_conv);
34292 }
34293
34294 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentBasepointDecodeErrorZ_ok"))) TS_CResult_DelayedPaymentBasepointDecodeErrorZ_ok(uint64_t o) {
34295         LDKDelayedPaymentBasepoint o_conv;
34296         o_conv.inner = untag_ptr(o);
34297         o_conv.is_owned = ptr_is_owned(o);
34298         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34299         o_conv = DelayedPaymentBasepoint_clone(&o_conv);
34300         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
34301         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_ok(o_conv);
34302         return tag_ptr(ret_conv, true);
34303 }
34304
34305 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentBasepointDecodeErrorZ_err"))) TS_CResult_DelayedPaymentBasepointDecodeErrorZ_err(uint64_t e) {
34306         void* e_ptr = untag_ptr(e);
34307         CHECK_ACCESS(e_ptr);
34308         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34309         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34310         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
34311         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_err(e_conv);
34312         return tag_ptr(ret_conv, true);
34313 }
34314
34315 jboolean  __attribute__((export_name("TS_CResult_DelayedPaymentBasepointDecodeErrorZ_is_ok"))) TS_CResult_DelayedPaymentBasepointDecodeErrorZ_is_ok(uint64_t o) {
34316         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(o);
34317         jboolean ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_is_ok(o_conv);
34318         return ret_conv;
34319 }
34320
34321 void  __attribute__((export_name("TS_CResult_DelayedPaymentBasepointDecodeErrorZ_free"))) TS_CResult_DelayedPaymentBasepointDecodeErrorZ_free(uint64_t _res) {
34322         if (!ptr_is_owned(_res)) return;
34323         void* _res_ptr = untag_ptr(_res);
34324         CHECK_ACCESS(_res_ptr);
34325         LDKCResult_DelayedPaymentBasepointDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)(_res_ptr);
34326         FREE(untag_ptr(_res));
34327         CResult_DelayedPaymentBasepointDecodeErrorZ_free(_res_conv);
34328 }
34329
34330 static inline uint64_t CResult_DelayedPaymentBasepointDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentBasepointDecodeErrorZ *NONNULL_PTR arg) {
34331         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
34332         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_clone(arg);
34333         return tag_ptr(ret_conv, true);
34334 }
34335 int64_t  __attribute__((export_name("TS_CResult_DelayedPaymentBasepointDecodeErrorZ_clone_ptr"))) TS_CResult_DelayedPaymentBasepointDecodeErrorZ_clone_ptr(uint64_t arg) {
34336         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(arg);
34337         int64_t ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_clone_ptr(arg_conv);
34338         return ret_conv;
34339 }
34340
34341 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentBasepointDecodeErrorZ_clone"))) TS_CResult_DelayedPaymentBasepointDecodeErrorZ_clone(uint64_t orig) {
34342         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(orig);
34343         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
34344         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_clone(orig_conv);
34345         return tag_ptr(ret_conv, true);
34346 }
34347
34348 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentKeyDecodeErrorZ_ok"))) TS_CResult_DelayedPaymentKeyDecodeErrorZ_ok(uint64_t o) {
34349         LDKDelayedPaymentKey o_conv;
34350         o_conv.inner = untag_ptr(o);
34351         o_conv.is_owned = ptr_is_owned(o);
34352         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34353         o_conv = DelayedPaymentKey_clone(&o_conv);
34354         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
34355         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_ok(o_conv);
34356         return tag_ptr(ret_conv, true);
34357 }
34358
34359 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentKeyDecodeErrorZ_err"))) TS_CResult_DelayedPaymentKeyDecodeErrorZ_err(uint64_t e) {
34360         void* e_ptr = untag_ptr(e);
34361         CHECK_ACCESS(e_ptr);
34362         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34363         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34364         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
34365         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_err(e_conv);
34366         return tag_ptr(ret_conv, true);
34367 }
34368
34369 jboolean  __attribute__((export_name("TS_CResult_DelayedPaymentKeyDecodeErrorZ_is_ok"))) TS_CResult_DelayedPaymentKeyDecodeErrorZ_is_ok(uint64_t o) {
34370         LDKCResult_DelayedPaymentKeyDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(o);
34371         jboolean ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_is_ok(o_conv);
34372         return ret_conv;
34373 }
34374
34375 void  __attribute__((export_name("TS_CResult_DelayedPaymentKeyDecodeErrorZ_free"))) TS_CResult_DelayedPaymentKeyDecodeErrorZ_free(uint64_t _res) {
34376         if (!ptr_is_owned(_res)) return;
34377         void* _res_ptr = untag_ptr(_res);
34378         CHECK_ACCESS(_res_ptr);
34379         LDKCResult_DelayedPaymentKeyDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentKeyDecodeErrorZ*)(_res_ptr);
34380         FREE(untag_ptr(_res));
34381         CResult_DelayedPaymentKeyDecodeErrorZ_free(_res_conv);
34382 }
34383
34384 static inline uint64_t CResult_DelayedPaymentKeyDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentKeyDecodeErrorZ *NONNULL_PTR arg) {
34385         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
34386         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_clone(arg);
34387         return tag_ptr(ret_conv, true);
34388 }
34389 int64_t  __attribute__((export_name("TS_CResult_DelayedPaymentKeyDecodeErrorZ_clone_ptr"))) TS_CResult_DelayedPaymentKeyDecodeErrorZ_clone_ptr(uint64_t arg) {
34390         LDKCResult_DelayedPaymentKeyDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(arg);
34391         int64_t ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_clone_ptr(arg_conv);
34392         return ret_conv;
34393 }
34394
34395 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentKeyDecodeErrorZ_clone"))) TS_CResult_DelayedPaymentKeyDecodeErrorZ_clone(uint64_t orig) {
34396         LDKCResult_DelayedPaymentKeyDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(orig);
34397         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
34398         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_clone(orig_conv);
34399         return tag_ptr(ret_conv, true);
34400 }
34401
34402 uint64_t  __attribute__((export_name("TS_CResult_HtlcBasepointDecodeErrorZ_ok"))) TS_CResult_HtlcBasepointDecodeErrorZ_ok(uint64_t o) {
34403         LDKHtlcBasepoint o_conv;
34404         o_conv.inner = untag_ptr(o);
34405         o_conv.is_owned = ptr_is_owned(o);
34406         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34407         o_conv = HtlcBasepoint_clone(&o_conv);
34408         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
34409         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_ok(o_conv);
34410         return tag_ptr(ret_conv, true);
34411 }
34412
34413 uint64_t  __attribute__((export_name("TS_CResult_HtlcBasepointDecodeErrorZ_err"))) TS_CResult_HtlcBasepointDecodeErrorZ_err(uint64_t e) {
34414         void* e_ptr = untag_ptr(e);
34415         CHECK_ACCESS(e_ptr);
34416         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34417         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34418         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
34419         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_err(e_conv);
34420         return tag_ptr(ret_conv, true);
34421 }
34422
34423 jboolean  __attribute__((export_name("TS_CResult_HtlcBasepointDecodeErrorZ_is_ok"))) TS_CResult_HtlcBasepointDecodeErrorZ_is_ok(uint64_t o) {
34424         LDKCResult_HtlcBasepointDecodeErrorZ* o_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(o);
34425         jboolean ret_conv = CResult_HtlcBasepointDecodeErrorZ_is_ok(o_conv);
34426         return ret_conv;
34427 }
34428
34429 void  __attribute__((export_name("TS_CResult_HtlcBasepointDecodeErrorZ_free"))) TS_CResult_HtlcBasepointDecodeErrorZ_free(uint64_t _res) {
34430         if (!ptr_is_owned(_res)) return;
34431         void* _res_ptr = untag_ptr(_res);
34432         CHECK_ACCESS(_res_ptr);
34433         LDKCResult_HtlcBasepointDecodeErrorZ _res_conv = *(LDKCResult_HtlcBasepointDecodeErrorZ*)(_res_ptr);
34434         FREE(untag_ptr(_res));
34435         CResult_HtlcBasepointDecodeErrorZ_free(_res_conv);
34436 }
34437
34438 static inline uint64_t CResult_HtlcBasepointDecodeErrorZ_clone_ptr(LDKCResult_HtlcBasepointDecodeErrorZ *NONNULL_PTR arg) {
34439         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
34440         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_clone(arg);
34441         return tag_ptr(ret_conv, true);
34442 }
34443 int64_t  __attribute__((export_name("TS_CResult_HtlcBasepointDecodeErrorZ_clone_ptr"))) TS_CResult_HtlcBasepointDecodeErrorZ_clone_ptr(uint64_t arg) {
34444         LDKCResult_HtlcBasepointDecodeErrorZ* arg_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(arg);
34445         int64_t ret_conv = CResult_HtlcBasepointDecodeErrorZ_clone_ptr(arg_conv);
34446         return ret_conv;
34447 }
34448
34449 uint64_t  __attribute__((export_name("TS_CResult_HtlcBasepointDecodeErrorZ_clone"))) TS_CResult_HtlcBasepointDecodeErrorZ_clone(uint64_t orig) {
34450         LDKCResult_HtlcBasepointDecodeErrorZ* orig_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(orig);
34451         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
34452         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_clone(orig_conv);
34453         return tag_ptr(ret_conv, true);
34454 }
34455
34456 uint64_t  __attribute__((export_name("TS_CResult_HtlcKeyDecodeErrorZ_ok"))) TS_CResult_HtlcKeyDecodeErrorZ_ok(uint64_t o) {
34457         LDKHtlcKey o_conv;
34458         o_conv.inner = untag_ptr(o);
34459         o_conv.is_owned = ptr_is_owned(o);
34460         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34461         o_conv = HtlcKey_clone(&o_conv);
34462         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
34463         *ret_conv = CResult_HtlcKeyDecodeErrorZ_ok(o_conv);
34464         return tag_ptr(ret_conv, true);
34465 }
34466
34467 uint64_t  __attribute__((export_name("TS_CResult_HtlcKeyDecodeErrorZ_err"))) TS_CResult_HtlcKeyDecodeErrorZ_err(uint64_t e) {
34468         void* e_ptr = untag_ptr(e);
34469         CHECK_ACCESS(e_ptr);
34470         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34471         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34472         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
34473         *ret_conv = CResult_HtlcKeyDecodeErrorZ_err(e_conv);
34474         return tag_ptr(ret_conv, true);
34475 }
34476
34477 jboolean  __attribute__((export_name("TS_CResult_HtlcKeyDecodeErrorZ_is_ok"))) TS_CResult_HtlcKeyDecodeErrorZ_is_ok(uint64_t o) {
34478         LDKCResult_HtlcKeyDecodeErrorZ* o_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(o);
34479         jboolean ret_conv = CResult_HtlcKeyDecodeErrorZ_is_ok(o_conv);
34480         return ret_conv;
34481 }
34482
34483 void  __attribute__((export_name("TS_CResult_HtlcKeyDecodeErrorZ_free"))) TS_CResult_HtlcKeyDecodeErrorZ_free(uint64_t _res) {
34484         if (!ptr_is_owned(_res)) return;
34485         void* _res_ptr = untag_ptr(_res);
34486         CHECK_ACCESS(_res_ptr);
34487         LDKCResult_HtlcKeyDecodeErrorZ _res_conv = *(LDKCResult_HtlcKeyDecodeErrorZ*)(_res_ptr);
34488         FREE(untag_ptr(_res));
34489         CResult_HtlcKeyDecodeErrorZ_free(_res_conv);
34490 }
34491
34492 static inline uint64_t CResult_HtlcKeyDecodeErrorZ_clone_ptr(LDKCResult_HtlcKeyDecodeErrorZ *NONNULL_PTR arg) {
34493         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
34494         *ret_conv = CResult_HtlcKeyDecodeErrorZ_clone(arg);
34495         return tag_ptr(ret_conv, true);
34496 }
34497 int64_t  __attribute__((export_name("TS_CResult_HtlcKeyDecodeErrorZ_clone_ptr"))) TS_CResult_HtlcKeyDecodeErrorZ_clone_ptr(uint64_t arg) {
34498         LDKCResult_HtlcKeyDecodeErrorZ* arg_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(arg);
34499         int64_t ret_conv = CResult_HtlcKeyDecodeErrorZ_clone_ptr(arg_conv);
34500         return ret_conv;
34501 }
34502
34503 uint64_t  __attribute__((export_name("TS_CResult_HtlcKeyDecodeErrorZ_clone"))) TS_CResult_HtlcKeyDecodeErrorZ_clone(uint64_t orig) {
34504         LDKCResult_HtlcKeyDecodeErrorZ* orig_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(orig);
34505         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
34506         *ret_conv = CResult_HtlcKeyDecodeErrorZ_clone(orig_conv);
34507         return tag_ptr(ret_conv, true);
34508 }
34509
34510 uint64_t  __attribute__((export_name("TS_CResult_RevocationBasepointDecodeErrorZ_ok"))) TS_CResult_RevocationBasepointDecodeErrorZ_ok(uint64_t o) {
34511         LDKRevocationBasepoint o_conv;
34512         o_conv.inner = untag_ptr(o);
34513         o_conv.is_owned = ptr_is_owned(o);
34514         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34515         o_conv = RevocationBasepoint_clone(&o_conv);
34516         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
34517         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_ok(o_conv);
34518         return tag_ptr(ret_conv, true);
34519 }
34520
34521 uint64_t  __attribute__((export_name("TS_CResult_RevocationBasepointDecodeErrorZ_err"))) TS_CResult_RevocationBasepointDecodeErrorZ_err(uint64_t e) {
34522         void* e_ptr = untag_ptr(e);
34523         CHECK_ACCESS(e_ptr);
34524         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34525         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34526         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
34527         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_err(e_conv);
34528         return tag_ptr(ret_conv, true);
34529 }
34530
34531 jboolean  __attribute__((export_name("TS_CResult_RevocationBasepointDecodeErrorZ_is_ok"))) TS_CResult_RevocationBasepointDecodeErrorZ_is_ok(uint64_t o) {
34532         LDKCResult_RevocationBasepointDecodeErrorZ* o_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(o);
34533         jboolean ret_conv = CResult_RevocationBasepointDecodeErrorZ_is_ok(o_conv);
34534         return ret_conv;
34535 }
34536
34537 void  __attribute__((export_name("TS_CResult_RevocationBasepointDecodeErrorZ_free"))) TS_CResult_RevocationBasepointDecodeErrorZ_free(uint64_t _res) {
34538         if (!ptr_is_owned(_res)) return;
34539         void* _res_ptr = untag_ptr(_res);
34540         CHECK_ACCESS(_res_ptr);
34541         LDKCResult_RevocationBasepointDecodeErrorZ _res_conv = *(LDKCResult_RevocationBasepointDecodeErrorZ*)(_res_ptr);
34542         FREE(untag_ptr(_res));
34543         CResult_RevocationBasepointDecodeErrorZ_free(_res_conv);
34544 }
34545
34546 static inline uint64_t CResult_RevocationBasepointDecodeErrorZ_clone_ptr(LDKCResult_RevocationBasepointDecodeErrorZ *NONNULL_PTR arg) {
34547         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
34548         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_clone(arg);
34549         return tag_ptr(ret_conv, true);
34550 }
34551 int64_t  __attribute__((export_name("TS_CResult_RevocationBasepointDecodeErrorZ_clone_ptr"))) TS_CResult_RevocationBasepointDecodeErrorZ_clone_ptr(uint64_t arg) {
34552         LDKCResult_RevocationBasepointDecodeErrorZ* arg_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(arg);
34553         int64_t ret_conv = CResult_RevocationBasepointDecodeErrorZ_clone_ptr(arg_conv);
34554         return ret_conv;
34555 }
34556
34557 uint64_t  __attribute__((export_name("TS_CResult_RevocationBasepointDecodeErrorZ_clone"))) TS_CResult_RevocationBasepointDecodeErrorZ_clone(uint64_t orig) {
34558         LDKCResult_RevocationBasepointDecodeErrorZ* orig_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(orig);
34559         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
34560         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_clone(orig_conv);
34561         return tag_ptr(ret_conv, true);
34562 }
34563
34564 uint64_t  __attribute__((export_name("TS_CResult_RevocationKeyDecodeErrorZ_ok"))) TS_CResult_RevocationKeyDecodeErrorZ_ok(uint64_t o) {
34565         LDKRevocationKey o_conv;
34566         o_conv.inner = untag_ptr(o);
34567         o_conv.is_owned = ptr_is_owned(o);
34568         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34569         o_conv = RevocationKey_clone(&o_conv);
34570         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
34571         *ret_conv = CResult_RevocationKeyDecodeErrorZ_ok(o_conv);
34572         return tag_ptr(ret_conv, true);
34573 }
34574
34575 uint64_t  __attribute__((export_name("TS_CResult_RevocationKeyDecodeErrorZ_err"))) TS_CResult_RevocationKeyDecodeErrorZ_err(uint64_t e) {
34576         void* e_ptr = untag_ptr(e);
34577         CHECK_ACCESS(e_ptr);
34578         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34579         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34580         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
34581         *ret_conv = CResult_RevocationKeyDecodeErrorZ_err(e_conv);
34582         return tag_ptr(ret_conv, true);
34583 }
34584
34585 jboolean  __attribute__((export_name("TS_CResult_RevocationKeyDecodeErrorZ_is_ok"))) TS_CResult_RevocationKeyDecodeErrorZ_is_ok(uint64_t o) {
34586         LDKCResult_RevocationKeyDecodeErrorZ* o_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(o);
34587         jboolean ret_conv = CResult_RevocationKeyDecodeErrorZ_is_ok(o_conv);
34588         return ret_conv;
34589 }
34590
34591 void  __attribute__((export_name("TS_CResult_RevocationKeyDecodeErrorZ_free"))) TS_CResult_RevocationKeyDecodeErrorZ_free(uint64_t _res) {
34592         if (!ptr_is_owned(_res)) return;
34593         void* _res_ptr = untag_ptr(_res);
34594         CHECK_ACCESS(_res_ptr);
34595         LDKCResult_RevocationKeyDecodeErrorZ _res_conv = *(LDKCResult_RevocationKeyDecodeErrorZ*)(_res_ptr);
34596         FREE(untag_ptr(_res));
34597         CResult_RevocationKeyDecodeErrorZ_free(_res_conv);
34598 }
34599
34600 static inline uint64_t CResult_RevocationKeyDecodeErrorZ_clone_ptr(LDKCResult_RevocationKeyDecodeErrorZ *NONNULL_PTR arg) {
34601         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
34602         *ret_conv = CResult_RevocationKeyDecodeErrorZ_clone(arg);
34603         return tag_ptr(ret_conv, true);
34604 }
34605 int64_t  __attribute__((export_name("TS_CResult_RevocationKeyDecodeErrorZ_clone_ptr"))) TS_CResult_RevocationKeyDecodeErrorZ_clone_ptr(uint64_t arg) {
34606         LDKCResult_RevocationKeyDecodeErrorZ* arg_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(arg);
34607         int64_t ret_conv = CResult_RevocationKeyDecodeErrorZ_clone_ptr(arg_conv);
34608         return ret_conv;
34609 }
34610
34611 uint64_t  __attribute__((export_name("TS_CResult_RevocationKeyDecodeErrorZ_clone"))) TS_CResult_RevocationKeyDecodeErrorZ_clone(uint64_t orig) {
34612         LDKCResult_RevocationKeyDecodeErrorZ* orig_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(orig);
34613         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
34614         *ret_conv = CResult_RevocationKeyDecodeErrorZ_clone(orig_conv);
34615         return tag_ptr(ret_conv, true);
34616 }
34617
34618 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_ok"))) TS_CResult_LockedChannelMonitorNoneZ_ok(uint64_t o) {
34619         LDKLockedChannelMonitor o_conv;
34620         o_conv.inner = untag_ptr(o);
34621         o_conv.is_owned = ptr_is_owned(o);
34622         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34623         // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
34624         
34625         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
34626         *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
34627         return tag_ptr(ret_conv, true);
34628 }
34629
34630 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_err"))) TS_CResult_LockedChannelMonitorNoneZ_err() {
34631         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
34632         *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
34633         return tag_ptr(ret_conv, true);
34634 }
34635
34636 jboolean  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_is_ok"))) TS_CResult_LockedChannelMonitorNoneZ_is_ok(uint64_t o) {
34637         LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(o);
34638         jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
34639         return ret_conv;
34640 }
34641
34642 void  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_free"))) TS_CResult_LockedChannelMonitorNoneZ_free(uint64_t _res) {
34643         if (!ptr_is_owned(_res)) return;
34644         void* _res_ptr = untag_ptr(_res);
34645         CHECK_ACCESS(_res_ptr);
34646         LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
34647         FREE(untag_ptr(_res));
34648         CResult_LockedChannelMonitorNoneZ_free(_res_conv);
34649 }
34650
34651 static inline uint64_t C2Tuple_OutPointChannelIdZ_clone_ptr(LDKC2Tuple_OutPointChannelIdZ *NONNULL_PTR arg) {
34652         LDKC2Tuple_OutPointChannelIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointChannelIdZ), "LDKC2Tuple_OutPointChannelIdZ");
34653         *ret_conv = C2Tuple_OutPointChannelIdZ_clone(arg);
34654         return tag_ptr(ret_conv, true);
34655 }
34656 int64_t  __attribute__((export_name("TS_C2Tuple_OutPointChannelIdZ_clone_ptr"))) TS_C2Tuple_OutPointChannelIdZ_clone_ptr(uint64_t arg) {
34657         LDKC2Tuple_OutPointChannelIdZ* arg_conv = (LDKC2Tuple_OutPointChannelIdZ*)untag_ptr(arg);
34658         int64_t ret_conv = C2Tuple_OutPointChannelIdZ_clone_ptr(arg_conv);
34659         return ret_conv;
34660 }
34661
34662 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointChannelIdZ_clone"))) TS_C2Tuple_OutPointChannelIdZ_clone(uint64_t orig) {
34663         LDKC2Tuple_OutPointChannelIdZ* orig_conv = (LDKC2Tuple_OutPointChannelIdZ*)untag_ptr(orig);
34664         LDKC2Tuple_OutPointChannelIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointChannelIdZ), "LDKC2Tuple_OutPointChannelIdZ");
34665         *ret_conv = C2Tuple_OutPointChannelIdZ_clone(orig_conv);
34666         return tag_ptr(ret_conv, true);
34667 }
34668
34669 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointChannelIdZ_new"))) TS_C2Tuple_OutPointChannelIdZ_new(uint64_t a, uint64_t b) {
34670         LDKOutPoint a_conv;
34671         a_conv.inner = untag_ptr(a);
34672         a_conv.is_owned = ptr_is_owned(a);
34673         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34674         a_conv = OutPoint_clone(&a_conv);
34675         LDKChannelId b_conv;
34676         b_conv.inner = untag_ptr(b);
34677         b_conv.is_owned = ptr_is_owned(b);
34678         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34679         b_conv = ChannelId_clone(&b_conv);
34680         LDKC2Tuple_OutPointChannelIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointChannelIdZ), "LDKC2Tuple_OutPointChannelIdZ");
34681         *ret_conv = C2Tuple_OutPointChannelIdZ_new(a_conv, b_conv);
34682         return tag_ptr(ret_conv, true);
34683 }
34684
34685 void  __attribute__((export_name("TS_C2Tuple_OutPointChannelIdZ_free"))) TS_C2Tuple_OutPointChannelIdZ_free(uint64_t _res) {
34686         if (!ptr_is_owned(_res)) return;
34687         void* _res_ptr = untag_ptr(_res);
34688         CHECK_ACCESS(_res_ptr);
34689         LDKC2Tuple_OutPointChannelIdZ _res_conv = *(LDKC2Tuple_OutPointChannelIdZ*)(_res_ptr);
34690         FREE(untag_ptr(_res));
34691         C2Tuple_OutPointChannelIdZ_free(_res_conv);
34692 }
34693
34694 void  __attribute__((export_name("TS_CVec_C2Tuple_OutPointChannelIdZZ_free"))) TS_CVec_C2Tuple_OutPointChannelIdZZ_free(uint64_tArray _res) {
34695         LDKCVec_C2Tuple_OutPointChannelIdZZ _res_constr;
34696         _res_constr.datalen = _res->arr_len;
34697         if (_res_constr.datalen > 0)
34698                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_OutPointChannelIdZ), "LDKCVec_C2Tuple_OutPointChannelIdZZ Elements");
34699         else
34700                 _res_constr.data = NULL;
34701         uint64_t* _res_vals = _res->elems;
34702         for (size_t d = 0; d < _res_constr.datalen; d++) {
34703                 uint64_t _res_conv_29 = _res_vals[d];
34704                 void* _res_conv_29_ptr = untag_ptr(_res_conv_29);
34705                 CHECK_ACCESS(_res_conv_29_ptr);
34706                 LDKC2Tuple_OutPointChannelIdZ _res_conv_29_conv = *(LDKC2Tuple_OutPointChannelIdZ*)(_res_conv_29_ptr);
34707                 FREE(untag_ptr(_res_conv_29));
34708                 _res_constr.data[d] = _res_conv_29_conv;
34709         }
34710         FREE(_res);
34711         CVec_C2Tuple_OutPointChannelIdZZ_free(_res_constr);
34712 }
34713
34714 void  __attribute__((export_name("TS_CVec_MonitorUpdateIdZ_free"))) TS_CVec_MonitorUpdateIdZ_free(uint64_tArray _res) {
34715         LDKCVec_MonitorUpdateIdZ _res_constr;
34716         _res_constr.datalen = _res->arr_len;
34717         if (_res_constr.datalen > 0)
34718                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
34719         else
34720                 _res_constr.data = NULL;
34721         uint64_t* _res_vals = _res->elems;
34722         for (size_t r = 0; r < _res_constr.datalen; r++) {
34723                 uint64_t _res_conv_17 = _res_vals[r];
34724                 LDKMonitorUpdateId _res_conv_17_conv;
34725                 _res_conv_17_conv.inner = untag_ptr(_res_conv_17);
34726                 _res_conv_17_conv.is_owned = ptr_is_owned(_res_conv_17);
34727                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_17_conv);
34728                 _res_constr.data[r] = _res_conv_17_conv;
34729         }
34730         FREE(_res);
34731         CVec_MonitorUpdateIdZ_free(_res_constr);
34732 }
34733
34734 static inline uint64_t C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR arg) {
34735         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
34736         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(arg);
34737         return tag_ptr(ret_conv, true);
34738 }
34739 int64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(uint64_t arg) {
34740         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* arg_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(arg);
34741         int64_t ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(arg_conv);
34742         return ret_conv;
34743 }
34744
34745 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(uint64_t orig) {
34746         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* orig_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(orig);
34747         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
34748         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig_conv);
34749         return tag_ptr(ret_conv, true);
34750 }
34751
34752 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(uint64_t a, uint64_tArray b) {
34753         LDKOutPoint a_conv;
34754         a_conv.inner = untag_ptr(a);
34755         a_conv.is_owned = ptr_is_owned(a);
34756         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34757         a_conv = OutPoint_clone(&a_conv);
34758         LDKCVec_MonitorUpdateIdZ b_constr;
34759         b_constr.datalen = b->arr_len;
34760         if (b_constr.datalen > 0)
34761                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
34762         else
34763                 b_constr.data = NULL;
34764         uint64_t* b_vals = b->elems;
34765         for (size_t r = 0; r < b_constr.datalen; r++) {
34766                 uint64_t b_conv_17 = b_vals[r];
34767                 LDKMonitorUpdateId b_conv_17_conv;
34768                 b_conv_17_conv.inner = untag_ptr(b_conv_17);
34769                 b_conv_17_conv.is_owned = ptr_is_owned(b_conv_17);
34770                 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv_17_conv);
34771                 b_conv_17_conv = MonitorUpdateId_clone(&b_conv_17_conv);
34772                 b_constr.data[r] = b_conv_17_conv;
34773         }
34774         FREE(b);
34775         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
34776         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a_conv, b_constr);
34777         return tag_ptr(ret_conv, true);
34778 }
34779
34780 void  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(uint64_t _res) {
34781         if (!ptr_is_owned(_res)) return;
34782         void* _res_ptr = untag_ptr(_res);
34783         CHECK_ACCESS(_res_ptr);
34784         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_ptr);
34785         FREE(untag_ptr(_res));
34786         C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res_conv);
34787 }
34788
34789 void  __attribute__((export_name("TS_CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free"))) TS_CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(uint64_tArray _res) {
34790         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ _res_constr;
34791         _res_constr.datalen = _res->arr_len;
34792         if (_res_constr.datalen > 0)
34793                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ Elements");
34794         else
34795                 _res_constr.data = NULL;
34796         uint64_t* _res_vals = _res->elems;
34797         for (size_t p = 0; p < _res_constr.datalen; p++) {
34798                 uint64_t _res_conv_41 = _res_vals[p];
34799                 void* _res_conv_41_ptr = untag_ptr(_res_conv_41);
34800                 CHECK_ACCESS(_res_conv_41_ptr);
34801                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv_41_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_conv_41_ptr);
34802                 FREE(untag_ptr(_res_conv_41));
34803                 _res_constr.data[p] = _res_conv_41_conv;
34804         }
34805         FREE(_res);
34806         CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res_constr);
34807 }
34808
34809 void  __attribute__((export_name("TS_APIError_free"))) TS_APIError_free(uint64_t this_ptr) {
34810         if (!ptr_is_owned(this_ptr)) return;
34811         void* this_ptr_ptr = untag_ptr(this_ptr);
34812         CHECK_ACCESS(this_ptr_ptr);
34813         LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
34814         FREE(untag_ptr(this_ptr));
34815         APIError_free(this_ptr_conv);
34816 }
34817
34818 static inline uint64_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
34819         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
34820         *ret_copy = APIError_clone(arg);
34821         uint64_t ret_ref = tag_ptr(ret_copy, true);
34822         return ret_ref;
34823 }
34824 int64_t  __attribute__((export_name("TS_APIError_clone_ptr"))) TS_APIError_clone_ptr(uint64_t arg) {
34825         LDKAPIError* arg_conv = (LDKAPIError*)untag_ptr(arg);
34826         int64_t ret_conv = APIError_clone_ptr(arg_conv);
34827         return ret_conv;
34828 }
34829
34830 uint64_t  __attribute__((export_name("TS_APIError_clone"))) TS_APIError_clone(uint64_t orig) {
34831         LDKAPIError* orig_conv = (LDKAPIError*)untag_ptr(orig);
34832         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
34833         *ret_copy = APIError_clone(orig_conv);
34834         uint64_t ret_ref = tag_ptr(ret_copy, true);
34835         return ret_ref;
34836 }
34837
34838 uint64_t  __attribute__((export_name("TS_APIError_apimisuse_error"))) TS_APIError_apimisuse_error(jstring err) {
34839         LDKStr err_conv = str_ref_to_owned_c(err);
34840         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
34841         *ret_copy = APIError_apimisuse_error(err_conv);
34842         uint64_t ret_ref = tag_ptr(ret_copy, true);
34843         return ret_ref;
34844 }
34845
34846 uint64_t  __attribute__((export_name("TS_APIError_fee_rate_too_high"))) TS_APIError_fee_rate_too_high(jstring err, int32_t feerate) {
34847         LDKStr err_conv = str_ref_to_owned_c(err);
34848         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
34849         *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
34850         uint64_t ret_ref = tag_ptr(ret_copy, true);
34851         return ret_ref;
34852 }
34853
34854 uint64_t  __attribute__((export_name("TS_APIError_invalid_route"))) TS_APIError_invalid_route(jstring err) {
34855         LDKStr err_conv = str_ref_to_owned_c(err);
34856         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
34857         *ret_copy = APIError_invalid_route(err_conv);
34858         uint64_t ret_ref = tag_ptr(ret_copy, true);
34859         return ret_ref;
34860 }
34861
34862 uint64_t  __attribute__((export_name("TS_APIError_channel_unavailable"))) TS_APIError_channel_unavailable(jstring err) {
34863         LDKStr err_conv = str_ref_to_owned_c(err);
34864         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
34865         *ret_copy = APIError_channel_unavailable(err_conv);
34866         uint64_t ret_ref = tag_ptr(ret_copy, true);
34867         return ret_ref;
34868 }
34869
34870 uint64_t  __attribute__((export_name("TS_APIError_monitor_update_in_progress"))) TS_APIError_monitor_update_in_progress() {
34871         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
34872         *ret_copy = APIError_monitor_update_in_progress();
34873         uint64_t ret_ref = tag_ptr(ret_copy, true);
34874         return ret_ref;
34875 }
34876
34877 uint64_t  __attribute__((export_name("TS_APIError_incompatible_shutdown_script"))) TS_APIError_incompatible_shutdown_script(uint64_t script) {
34878         LDKShutdownScript script_conv;
34879         script_conv.inner = untag_ptr(script);
34880         script_conv.is_owned = ptr_is_owned(script);
34881         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
34882         script_conv = ShutdownScript_clone(&script_conv);
34883         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
34884         *ret_copy = APIError_incompatible_shutdown_script(script_conv);
34885         uint64_t ret_ref = tag_ptr(ret_copy, true);
34886         return ret_ref;
34887 }
34888
34889 jboolean  __attribute__((export_name("TS_APIError_eq"))) TS_APIError_eq(uint64_t a, uint64_t b) {
34890         LDKAPIError* a_conv = (LDKAPIError*)untag_ptr(a);
34891         LDKAPIError* b_conv = (LDKAPIError*)untag_ptr(b);
34892         jboolean ret_conv = APIError_eq(a_conv, b_conv);
34893         return ret_conv;
34894 }
34895
34896 int8_tArray  __attribute__((export_name("TS_APIError_write"))) TS_APIError_write(uint64_t obj) {
34897         LDKAPIError* obj_conv = (LDKAPIError*)untag_ptr(obj);
34898         LDKCVec_u8Z ret_var = APIError_write(obj_conv);
34899         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34900         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34901         CVec_u8Z_free(ret_var);
34902         return ret_arr;
34903 }
34904
34905 uint64_t  __attribute__((export_name("TS_APIError_read"))) TS_APIError_read(int8_tArray ser) {
34906         LDKu8slice ser_ref;
34907         ser_ref.datalen = ser->arr_len;
34908         ser_ref.data = ser->elems;
34909         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
34910         *ret_conv = APIError_read(ser_ref);
34911         FREE(ser);
34912         return tag_ptr(ret_conv, true);
34913 }
34914
34915 void  __attribute__((export_name("TS_BigSize_free"))) TS_BigSize_free(uint64_t this_obj) {
34916         LDKBigSize this_obj_conv;
34917         this_obj_conv.inner = untag_ptr(this_obj);
34918         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34920         BigSize_free(this_obj_conv);
34921 }
34922
34923 int64_t  __attribute__((export_name("TS_BigSize_get_a"))) TS_BigSize_get_a(uint64_t this_ptr) {
34924         LDKBigSize this_ptr_conv;
34925         this_ptr_conv.inner = untag_ptr(this_ptr);
34926         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34928         this_ptr_conv.is_owned = false;
34929         int64_t ret_conv = BigSize_get_a(&this_ptr_conv);
34930         return ret_conv;
34931 }
34932
34933 void  __attribute__((export_name("TS_BigSize_set_a"))) TS_BigSize_set_a(uint64_t this_ptr, int64_t val) {
34934         LDKBigSize this_ptr_conv;
34935         this_ptr_conv.inner = untag_ptr(this_ptr);
34936         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34938         this_ptr_conv.is_owned = false;
34939         BigSize_set_a(&this_ptr_conv, val);
34940 }
34941
34942 uint64_t  __attribute__((export_name("TS_BigSize_new"))) TS_BigSize_new(int64_t a_arg) {
34943         LDKBigSize ret_var = BigSize_new(a_arg);
34944         uint64_t ret_ref = 0;
34945         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34946         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34947         return ret_ref;
34948 }
34949
34950 static inline uint64_t BigSize_clone_ptr(LDKBigSize *NONNULL_PTR arg) {
34951         LDKBigSize ret_var = BigSize_clone(arg);
34952         uint64_t ret_ref = 0;
34953         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34954         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34955         return ret_ref;
34956 }
34957 int64_t  __attribute__((export_name("TS_BigSize_clone_ptr"))) TS_BigSize_clone_ptr(uint64_t arg) {
34958         LDKBigSize arg_conv;
34959         arg_conv.inner = untag_ptr(arg);
34960         arg_conv.is_owned = ptr_is_owned(arg);
34961         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34962         arg_conv.is_owned = false;
34963         int64_t ret_conv = BigSize_clone_ptr(&arg_conv);
34964         return ret_conv;
34965 }
34966
34967 uint64_t  __attribute__((export_name("TS_BigSize_clone"))) TS_BigSize_clone(uint64_t orig) {
34968         LDKBigSize orig_conv;
34969         orig_conv.inner = untag_ptr(orig);
34970         orig_conv.is_owned = ptr_is_owned(orig);
34971         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34972         orig_conv.is_owned = false;
34973         LDKBigSize ret_var = BigSize_clone(&orig_conv);
34974         uint64_t ret_ref = 0;
34975         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34976         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34977         return ret_ref;
34978 }
34979
34980 int64_t  __attribute__((export_name("TS_BigSize_hash"))) TS_BigSize_hash(uint64_t o) {
34981         LDKBigSize o_conv;
34982         o_conv.inner = untag_ptr(o);
34983         o_conv.is_owned = ptr_is_owned(o);
34984         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34985         o_conv.is_owned = false;
34986         int64_t ret_conv = BigSize_hash(&o_conv);
34987         return ret_conv;
34988 }
34989
34990 jboolean  __attribute__((export_name("TS_BigSize_eq"))) TS_BigSize_eq(uint64_t a, uint64_t b) {
34991         LDKBigSize a_conv;
34992         a_conv.inner = untag_ptr(a);
34993         a_conv.is_owned = ptr_is_owned(a);
34994         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34995         a_conv.is_owned = false;
34996         LDKBigSize b_conv;
34997         b_conv.inner = untag_ptr(b);
34998         b_conv.is_owned = ptr_is_owned(b);
34999         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35000         b_conv.is_owned = false;
35001         jboolean ret_conv = BigSize_eq(&a_conv, &b_conv);
35002         return ret_conv;
35003 }
35004
35005 int8_tArray  __attribute__((export_name("TS_BigSize_write"))) TS_BigSize_write(uint64_t obj) {
35006         LDKBigSize obj_conv;
35007         obj_conv.inner = untag_ptr(obj);
35008         obj_conv.is_owned = ptr_is_owned(obj);
35009         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35010         obj_conv.is_owned = false;
35011         LDKCVec_u8Z ret_var = BigSize_write(&obj_conv);
35012         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35013         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35014         CVec_u8Z_free(ret_var);
35015         return ret_arr;
35016 }
35017
35018 uint64_t  __attribute__((export_name("TS_BigSize_read"))) TS_BigSize_read(int8_tArray ser) {
35019         LDKu8slice ser_ref;
35020         ser_ref.datalen = ser->arr_len;
35021         ser_ref.data = ser->elems;
35022         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
35023         *ret_conv = BigSize_read(ser_ref);
35024         FREE(ser);
35025         return tag_ptr(ret_conv, true);
35026 }
35027
35028 void  __attribute__((export_name("TS_Hostname_free"))) TS_Hostname_free(uint64_t this_obj) {
35029         LDKHostname this_obj_conv;
35030         this_obj_conv.inner = untag_ptr(this_obj);
35031         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35033         Hostname_free(this_obj_conv);
35034 }
35035
35036 static inline uint64_t Hostname_clone_ptr(LDKHostname *NONNULL_PTR arg) {
35037         LDKHostname ret_var = Hostname_clone(arg);
35038         uint64_t ret_ref = 0;
35039         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35040         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35041         return ret_ref;
35042 }
35043 int64_t  __attribute__((export_name("TS_Hostname_clone_ptr"))) TS_Hostname_clone_ptr(uint64_t arg) {
35044         LDKHostname arg_conv;
35045         arg_conv.inner = untag_ptr(arg);
35046         arg_conv.is_owned = ptr_is_owned(arg);
35047         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35048         arg_conv.is_owned = false;
35049         int64_t ret_conv = Hostname_clone_ptr(&arg_conv);
35050         return ret_conv;
35051 }
35052
35053 uint64_t  __attribute__((export_name("TS_Hostname_clone"))) TS_Hostname_clone(uint64_t orig) {
35054         LDKHostname orig_conv;
35055         orig_conv.inner = untag_ptr(orig);
35056         orig_conv.is_owned = ptr_is_owned(orig);
35057         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35058         orig_conv.is_owned = false;
35059         LDKHostname ret_var = Hostname_clone(&orig_conv);
35060         uint64_t ret_ref = 0;
35061         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35062         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35063         return ret_ref;
35064 }
35065
35066 int64_t  __attribute__((export_name("TS_Hostname_hash"))) TS_Hostname_hash(uint64_t o) {
35067         LDKHostname o_conv;
35068         o_conv.inner = untag_ptr(o);
35069         o_conv.is_owned = ptr_is_owned(o);
35070         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35071         o_conv.is_owned = false;
35072         int64_t ret_conv = Hostname_hash(&o_conv);
35073         return ret_conv;
35074 }
35075
35076 jboolean  __attribute__((export_name("TS_Hostname_eq"))) TS_Hostname_eq(uint64_t a, uint64_t b) {
35077         LDKHostname a_conv;
35078         a_conv.inner = untag_ptr(a);
35079         a_conv.is_owned = ptr_is_owned(a);
35080         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35081         a_conv.is_owned = false;
35082         LDKHostname b_conv;
35083         b_conv.inner = untag_ptr(b);
35084         b_conv.is_owned = ptr_is_owned(b);
35085         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35086         b_conv.is_owned = false;
35087         jboolean ret_conv = Hostname_eq(&a_conv, &b_conv);
35088         return ret_conv;
35089 }
35090
35091 int8_t  __attribute__((export_name("TS_Hostname_len"))) TS_Hostname_len(uint64_t this_arg) {
35092         LDKHostname this_arg_conv;
35093         this_arg_conv.inner = untag_ptr(this_arg);
35094         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35096         this_arg_conv.is_owned = false;
35097         int8_t ret_conv = Hostname_len(&this_arg_conv);
35098         return ret_conv;
35099 }
35100
35101 int8_tArray  __attribute__((export_name("TS_Hostname_write"))) TS_Hostname_write(uint64_t obj) {
35102         LDKHostname obj_conv;
35103         obj_conv.inner = untag_ptr(obj);
35104         obj_conv.is_owned = ptr_is_owned(obj);
35105         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35106         obj_conv.is_owned = false;
35107         LDKCVec_u8Z ret_var = Hostname_write(&obj_conv);
35108         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35109         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35110         CVec_u8Z_free(ret_var);
35111         return ret_arr;
35112 }
35113
35114 uint64_t  __attribute__((export_name("TS_Hostname_read"))) TS_Hostname_read(int8_tArray ser) {
35115         LDKu8slice ser_ref;
35116         ser_ref.datalen = ser->arr_len;
35117         ser_ref.data = ser->elems;
35118         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
35119         *ret_conv = Hostname_read(ser_ref);
35120         FREE(ser);
35121         return tag_ptr(ret_conv, true);
35122 }
35123
35124 void  __attribute__((export_name("TS_TransactionU16LenLimited_free"))) TS_TransactionU16LenLimited_free(uint64_t this_obj) {
35125         LDKTransactionU16LenLimited this_obj_conv;
35126         this_obj_conv.inner = untag_ptr(this_obj);
35127         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35129         TransactionU16LenLimited_free(this_obj_conv);
35130 }
35131
35132 static inline uint64_t TransactionU16LenLimited_clone_ptr(LDKTransactionU16LenLimited *NONNULL_PTR arg) {
35133         LDKTransactionU16LenLimited ret_var = TransactionU16LenLimited_clone(arg);
35134         uint64_t ret_ref = 0;
35135         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35136         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35137         return ret_ref;
35138 }
35139 int64_t  __attribute__((export_name("TS_TransactionU16LenLimited_clone_ptr"))) TS_TransactionU16LenLimited_clone_ptr(uint64_t arg) {
35140         LDKTransactionU16LenLimited arg_conv;
35141         arg_conv.inner = untag_ptr(arg);
35142         arg_conv.is_owned = ptr_is_owned(arg);
35143         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35144         arg_conv.is_owned = false;
35145         int64_t ret_conv = TransactionU16LenLimited_clone_ptr(&arg_conv);
35146         return ret_conv;
35147 }
35148
35149 uint64_t  __attribute__((export_name("TS_TransactionU16LenLimited_clone"))) TS_TransactionU16LenLimited_clone(uint64_t orig) {
35150         LDKTransactionU16LenLimited orig_conv;
35151         orig_conv.inner = untag_ptr(orig);
35152         orig_conv.is_owned = ptr_is_owned(orig);
35153         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35154         orig_conv.is_owned = false;
35155         LDKTransactionU16LenLimited ret_var = TransactionU16LenLimited_clone(&orig_conv);
35156         uint64_t ret_ref = 0;
35157         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35158         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35159         return ret_ref;
35160 }
35161
35162 int64_t  __attribute__((export_name("TS_TransactionU16LenLimited_hash"))) TS_TransactionU16LenLimited_hash(uint64_t o) {
35163         LDKTransactionU16LenLimited o_conv;
35164         o_conv.inner = untag_ptr(o);
35165         o_conv.is_owned = ptr_is_owned(o);
35166         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35167         o_conv.is_owned = false;
35168         int64_t ret_conv = TransactionU16LenLimited_hash(&o_conv);
35169         return ret_conv;
35170 }
35171
35172 jboolean  __attribute__((export_name("TS_TransactionU16LenLimited_eq"))) TS_TransactionU16LenLimited_eq(uint64_t a, uint64_t b) {
35173         LDKTransactionU16LenLimited a_conv;
35174         a_conv.inner = untag_ptr(a);
35175         a_conv.is_owned = ptr_is_owned(a);
35176         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35177         a_conv.is_owned = false;
35178         LDKTransactionU16LenLimited b_conv;
35179         b_conv.inner = untag_ptr(b);
35180         b_conv.is_owned = ptr_is_owned(b);
35181         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35182         b_conv.is_owned = false;
35183         jboolean ret_conv = TransactionU16LenLimited_eq(&a_conv, &b_conv);
35184         return ret_conv;
35185 }
35186
35187 uint64_t  __attribute__((export_name("TS_TransactionU16LenLimited_new"))) TS_TransactionU16LenLimited_new(int8_tArray transaction) {
35188         LDKTransaction transaction_ref;
35189         transaction_ref.datalen = transaction->arr_len;
35190         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
35191         memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen); FREE(transaction);
35192         transaction_ref.data_is_owned = true;
35193         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
35194         *ret_conv = TransactionU16LenLimited_new(transaction_ref);
35195         return tag_ptr(ret_conv, true);
35196 }
35197
35198 int8_tArray  __attribute__((export_name("TS_TransactionU16LenLimited_into_transaction"))) TS_TransactionU16LenLimited_into_transaction(uint64_t this_arg) {
35199         LDKTransactionU16LenLimited this_arg_conv;
35200         this_arg_conv.inner = untag_ptr(this_arg);
35201         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35203         this_arg_conv = TransactionU16LenLimited_clone(&this_arg_conv);
35204         LDKTransaction ret_var = TransactionU16LenLimited_into_transaction(this_arg_conv);
35205         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35206         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35207         Transaction_free(ret_var);
35208         return ret_arr;
35209 }
35210
35211 int8_tArray  __attribute__((export_name("TS_TransactionU16LenLimited_as_transaction"))) TS_TransactionU16LenLimited_as_transaction(uint64_t this_arg) {
35212         LDKTransactionU16LenLimited this_arg_conv;
35213         this_arg_conv.inner = untag_ptr(this_arg);
35214         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35216         this_arg_conv.is_owned = false;
35217         LDKTransaction ret_var = TransactionU16LenLimited_as_transaction(&this_arg_conv);
35218         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35219         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35220         Transaction_free(ret_var);
35221         return ret_arr;
35222 }
35223
35224 int8_tArray  __attribute__((export_name("TS_TransactionU16LenLimited_write"))) TS_TransactionU16LenLimited_write(uint64_t obj) {
35225         LDKTransactionU16LenLimited obj_conv;
35226         obj_conv.inner = untag_ptr(obj);
35227         obj_conv.is_owned = ptr_is_owned(obj);
35228         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35229         obj_conv.is_owned = false;
35230         LDKCVec_u8Z ret_var = TransactionU16LenLimited_write(&obj_conv);
35231         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35232         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35233         CVec_u8Z_free(ret_var);
35234         return ret_arr;
35235 }
35236
35237 uint64_t  __attribute__((export_name("TS_TransactionU16LenLimited_read"))) TS_TransactionU16LenLimited_read(int8_tArray ser) {
35238         LDKu8slice ser_ref;
35239         ser_ref.datalen = ser->arr_len;
35240         ser_ref.data = ser->elems;
35241         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
35242         *ret_conv = TransactionU16LenLimited_read(ser_ref);
35243         FREE(ser);
35244         return tag_ptr(ret_conv, true);
35245 }
35246
35247 uint64_t  __attribute__((export_name("TS_sign"))) TS_sign(int8_tArray msg, int8_tArray sk) {
35248         LDKu8slice msg_ref;
35249         msg_ref.datalen = msg->arr_len;
35250         msg_ref.data = msg->elems;
35251         uint8_t sk_arr[32];
35252         CHECK(sk->arr_len == 32);
35253         memcpy(sk_arr, sk->elems, 32); FREE(sk);
35254         uint8_t (*sk_ref)[32] = &sk_arr;
35255         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
35256         *ret_conv = sign(msg_ref, sk_ref);
35257         FREE(msg);
35258         return tag_ptr(ret_conv, true);
35259 }
35260
35261 uint64_t  __attribute__((export_name("TS_recover_pk"))) TS_recover_pk(int8_tArray msg, jstring sig) {
35262         LDKu8slice msg_ref;
35263         msg_ref.datalen = msg->arr_len;
35264         msg_ref.data = msg->elems;
35265         LDKStr sig_conv = str_ref_to_owned_c(sig);
35266         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
35267         *ret_conv = recover_pk(msg_ref, sig_conv);
35268         FREE(msg);
35269         return tag_ptr(ret_conv, true);
35270 }
35271
35272 jboolean  __attribute__((export_name("TS_verify"))) TS_verify(int8_tArray msg, jstring sig, int8_tArray pk) {
35273         LDKu8slice msg_ref;
35274         msg_ref.datalen = msg->arr_len;
35275         msg_ref.data = msg->elems;
35276         LDKStr sig_conv = str_ref_to_owned_c(sig);
35277         LDKPublicKey pk_ref;
35278         CHECK(pk->arr_len == 33);
35279         memcpy(pk_ref.compressed_form, pk->elems, 33); FREE(pk);
35280         jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
35281         FREE(msg);
35282         return ret_conv;
35283 }
35284
35285 int8_tArray  __attribute__((export_name("TS_construct_invoice_preimage"))) TS_construct_invoice_preimage(int8_tArray hrp_bytes, ptrArray data_without_signature) {
35286         LDKu8slice hrp_bytes_ref;
35287         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
35288         hrp_bytes_ref.data = hrp_bytes->elems;
35289         LDKCVec_U5Z data_without_signature_constr;
35290         data_without_signature_constr.datalen = data_without_signature->arr_len;
35291         if (data_without_signature_constr.datalen > 0)
35292                 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
35293         else
35294                 data_without_signature_constr.data = NULL;
35295         int8_t* data_without_signature_vals = (void*) data_without_signature->elems;
35296         for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
35297                 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
35298                 
35299                 data_without_signature_constr.data[h] = (LDKU5){ ._0 = data_without_signature_conv_7 };
35300         }
35301         FREE(data_without_signature);
35302         LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
35303         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35304         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35305         CVec_u8Z_free(ret_var);
35306         FREE(hrp_bytes);
35307         return ret_arr;
35308 }
35309
35310 void  __attribute__((export_name("TS_KVStore_free"))) TS_KVStore_free(uint64_t this_ptr) {
35311         if (!ptr_is_owned(this_ptr)) return;
35312         void* this_ptr_ptr = untag_ptr(this_ptr);
35313         CHECK_ACCESS(this_ptr_ptr);
35314         LDKKVStore this_ptr_conv = *(LDKKVStore*)(this_ptr_ptr);
35315         FREE(untag_ptr(this_ptr));
35316         KVStore_free(this_ptr_conv);
35317 }
35318
35319 void  __attribute__((export_name("TS_Persister_free"))) TS_Persister_free(uint64_t this_ptr) {
35320         if (!ptr_is_owned(this_ptr)) return;
35321         void* this_ptr_ptr = untag_ptr(this_ptr);
35322         CHECK_ACCESS(this_ptr_ptr);
35323         LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
35324         FREE(untag_ptr(this_ptr));
35325         Persister_free(this_ptr_conv);
35326 }
35327
35328 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) {
35329         void* kv_store_ptr = untag_ptr(kv_store);
35330         CHECK_ACCESS(kv_store_ptr);
35331         LDKKVStore kv_store_conv = *(LDKKVStore*)(kv_store_ptr);
35332         if (kv_store_conv.free == LDKKVStore_JCalls_free) {
35333                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35334                 LDKKVStore_JCalls_cloned(&kv_store_conv);
35335         }
35336         void* entropy_source_ptr = untag_ptr(entropy_source);
35337         CHECK_ACCESS(entropy_source_ptr);
35338         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
35339         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
35340                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35341                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
35342         }
35343         void* signer_provider_ptr = untag_ptr(signer_provider);
35344         CHECK_ACCESS(signer_provider_ptr);
35345         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
35346         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
35347                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35348                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
35349         }
35350         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
35351         *ret_conv = read_channel_monitors(kv_store_conv, entropy_source_conv, signer_provider_conv);
35352         return tag_ptr(ret_conv, true);
35353 }
35354
35355 void  __attribute__((export_name("TS_MonitorUpdatingPersister_free"))) TS_MonitorUpdatingPersister_free(uint64_t this_obj) {
35356         LDKMonitorUpdatingPersister this_obj_conv;
35357         this_obj_conv.inner = untag_ptr(this_obj);
35358         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35360         MonitorUpdatingPersister_free(this_obj_conv);
35361 }
35362
35363 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) {
35364         void* kv_store_ptr = untag_ptr(kv_store);
35365         CHECK_ACCESS(kv_store_ptr);
35366         LDKKVStore kv_store_conv = *(LDKKVStore*)(kv_store_ptr);
35367         if (kv_store_conv.free == LDKKVStore_JCalls_free) {
35368                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35369                 LDKKVStore_JCalls_cloned(&kv_store_conv);
35370         }
35371         void* logger_ptr = untag_ptr(logger);
35372         CHECK_ACCESS(logger_ptr);
35373         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
35374         if (logger_conv.free == LDKLogger_JCalls_free) {
35375                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35376                 LDKLogger_JCalls_cloned(&logger_conv);
35377         }
35378         void* entropy_source_ptr = untag_ptr(entropy_source);
35379         CHECK_ACCESS(entropy_source_ptr);
35380         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
35381         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
35382                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35383                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
35384         }
35385         void* signer_provider_ptr = untag_ptr(signer_provider);
35386         CHECK_ACCESS(signer_provider_ptr);
35387         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
35388         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
35389                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35390                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
35391         }
35392         LDKMonitorUpdatingPersister ret_var = MonitorUpdatingPersister_new(kv_store_conv, logger_conv, maximum_pending_updates, entropy_source_conv, signer_provider_conv);
35393         uint64_t ret_ref = 0;
35394         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35395         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35396         return ret_ref;
35397 }
35398
35399 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) {
35400         LDKMonitorUpdatingPersister this_arg_conv;
35401         this_arg_conv.inner = untag_ptr(this_arg);
35402         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35404         this_arg_conv.is_owned = false;
35405         void* broadcaster_ptr = untag_ptr(broadcaster);
35406         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
35407         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
35408         void* fee_estimator_ptr = untag_ptr(fee_estimator);
35409         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
35410         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
35411         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
35412         *ret_conv = MonitorUpdatingPersister_read_all_channel_monitors_with_updates(&this_arg_conv, broadcaster_conv, fee_estimator_conv);
35413         return tag_ptr(ret_conv, true);
35414 }
35415
35416 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) {
35417         LDKMonitorUpdatingPersister this_arg_conv;
35418         this_arg_conv.inner = untag_ptr(this_arg);
35419         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35421         this_arg_conv.is_owned = false;
35422         void* broadcaster_ptr = untag_ptr(broadcaster);
35423         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
35424         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
35425         void* fee_estimator_ptr = untag_ptr(fee_estimator);
35426         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
35427         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
35428         LDKStr monitor_key_conv = str_ref_to_owned_c(monitor_key);
35429         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
35430         *ret_conv = MonitorUpdatingPersister_read_channel_monitor_with_updates(&this_arg_conv, broadcaster_conv, fee_estimator_conv, monitor_key_conv);
35431         return tag_ptr(ret_conv, true);
35432 }
35433
35434 uint64_t  __attribute__((export_name("TS_MonitorUpdatingPersister_cleanup_stale_updates"))) TS_MonitorUpdatingPersister_cleanup_stale_updates(uint64_t this_arg, jboolean lazy) {
35435         LDKMonitorUpdatingPersister this_arg_conv;
35436         this_arg_conv.inner = untag_ptr(this_arg);
35437         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35439         this_arg_conv.is_owned = false;
35440         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
35441         *ret_conv = MonitorUpdatingPersister_cleanup_stale_updates(&this_arg_conv, lazy);
35442         return tag_ptr(ret_conv, true);
35443 }
35444
35445 uint64_t  __attribute__((export_name("TS_MonitorUpdatingPersister_as_Persist"))) TS_MonitorUpdatingPersister_as_Persist(uint64_t this_arg) {
35446         LDKMonitorUpdatingPersister this_arg_conv;
35447         this_arg_conv.inner = untag_ptr(this_arg);
35448         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35450         this_arg_conv.is_owned = false;
35451         LDKPersist* ret_ret = MALLOC(sizeof(LDKPersist), "LDKPersist");
35452         *ret_ret = MonitorUpdatingPersister_as_Persist(&this_arg_conv);
35453         return tag_ptr(ret_ret, true);
35454 }
35455
35456 uint32_t  __attribute__((export_name("TS_ShortChannelIdError_clone"))) TS_ShortChannelIdError_clone(uint64_t orig) {
35457         LDKShortChannelIdError* orig_conv = (LDKShortChannelIdError*)untag_ptr(orig);
35458         uint32_t ret_conv = LDKShortChannelIdError_to_js(ShortChannelIdError_clone(orig_conv));
35459         return ret_conv;
35460 }
35461
35462 uint32_t  __attribute__((export_name("TS_ShortChannelIdError_block_overflow"))) TS_ShortChannelIdError_block_overflow() {
35463         uint32_t ret_conv = LDKShortChannelIdError_to_js(ShortChannelIdError_block_overflow());
35464         return ret_conv;
35465 }
35466
35467 uint32_t  __attribute__((export_name("TS_ShortChannelIdError_tx_index_overflow"))) TS_ShortChannelIdError_tx_index_overflow() {
35468         uint32_t ret_conv = LDKShortChannelIdError_to_js(ShortChannelIdError_tx_index_overflow());
35469         return ret_conv;
35470 }
35471
35472 uint32_t  __attribute__((export_name("TS_ShortChannelIdError_vout_index_overflow"))) TS_ShortChannelIdError_vout_index_overflow() {
35473         uint32_t ret_conv = LDKShortChannelIdError_to_js(ShortChannelIdError_vout_index_overflow());
35474         return ret_conv;
35475 }
35476
35477 jboolean  __attribute__((export_name("TS_ShortChannelIdError_eq"))) TS_ShortChannelIdError_eq(uint64_t a, uint64_t b) {
35478         LDKShortChannelIdError* a_conv = (LDKShortChannelIdError*)untag_ptr(a);
35479         LDKShortChannelIdError* b_conv = (LDKShortChannelIdError*)untag_ptr(b);
35480         jboolean ret_conv = ShortChannelIdError_eq(a_conv, b_conv);
35481         return ret_conv;
35482 }
35483
35484 int32_t  __attribute__((export_name("TS_block_from_scid"))) TS_block_from_scid(int64_t short_channel_id) {
35485         int32_t ret_conv = block_from_scid(short_channel_id);
35486         return ret_conv;
35487 }
35488
35489 int32_t  __attribute__((export_name("TS_tx_index_from_scid"))) TS_tx_index_from_scid(int64_t short_channel_id) {
35490         int32_t ret_conv = tx_index_from_scid(short_channel_id);
35491         return ret_conv;
35492 }
35493
35494 int16_t  __attribute__((export_name("TS_vout_from_scid"))) TS_vout_from_scid(int64_t short_channel_id) {
35495         int16_t ret_conv = vout_from_scid(short_channel_id);
35496         return ret_conv;
35497 }
35498
35499 uint64_t  __attribute__((export_name("TS_scid_from_parts"))) TS_scid_from_parts(int64_t block, int64_t tx_index, int64_t vout_index) {
35500         LDKCResult_u64ShortChannelIdErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u64ShortChannelIdErrorZ), "LDKCResult_u64ShortChannelIdErrorZ");
35501         *ret_conv = scid_from_parts(block, tx_index, vout_index);
35502         return tag_ptr(ret_conv, true);
35503 }
35504
35505 void  __attribute__((export_name("TS_UntrustedString_free"))) TS_UntrustedString_free(uint64_t this_obj) {
35506         LDKUntrustedString this_obj_conv;
35507         this_obj_conv.inner = untag_ptr(this_obj);
35508         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35510         UntrustedString_free(this_obj_conv);
35511 }
35512
35513 jstring  __attribute__((export_name("TS_UntrustedString_get_a"))) TS_UntrustedString_get_a(uint64_t this_ptr) {
35514         LDKUntrustedString this_ptr_conv;
35515         this_ptr_conv.inner = untag_ptr(this_ptr);
35516         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35518         this_ptr_conv.is_owned = false;
35519         LDKStr ret_str = UntrustedString_get_a(&this_ptr_conv);
35520         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
35521         Str_free(ret_str);
35522         return ret_conv;
35523 }
35524
35525 void  __attribute__((export_name("TS_UntrustedString_set_a"))) TS_UntrustedString_set_a(uint64_t this_ptr, jstring val) {
35526         LDKUntrustedString this_ptr_conv;
35527         this_ptr_conv.inner = untag_ptr(this_ptr);
35528         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35530         this_ptr_conv.is_owned = false;
35531         LDKStr val_conv = str_ref_to_owned_c(val);
35532         UntrustedString_set_a(&this_ptr_conv, val_conv);
35533 }
35534
35535 uint64_t  __attribute__((export_name("TS_UntrustedString_new"))) TS_UntrustedString_new(jstring a_arg) {
35536         LDKStr a_arg_conv = str_ref_to_owned_c(a_arg);
35537         LDKUntrustedString ret_var = UntrustedString_new(a_arg_conv);
35538         uint64_t ret_ref = 0;
35539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35540         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35541         return ret_ref;
35542 }
35543
35544 static inline uint64_t UntrustedString_clone_ptr(LDKUntrustedString *NONNULL_PTR arg) {
35545         LDKUntrustedString ret_var = UntrustedString_clone(arg);
35546         uint64_t ret_ref = 0;
35547         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35548         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35549         return ret_ref;
35550 }
35551 int64_t  __attribute__((export_name("TS_UntrustedString_clone_ptr"))) TS_UntrustedString_clone_ptr(uint64_t arg) {
35552         LDKUntrustedString arg_conv;
35553         arg_conv.inner = untag_ptr(arg);
35554         arg_conv.is_owned = ptr_is_owned(arg);
35555         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35556         arg_conv.is_owned = false;
35557         int64_t ret_conv = UntrustedString_clone_ptr(&arg_conv);
35558         return ret_conv;
35559 }
35560
35561 uint64_t  __attribute__((export_name("TS_UntrustedString_clone"))) TS_UntrustedString_clone(uint64_t orig) {
35562         LDKUntrustedString orig_conv;
35563         orig_conv.inner = untag_ptr(orig);
35564         orig_conv.is_owned = ptr_is_owned(orig);
35565         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35566         orig_conv.is_owned = false;
35567         LDKUntrustedString ret_var = UntrustedString_clone(&orig_conv);
35568         uint64_t ret_ref = 0;
35569         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35570         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35571         return ret_ref;
35572 }
35573
35574 jboolean  __attribute__((export_name("TS_UntrustedString_eq"))) TS_UntrustedString_eq(uint64_t a, uint64_t b) {
35575         LDKUntrustedString a_conv;
35576         a_conv.inner = untag_ptr(a);
35577         a_conv.is_owned = ptr_is_owned(a);
35578         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35579         a_conv.is_owned = false;
35580         LDKUntrustedString b_conv;
35581         b_conv.inner = untag_ptr(b);
35582         b_conv.is_owned = ptr_is_owned(b);
35583         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35584         b_conv.is_owned = false;
35585         jboolean ret_conv = UntrustedString_eq(&a_conv, &b_conv);
35586         return ret_conv;
35587 }
35588
35589 int64_t  __attribute__((export_name("TS_UntrustedString_hash"))) TS_UntrustedString_hash(uint64_t o) {
35590         LDKUntrustedString o_conv;
35591         o_conv.inner = untag_ptr(o);
35592         o_conv.is_owned = ptr_is_owned(o);
35593         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35594         o_conv.is_owned = false;
35595         int64_t ret_conv = UntrustedString_hash(&o_conv);
35596         return ret_conv;
35597 }
35598
35599 int8_tArray  __attribute__((export_name("TS_UntrustedString_write"))) TS_UntrustedString_write(uint64_t obj) {
35600         LDKUntrustedString obj_conv;
35601         obj_conv.inner = untag_ptr(obj);
35602         obj_conv.is_owned = ptr_is_owned(obj);
35603         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35604         obj_conv.is_owned = false;
35605         LDKCVec_u8Z ret_var = UntrustedString_write(&obj_conv);
35606         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35607         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35608         CVec_u8Z_free(ret_var);
35609         return ret_arr;
35610 }
35611
35612 uint64_t  __attribute__((export_name("TS_UntrustedString_read"))) TS_UntrustedString_read(int8_tArray ser) {
35613         LDKu8slice ser_ref;
35614         ser_ref.datalen = ser->arr_len;
35615         ser_ref.data = ser->elems;
35616         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
35617         *ret_conv = UntrustedString_read(ser_ref);
35618         FREE(ser);
35619         return tag_ptr(ret_conv, true);
35620 }
35621
35622 void  __attribute__((export_name("TS_PrintableString_free"))) TS_PrintableString_free(uint64_t this_obj) {
35623         LDKPrintableString this_obj_conv;
35624         this_obj_conv.inner = untag_ptr(this_obj);
35625         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35627         PrintableString_free(this_obj_conv);
35628 }
35629
35630 jstring  __attribute__((export_name("TS_PrintableString_get_a"))) TS_PrintableString_get_a(uint64_t this_ptr) {
35631         LDKPrintableString this_ptr_conv;
35632         this_ptr_conv.inner = untag_ptr(this_ptr);
35633         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35635         this_ptr_conv.is_owned = false;
35636         LDKStr ret_str = PrintableString_get_a(&this_ptr_conv);
35637         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
35638         Str_free(ret_str);
35639         return ret_conv;
35640 }
35641
35642 void  __attribute__((export_name("TS_PrintableString_set_a"))) TS_PrintableString_set_a(uint64_t this_ptr, jstring val) {
35643         LDKPrintableString this_ptr_conv;
35644         this_ptr_conv.inner = untag_ptr(this_ptr);
35645         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35647         this_ptr_conv.is_owned = false;
35648         LDKStr val_conv = str_ref_to_owned_c(val);
35649         PrintableString_set_a(&this_ptr_conv, val_conv);
35650 }
35651
35652 uint64_t  __attribute__((export_name("TS_PrintableString_new"))) TS_PrintableString_new(jstring a_arg) {
35653         LDKStr a_arg_conv = str_ref_to_owned_c(a_arg);
35654         LDKPrintableString ret_var = PrintableString_new(a_arg_conv);
35655         uint64_t ret_ref = 0;
35656         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35657         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35658         return ret_ref;
35659 }
35660
35661 void  __attribute__((export_name("TS_TrackedSpendableOutput_free"))) TS_TrackedSpendableOutput_free(uint64_t this_obj) {
35662         LDKTrackedSpendableOutput this_obj_conv;
35663         this_obj_conv.inner = untag_ptr(this_obj);
35664         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35666         TrackedSpendableOutput_free(this_obj_conv);
35667 }
35668
35669 uint64_t  __attribute__((export_name("TS_TrackedSpendableOutput_get_descriptor"))) TS_TrackedSpendableOutput_get_descriptor(uint64_t this_ptr) {
35670         LDKTrackedSpendableOutput this_ptr_conv;
35671         this_ptr_conv.inner = untag_ptr(this_ptr);
35672         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35674         this_ptr_conv.is_owned = false;
35675         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
35676         *ret_copy = TrackedSpendableOutput_get_descriptor(&this_ptr_conv);
35677         uint64_t ret_ref = tag_ptr(ret_copy, true);
35678         return ret_ref;
35679 }
35680
35681 void  __attribute__((export_name("TS_TrackedSpendableOutput_set_descriptor"))) TS_TrackedSpendableOutput_set_descriptor(uint64_t this_ptr, uint64_t val) {
35682         LDKTrackedSpendableOutput this_ptr_conv;
35683         this_ptr_conv.inner = untag_ptr(this_ptr);
35684         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35686         this_ptr_conv.is_owned = false;
35687         void* val_ptr = untag_ptr(val);
35688         CHECK_ACCESS(val_ptr);
35689         LDKSpendableOutputDescriptor val_conv = *(LDKSpendableOutputDescriptor*)(val_ptr);
35690         val_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(val));
35691         TrackedSpendableOutput_set_descriptor(&this_ptr_conv, val_conv);
35692 }
35693
35694 uint64_t  __attribute__((export_name("TS_TrackedSpendableOutput_get_channel_id"))) TS_TrackedSpendableOutput_get_channel_id(uint64_t this_ptr) {
35695         LDKTrackedSpendableOutput this_ptr_conv;
35696         this_ptr_conv.inner = untag_ptr(this_ptr);
35697         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35699         this_ptr_conv.is_owned = false;
35700         LDKChannelId ret_var = TrackedSpendableOutput_get_channel_id(&this_ptr_conv);
35701         uint64_t ret_ref = 0;
35702         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35703         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35704         return ret_ref;
35705 }
35706
35707 void  __attribute__((export_name("TS_TrackedSpendableOutput_set_channel_id"))) TS_TrackedSpendableOutput_set_channel_id(uint64_t this_ptr, uint64_t val) {
35708         LDKTrackedSpendableOutput this_ptr_conv;
35709         this_ptr_conv.inner = untag_ptr(this_ptr);
35710         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35712         this_ptr_conv.is_owned = false;
35713         LDKChannelId val_conv;
35714         val_conv.inner = untag_ptr(val);
35715         val_conv.is_owned = ptr_is_owned(val);
35716         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35717         val_conv = ChannelId_clone(&val_conv);
35718         TrackedSpendableOutput_set_channel_id(&this_ptr_conv, val_conv);
35719 }
35720
35721 uint64_t  __attribute__((export_name("TS_TrackedSpendableOutput_get_status"))) TS_TrackedSpendableOutput_get_status(uint64_t this_ptr) {
35722         LDKTrackedSpendableOutput this_ptr_conv;
35723         this_ptr_conv.inner = untag_ptr(this_ptr);
35724         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35726         this_ptr_conv.is_owned = false;
35727         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
35728         *ret_copy = TrackedSpendableOutput_get_status(&this_ptr_conv);
35729         uint64_t ret_ref = tag_ptr(ret_copy, true);
35730         return ret_ref;
35731 }
35732
35733 void  __attribute__((export_name("TS_TrackedSpendableOutput_set_status"))) TS_TrackedSpendableOutput_set_status(uint64_t this_ptr, uint64_t val) {
35734         LDKTrackedSpendableOutput this_ptr_conv;
35735         this_ptr_conv.inner = untag_ptr(this_ptr);
35736         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35738         this_ptr_conv.is_owned = false;
35739         void* val_ptr = untag_ptr(val);
35740         CHECK_ACCESS(val_ptr);
35741         LDKOutputSpendStatus val_conv = *(LDKOutputSpendStatus*)(val_ptr);
35742         val_conv = OutputSpendStatus_clone((LDKOutputSpendStatus*)untag_ptr(val));
35743         TrackedSpendableOutput_set_status(&this_ptr_conv, val_conv);
35744 }
35745
35746 uint64_t  __attribute__((export_name("TS_TrackedSpendableOutput_new"))) TS_TrackedSpendableOutput_new(uint64_t descriptor_arg, uint64_t channel_id_arg, uint64_t status_arg) {
35747         void* descriptor_arg_ptr = untag_ptr(descriptor_arg);
35748         CHECK_ACCESS(descriptor_arg_ptr);
35749         LDKSpendableOutputDescriptor descriptor_arg_conv = *(LDKSpendableOutputDescriptor*)(descriptor_arg_ptr);
35750         descriptor_arg_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptor_arg));
35751         LDKChannelId channel_id_arg_conv;
35752         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
35753         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
35754         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
35755         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
35756         void* status_arg_ptr = untag_ptr(status_arg);
35757         CHECK_ACCESS(status_arg_ptr);
35758         LDKOutputSpendStatus status_arg_conv = *(LDKOutputSpendStatus*)(status_arg_ptr);
35759         status_arg_conv = OutputSpendStatus_clone((LDKOutputSpendStatus*)untag_ptr(status_arg));
35760         LDKTrackedSpendableOutput ret_var = TrackedSpendableOutput_new(descriptor_arg_conv, channel_id_arg_conv, status_arg_conv);
35761         uint64_t ret_ref = 0;
35762         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35763         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35764         return ret_ref;
35765 }
35766
35767 static inline uint64_t TrackedSpendableOutput_clone_ptr(LDKTrackedSpendableOutput *NONNULL_PTR arg) {
35768         LDKTrackedSpendableOutput ret_var = TrackedSpendableOutput_clone(arg);
35769         uint64_t ret_ref = 0;
35770         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35771         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35772         return ret_ref;
35773 }
35774 int64_t  __attribute__((export_name("TS_TrackedSpendableOutput_clone_ptr"))) TS_TrackedSpendableOutput_clone_ptr(uint64_t arg) {
35775         LDKTrackedSpendableOutput arg_conv;
35776         arg_conv.inner = untag_ptr(arg);
35777         arg_conv.is_owned = ptr_is_owned(arg);
35778         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35779         arg_conv.is_owned = false;
35780         int64_t ret_conv = TrackedSpendableOutput_clone_ptr(&arg_conv);
35781         return ret_conv;
35782 }
35783
35784 uint64_t  __attribute__((export_name("TS_TrackedSpendableOutput_clone"))) TS_TrackedSpendableOutput_clone(uint64_t orig) {
35785         LDKTrackedSpendableOutput orig_conv;
35786         orig_conv.inner = untag_ptr(orig);
35787         orig_conv.is_owned = ptr_is_owned(orig);
35788         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35789         orig_conv.is_owned = false;
35790         LDKTrackedSpendableOutput ret_var = TrackedSpendableOutput_clone(&orig_conv);
35791         uint64_t ret_ref = 0;
35792         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35793         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35794         return ret_ref;
35795 }
35796
35797 jboolean  __attribute__((export_name("TS_TrackedSpendableOutput_eq"))) TS_TrackedSpendableOutput_eq(uint64_t a, uint64_t b) {
35798         LDKTrackedSpendableOutput a_conv;
35799         a_conv.inner = untag_ptr(a);
35800         a_conv.is_owned = ptr_is_owned(a);
35801         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35802         a_conv.is_owned = false;
35803         LDKTrackedSpendableOutput b_conv;
35804         b_conv.inner = untag_ptr(b);
35805         b_conv.is_owned = ptr_is_owned(b);
35806         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35807         b_conv.is_owned = false;
35808         jboolean ret_conv = TrackedSpendableOutput_eq(&a_conv, &b_conv);
35809         return ret_conv;
35810 }
35811
35812 jboolean  __attribute__((export_name("TS_TrackedSpendableOutput_is_spent_in"))) TS_TrackedSpendableOutput_is_spent_in(uint64_t this_arg, int8_tArray tx) {
35813         LDKTrackedSpendableOutput this_arg_conv;
35814         this_arg_conv.inner = untag_ptr(this_arg);
35815         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35817         this_arg_conv.is_owned = false;
35818         LDKTransaction tx_ref;
35819         tx_ref.datalen = tx->arr_len;
35820         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
35821         memcpy(tx_ref.data, tx->elems, tx_ref.datalen); FREE(tx);
35822         tx_ref.data_is_owned = true;
35823         jboolean ret_conv = TrackedSpendableOutput_is_spent_in(&this_arg_conv, tx_ref);
35824         return ret_conv;
35825 }
35826
35827 int8_tArray  __attribute__((export_name("TS_TrackedSpendableOutput_write"))) TS_TrackedSpendableOutput_write(uint64_t obj) {
35828         LDKTrackedSpendableOutput obj_conv;
35829         obj_conv.inner = untag_ptr(obj);
35830         obj_conv.is_owned = ptr_is_owned(obj);
35831         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35832         obj_conv.is_owned = false;
35833         LDKCVec_u8Z ret_var = TrackedSpendableOutput_write(&obj_conv);
35834         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35835         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35836         CVec_u8Z_free(ret_var);
35837         return ret_arr;
35838 }
35839
35840 uint64_t  __attribute__((export_name("TS_TrackedSpendableOutput_read"))) TS_TrackedSpendableOutput_read(int8_tArray ser) {
35841         LDKu8slice ser_ref;
35842         ser_ref.datalen = ser->arr_len;
35843         ser_ref.data = ser->elems;
35844         LDKCResult_TrackedSpendableOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TrackedSpendableOutputDecodeErrorZ), "LDKCResult_TrackedSpendableOutputDecodeErrorZ");
35845         *ret_conv = TrackedSpendableOutput_read(ser_ref);
35846         FREE(ser);
35847         return tag_ptr(ret_conv, true);
35848 }
35849
35850 void  __attribute__((export_name("TS_OutputSpendStatus_free"))) TS_OutputSpendStatus_free(uint64_t this_ptr) {
35851         if (!ptr_is_owned(this_ptr)) return;
35852         void* this_ptr_ptr = untag_ptr(this_ptr);
35853         CHECK_ACCESS(this_ptr_ptr);
35854         LDKOutputSpendStatus this_ptr_conv = *(LDKOutputSpendStatus*)(this_ptr_ptr);
35855         FREE(untag_ptr(this_ptr));
35856         OutputSpendStatus_free(this_ptr_conv);
35857 }
35858
35859 static inline uint64_t OutputSpendStatus_clone_ptr(LDKOutputSpendStatus *NONNULL_PTR arg) {
35860         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
35861         *ret_copy = OutputSpendStatus_clone(arg);
35862         uint64_t ret_ref = tag_ptr(ret_copy, true);
35863         return ret_ref;
35864 }
35865 int64_t  __attribute__((export_name("TS_OutputSpendStatus_clone_ptr"))) TS_OutputSpendStatus_clone_ptr(uint64_t arg) {
35866         LDKOutputSpendStatus* arg_conv = (LDKOutputSpendStatus*)untag_ptr(arg);
35867         int64_t ret_conv = OutputSpendStatus_clone_ptr(arg_conv);
35868         return ret_conv;
35869 }
35870
35871 uint64_t  __attribute__((export_name("TS_OutputSpendStatus_clone"))) TS_OutputSpendStatus_clone(uint64_t orig) {
35872         LDKOutputSpendStatus* orig_conv = (LDKOutputSpendStatus*)untag_ptr(orig);
35873         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
35874         *ret_copy = OutputSpendStatus_clone(orig_conv);
35875         uint64_t ret_ref = tag_ptr(ret_copy, true);
35876         return ret_ref;
35877 }
35878
35879 uint64_t  __attribute__((export_name("TS_OutputSpendStatus_pending_initial_broadcast"))) TS_OutputSpendStatus_pending_initial_broadcast(uint64_t delayed_until_height) {
35880         void* delayed_until_height_ptr = untag_ptr(delayed_until_height);
35881         CHECK_ACCESS(delayed_until_height_ptr);
35882         LDKCOption_u32Z delayed_until_height_conv = *(LDKCOption_u32Z*)(delayed_until_height_ptr);
35883         delayed_until_height_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(delayed_until_height));
35884         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
35885         *ret_copy = OutputSpendStatus_pending_initial_broadcast(delayed_until_height_conv);
35886         uint64_t ret_ref = tag_ptr(ret_copy, true);
35887         return ret_ref;
35888 }
35889
35890 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) {
35891         LDKThirtyTwoBytes first_broadcast_hash_ref;
35892         CHECK(first_broadcast_hash->arr_len == 32);
35893         memcpy(first_broadcast_hash_ref.data, first_broadcast_hash->elems, 32); FREE(first_broadcast_hash);
35894         LDKTransaction latest_spending_tx_ref;
35895         latest_spending_tx_ref.datalen = latest_spending_tx->arr_len;
35896         latest_spending_tx_ref.data = MALLOC(latest_spending_tx_ref.datalen, "LDKTransaction Bytes");
35897         memcpy(latest_spending_tx_ref.data, latest_spending_tx->elems, latest_spending_tx_ref.datalen); FREE(latest_spending_tx);
35898         latest_spending_tx_ref.data_is_owned = true;
35899         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
35900         *ret_copy = OutputSpendStatus_pending_first_confirmation(first_broadcast_hash_ref, latest_broadcast_height, latest_spending_tx_ref);
35901         uint64_t ret_ref = tag_ptr(ret_copy, true);
35902         return ret_ref;
35903 }
35904
35905 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) {
35906         LDKThirtyTwoBytes first_broadcast_hash_ref;
35907         CHECK(first_broadcast_hash->arr_len == 32);
35908         memcpy(first_broadcast_hash_ref.data, first_broadcast_hash->elems, 32); FREE(first_broadcast_hash);
35909         LDKTransaction latest_spending_tx_ref;
35910         latest_spending_tx_ref.datalen = latest_spending_tx->arr_len;
35911         latest_spending_tx_ref.data = MALLOC(latest_spending_tx_ref.datalen, "LDKTransaction Bytes");
35912         memcpy(latest_spending_tx_ref.data, latest_spending_tx->elems, latest_spending_tx_ref.datalen); FREE(latest_spending_tx);
35913         latest_spending_tx_ref.data_is_owned = true;
35914         LDKThirtyTwoBytes confirmation_hash_ref;
35915         CHECK(confirmation_hash->arr_len == 32);
35916         memcpy(confirmation_hash_ref.data, confirmation_hash->elems, 32); FREE(confirmation_hash);
35917         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
35918         *ret_copy = OutputSpendStatus_pending_threshold_confirmations(first_broadcast_hash_ref, latest_broadcast_height, latest_spending_tx_ref, confirmation_height, confirmation_hash_ref);
35919         uint64_t ret_ref = tag_ptr(ret_copy, true);
35920         return ret_ref;
35921 }
35922
35923 jboolean  __attribute__((export_name("TS_OutputSpendStatus_eq"))) TS_OutputSpendStatus_eq(uint64_t a, uint64_t b) {
35924         LDKOutputSpendStatus* a_conv = (LDKOutputSpendStatus*)untag_ptr(a);
35925         LDKOutputSpendStatus* b_conv = (LDKOutputSpendStatus*)untag_ptr(b);
35926         jboolean ret_conv = OutputSpendStatus_eq(a_conv, b_conv);
35927         return ret_conv;
35928 }
35929
35930 int8_tArray  __attribute__((export_name("TS_OutputSpendStatus_write"))) TS_OutputSpendStatus_write(uint64_t obj) {
35931         LDKOutputSpendStatus* obj_conv = (LDKOutputSpendStatus*)untag_ptr(obj);
35932         LDKCVec_u8Z ret_var = OutputSpendStatus_write(obj_conv);
35933         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35934         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35935         CVec_u8Z_free(ret_var);
35936         return ret_arr;
35937 }
35938
35939 uint64_t  __attribute__((export_name("TS_OutputSpendStatus_read"))) TS_OutputSpendStatus_read(int8_tArray ser) {
35940         LDKu8slice ser_ref;
35941         ser_ref.datalen = ser->arr_len;
35942         ser_ref.data = ser->elems;
35943         LDKCResult_OutputSpendStatusDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSpendStatusDecodeErrorZ), "LDKCResult_OutputSpendStatusDecodeErrorZ");
35944         *ret_conv = OutputSpendStatus_read(ser_ref);
35945         FREE(ser);
35946         return tag_ptr(ret_conv, true);
35947 }
35948
35949 void  __attribute__((export_name("TS_OutputSweeper_free"))) TS_OutputSweeper_free(uint64_t this_obj) {
35950         LDKOutputSweeper this_obj_conv;
35951         this_obj_conv.inner = untag_ptr(this_obj);
35952         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35954         OutputSweeper_free(this_obj_conv);
35955 }
35956
35957 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) {
35958         LDKBestBlock best_block_conv;
35959         best_block_conv.inner = untag_ptr(best_block);
35960         best_block_conv.is_owned = ptr_is_owned(best_block);
35961         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_conv);
35962         best_block_conv = BestBlock_clone(&best_block_conv);
35963         void* broadcaster_ptr = untag_ptr(broadcaster);
35964         CHECK_ACCESS(broadcaster_ptr);
35965         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
35966         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
35967                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35968                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
35969         }
35970         void* fee_estimator_ptr = untag_ptr(fee_estimator);
35971         CHECK_ACCESS(fee_estimator_ptr);
35972         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
35973         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
35974                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35975                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
35976         }
35977         void* chain_data_source_ptr = untag_ptr(chain_data_source);
35978         CHECK_ACCESS(chain_data_source_ptr);
35979         LDKCOption_FilterZ chain_data_source_conv = *(LDKCOption_FilterZ*)(chain_data_source_ptr);
35980         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
35981         if (chain_data_source_conv.tag == LDKCOption_FilterZ_Some) {
35982                 // Manually implement clone for Java trait instances
35983                 if (chain_data_source_conv.some.free == LDKFilter_JCalls_free) {
35984                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35985                         LDKFilter_JCalls_cloned(&chain_data_source_conv.some);
35986                 }
35987         }
35988         void* output_spender_ptr = untag_ptr(output_spender);
35989         CHECK_ACCESS(output_spender_ptr);
35990         LDKOutputSpender output_spender_conv = *(LDKOutputSpender*)(output_spender_ptr);
35991         if (output_spender_conv.free == LDKOutputSpender_JCalls_free) {
35992                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35993                 LDKOutputSpender_JCalls_cloned(&output_spender_conv);
35994         }
35995         void* change_destination_source_ptr = untag_ptr(change_destination_source);
35996         CHECK_ACCESS(change_destination_source_ptr);
35997         LDKChangeDestinationSource change_destination_source_conv = *(LDKChangeDestinationSource*)(change_destination_source_ptr);
35998         if (change_destination_source_conv.free == LDKChangeDestinationSource_JCalls_free) {
35999                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36000                 LDKChangeDestinationSource_JCalls_cloned(&change_destination_source_conv);
36001         }
36002         void* kv_store_ptr = untag_ptr(kv_store);
36003         CHECK_ACCESS(kv_store_ptr);
36004         LDKKVStore kv_store_conv = *(LDKKVStore*)(kv_store_ptr);
36005         if (kv_store_conv.free == LDKKVStore_JCalls_free) {
36006                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36007                 LDKKVStore_JCalls_cloned(&kv_store_conv);
36008         }
36009         void* logger_ptr = untag_ptr(logger);
36010         CHECK_ACCESS(logger_ptr);
36011         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
36012         if (logger_conv.free == LDKLogger_JCalls_free) {
36013                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36014                 LDKLogger_JCalls_cloned(&logger_conv);
36015         }
36016         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);
36017         uint64_t ret_ref = 0;
36018         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36019         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36020         return ret_ref;
36021 }
36022
36023 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) {
36024         LDKOutputSweeper this_arg_conv;
36025         this_arg_conv.inner = untag_ptr(this_arg);
36026         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36028         this_arg_conv.is_owned = false;
36029         LDKCVec_SpendableOutputDescriptorZ output_descriptors_constr;
36030         output_descriptors_constr.datalen = output_descriptors->arr_len;
36031         if (output_descriptors_constr.datalen > 0)
36032                 output_descriptors_constr.data = MALLOC(output_descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
36033         else
36034                 output_descriptors_constr.data = NULL;
36035         uint64_t* output_descriptors_vals = output_descriptors->elems;
36036         for (size_t b = 0; b < output_descriptors_constr.datalen; b++) {
36037                 uint64_t output_descriptors_conv_27 = output_descriptors_vals[b];
36038                 void* output_descriptors_conv_27_ptr = untag_ptr(output_descriptors_conv_27);
36039                 CHECK_ACCESS(output_descriptors_conv_27_ptr);
36040                 LDKSpendableOutputDescriptor output_descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(output_descriptors_conv_27_ptr);
36041                 output_descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(output_descriptors_conv_27));
36042                 output_descriptors_constr.data[b] = output_descriptors_conv_27_conv;
36043         }
36044         FREE(output_descriptors);
36045         LDKChannelId channel_id_conv;
36046         channel_id_conv.inner = untag_ptr(channel_id);
36047         channel_id_conv.is_owned = ptr_is_owned(channel_id);
36048         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
36049         channel_id_conv = ChannelId_clone(&channel_id_conv);
36050         void* delay_until_height_ptr = untag_ptr(delay_until_height);
36051         CHECK_ACCESS(delay_until_height_ptr);
36052         LDKCOption_u32Z delay_until_height_conv = *(LDKCOption_u32Z*)(delay_until_height_ptr);
36053         delay_until_height_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(delay_until_height));
36054         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
36055         *ret_conv = OutputSweeper_track_spendable_outputs(&this_arg_conv, output_descriptors_constr, channel_id_conv, exclude_static_outputs, delay_until_height_conv);
36056         return tag_ptr(ret_conv, true);
36057 }
36058
36059 uint64_tArray  __attribute__((export_name("TS_OutputSweeper_tracked_spendable_outputs"))) TS_OutputSweeper_tracked_spendable_outputs(uint64_t this_arg) {
36060         LDKOutputSweeper this_arg_conv;
36061         this_arg_conv.inner = untag_ptr(this_arg);
36062         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36064         this_arg_conv.is_owned = false;
36065         LDKCVec_TrackedSpendableOutputZ ret_var = OutputSweeper_tracked_spendable_outputs(&this_arg_conv);
36066         uint64_tArray ret_arr = NULL;
36067         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
36068         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
36069         for (size_t y = 0; y < ret_var.datalen; y++) {
36070                 LDKTrackedSpendableOutput ret_conv_24_var = ret_var.data[y];
36071                 uint64_t ret_conv_24_ref = 0;
36072                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_24_var);
36073                 ret_conv_24_ref = tag_ptr(ret_conv_24_var.inner, ret_conv_24_var.is_owned);
36074                 ret_arr_ptr[y] = ret_conv_24_ref;
36075         }
36076         
36077         FREE(ret_var.data);
36078         return ret_arr;
36079 }
36080
36081 uint64_t  __attribute__((export_name("TS_OutputSweeper_current_best_block"))) TS_OutputSweeper_current_best_block(uint64_t this_arg) {
36082         LDKOutputSweeper this_arg_conv;
36083         this_arg_conv.inner = untag_ptr(this_arg);
36084         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36086         this_arg_conv.is_owned = false;
36087         LDKBestBlock ret_var = OutputSweeper_current_best_block(&this_arg_conv);
36088         uint64_t ret_ref = 0;
36089         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36090         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36091         return ret_ref;
36092 }
36093
36094 uint64_t  __attribute__((export_name("TS_OutputSweeper_as_Listen"))) TS_OutputSweeper_as_Listen(uint64_t this_arg) {
36095         LDKOutputSweeper this_arg_conv;
36096         this_arg_conv.inner = untag_ptr(this_arg);
36097         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36099         this_arg_conv.is_owned = false;
36100         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
36101         *ret_ret = OutputSweeper_as_Listen(&this_arg_conv);
36102         return tag_ptr(ret_ret, true);
36103 }
36104
36105 uint64_t  __attribute__((export_name("TS_OutputSweeper_as_Confirm"))) TS_OutputSweeper_as_Confirm(uint64_t this_arg) {
36106         LDKOutputSweeper this_arg_conv;
36107         this_arg_conv.inner = untag_ptr(this_arg);
36108         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36110         this_arg_conv.is_owned = false;
36111         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
36112         *ret_ret = OutputSweeper_as_Confirm(&this_arg_conv);
36113         return tag_ptr(ret_ret, true);
36114 }
36115
36116 void  __attribute__((export_name("TS_SpendingDelay_free"))) TS_SpendingDelay_free(uint64_t this_ptr) {
36117         if (!ptr_is_owned(this_ptr)) return;
36118         void* this_ptr_ptr = untag_ptr(this_ptr);
36119         CHECK_ACCESS(this_ptr_ptr);
36120         LDKSpendingDelay this_ptr_conv = *(LDKSpendingDelay*)(this_ptr_ptr);
36121         FREE(untag_ptr(this_ptr));
36122         SpendingDelay_free(this_ptr_conv);
36123 }
36124
36125 static inline uint64_t SpendingDelay_clone_ptr(LDKSpendingDelay *NONNULL_PTR arg) {
36126         LDKSpendingDelay *ret_copy = MALLOC(sizeof(LDKSpendingDelay), "LDKSpendingDelay");
36127         *ret_copy = SpendingDelay_clone(arg);
36128         uint64_t ret_ref = tag_ptr(ret_copy, true);
36129         return ret_ref;
36130 }
36131 int64_t  __attribute__((export_name("TS_SpendingDelay_clone_ptr"))) TS_SpendingDelay_clone_ptr(uint64_t arg) {
36132         LDKSpendingDelay* arg_conv = (LDKSpendingDelay*)untag_ptr(arg);
36133         int64_t ret_conv = SpendingDelay_clone_ptr(arg_conv);
36134         return ret_conv;
36135 }
36136
36137 uint64_t  __attribute__((export_name("TS_SpendingDelay_clone"))) TS_SpendingDelay_clone(uint64_t orig) {
36138         LDKSpendingDelay* orig_conv = (LDKSpendingDelay*)untag_ptr(orig);
36139         LDKSpendingDelay *ret_copy = MALLOC(sizeof(LDKSpendingDelay), "LDKSpendingDelay");
36140         *ret_copy = SpendingDelay_clone(orig_conv);
36141         uint64_t ret_ref = tag_ptr(ret_copy, true);
36142         return ret_ref;
36143 }
36144
36145 uint64_t  __attribute__((export_name("TS_SpendingDelay_relative"))) TS_SpendingDelay_relative(int32_t num_blocks) {
36146         LDKSpendingDelay *ret_copy = MALLOC(sizeof(LDKSpendingDelay), "LDKSpendingDelay");
36147         *ret_copy = SpendingDelay_relative(num_blocks);
36148         uint64_t ret_ref = tag_ptr(ret_copy, true);
36149         return ret_ref;
36150 }
36151
36152 uint64_t  __attribute__((export_name("TS_SpendingDelay_absolute"))) TS_SpendingDelay_absolute(int32_t height) {
36153         LDKSpendingDelay *ret_copy = MALLOC(sizeof(LDKSpendingDelay), "LDKSpendingDelay");
36154         *ret_copy = SpendingDelay_absolute(height);
36155         uint64_t ret_ref = tag_ptr(ret_copy, true);
36156         return ret_ref;
36157 }
36158
36159 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) {
36160         LDKu8slice ser_ref;
36161         ser_ref.datalen = ser->arr_len;
36162         ser_ref.data = ser->elems;
36163         void* arg_a_ptr = untag_ptr(arg_a);
36164         CHECK_ACCESS(arg_a_ptr);
36165         LDKBroadcasterInterface arg_a_conv = *(LDKBroadcasterInterface*)(arg_a_ptr);
36166         if (arg_a_conv.free == LDKBroadcasterInterface_JCalls_free) {
36167                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36168                 LDKBroadcasterInterface_JCalls_cloned(&arg_a_conv);
36169         }
36170         void* arg_b_ptr = untag_ptr(arg_b);
36171         CHECK_ACCESS(arg_b_ptr);
36172         LDKFeeEstimator arg_b_conv = *(LDKFeeEstimator*)(arg_b_ptr);
36173         if (arg_b_conv.free == LDKFeeEstimator_JCalls_free) {
36174                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36175                 LDKFeeEstimator_JCalls_cloned(&arg_b_conv);
36176         }
36177         void* arg_c_ptr = untag_ptr(arg_c);
36178         CHECK_ACCESS(arg_c_ptr);
36179         LDKCOption_FilterZ arg_c_conv = *(LDKCOption_FilterZ*)(arg_c_ptr);
36180         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
36181         if (arg_c_conv.tag == LDKCOption_FilterZ_Some) {
36182                 // Manually implement clone for Java trait instances
36183                 if (arg_c_conv.some.free == LDKFilter_JCalls_free) {
36184                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36185                         LDKFilter_JCalls_cloned(&arg_c_conv.some);
36186                 }
36187         }
36188         void* arg_d_ptr = untag_ptr(arg_d);
36189         CHECK_ACCESS(arg_d_ptr);
36190         LDKOutputSpender arg_d_conv = *(LDKOutputSpender*)(arg_d_ptr);
36191         if (arg_d_conv.free == LDKOutputSpender_JCalls_free) {
36192                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36193                 LDKOutputSpender_JCalls_cloned(&arg_d_conv);
36194         }
36195         void* arg_e_ptr = untag_ptr(arg_e);
36196         CHECK_ACCESS(arg_e_ptr);
36197         LDKChangeDestinationSource arg_e_conv = *(LDKChangeDestinationSource*)(arg_e_ptr);
36198         if (arg_e_conv.free == LDKChangeDestinationSource_JCalls_free) {
36199                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36200                 LDKChangeDestinationSource_JCalls_cloned(&arg_e_conv);
36201         }
36202         void* arg_f_ptr = untag_ptr(arg_f);
36203         CHECK_ACCESS(arg_f_ptr);
36204         LDKKVStore arg_f_conv = *(LDKKVStore*)(arg_f_ptr);
36205         if (arg_f_conv.free == LDKKVStore_JCalls_free) {
36206                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36207                 LDKKVStore_JCalls_cloned(&arg_f_conv);
36208         }
36209         void* arg_g_ptr = untag_ptr(arg_g);
36210         CHECK_ACCESS(arg_g_ptr);
36211         LDKLogger arg_g_conv = *(LDKLogger*)(arg_g_ptr);
36212         if (arg_g_conv.free == LDKLogger_JCalls_free) {
36213                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36214                 LDKLogger_JCalls_cloned(&arg_g_conv);
36215         }
36216         LDKCResult_OutputSweeperDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSweeperDecodeErrorZ), "LDKCResult_OutputSweeperDecodeErrorZ");
36217         *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);
36218         FREE(ser);
36219         return tag_ptr(ret_conv, true);
36220 }
36221
36222 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) {
36223         LDKu8slice ser_ref;
36224         ser_ref.datalen = ser->arr_len;
36225         ser_ref.data = ser->elems;
36226         void* arg_a_ptr = untag_ptr(arg_a);
36227         CHECK_ACCESS(arg_a_ptr);
36228         LDKBroadcasterInterface arg_a_conv = *(LDKBroadcasterInterface*)(arg_a_ptr);
36229         if (arg_a_conv.free == LDKBroadcasterInterface_JCalls_free) {
36230                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36231                 LDKBroadcasterInterface_JCalls_cloned(&arg_a_conv);
36232         }
36233         void* arg_b_ptr = untag_ptr(arg_b);
36234         CHECK_ACCESS(arg_b_ptr);
36235         LDKFeeEstimator arg_b_conv = *(LDKFeeEstimator*)(arg_b_ptr);
36236         if (arg_b_conv.free == LDKFeeEstimator_JCalls_free) {
36237                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36238                 LDKFeeEstimator_JCalls_cloned(&arg_b_conv);
36239         }
36240         void* arg_c_ptr = untag_ptr(arg_c);
36241         CHECK_ACCESS(arg_c_ptr);
36242         LDKCOption_FilterZ arg_c_conv = *(LDKCOption_FilterZ*)(arg_c_ptr);
36243         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
36244         if (arg_c_conv.tag == LDKCOption_FilterZ_Some) {
36245                 // Manually implement clone for Java trait instances
36246                 if (arg_c_conv.some.free == LDKFilter_JCalls_free) {
36247                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36248                         LDKFilter_JCalls_cloned(&arg_c_conv.some);
36249                 }
36250         }
36251         void* arg_d_ptr = untag_ptr(arg_d);
36252         CHECK_ACCESS(arg_d_ptr);
36253         LDKOutputSpender arg_d_conv = *(LDKOutputSpender*)(arg_d_ptr);
36254         if (arg_d_conv.free == LDKOutputSpender_JCalls_free) {
36255                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36256                 LDKOutputSpender_JCalls_cloned(&arg_d_conv);
36257         }
36258         void* arg_e_ptr = untag_ptr(arg_e);
36259         CHECK_ACCESS(arg_e_ptr);
36260         LDKChangeDestinationSource arg_e_conv = *(LDKChangeDestinationSource*)(arg_e_ptr);
36261         if (arg_e_conv.free == LDKChangeDestinationSource_JCalls_free) {
36262                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36263                 LDKChangeDestinationSource_JCalls_cloned(&arg_e_conv);
36264         }
36265         void* arg_f_ptr = untag_ptr(arg_f);
36266         CHECK_ACCESS(arg_f_ptr);
36267         LDKKVStore arg_f_conv = *(LDKKVStore*)(arg_f_ptr);
36268         if (arg_f_conv.free == LDKKVStore_JCalls_free) {
36269                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36270                 LDKKVStore_JCalls_cloned(&arg_f_conv);
36271         }
36272         void* arg_g_ptr = untag_ptr(arg_g);
36273         CHECK_ACCESS(arg_g_ptr);
36274         LDKLogger arg_g_conv = *(LDKLogger*)(arg_g_ptr);
36275         if (arg_g_conv.free == LDKLogger_JCalls_free) {
36276                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36277                 LDKLogger_JCalls_cloned(&arg_g_conv);
36278         }
36279         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ), "LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ");
36280         *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);
36281         FREE(ser);
36282         return tag_ptr(ret_conv, true);
36283 }
36284
36285 void  __attribute__((export_name("TS_FutureCallback_free"))) TS_FutureCallback_free(uint64_t this_ptr) {
36286         if (!ptr_is_owned(this_ptr)) return;
36287         void* this_ptr_ptr = untag_ptr(this_ptr);
36288         CHECK_ACCESS(this_ptr_ptr);
36289         LDKFutureCallback this_ptr_conv = *(LDKFutureCallback*)(this_ptr_ptr);
36290         FREE(untag_ptr(this_ptr));
36291         FutureCallback_free(this_ptr_conv);
36292 }
36293
36294 void  __attribute__((export_name("TS_Future_free"))) TS_Future_free(uint64_t this_obj) {
36295         LDKFuture this_obj_conv;
36296         this_obj_conv.inner = untag_ptr(this_obj);
36297         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36299         Future_free(this_obj_conv);
36300 }
36301
36302 void  __attribute__((export_name("TS_Future_register_callback_fn"))) TS_Future_register_callback_fn(uint64_t this_arg, uint64_t callback) {
36303         LDKFuture this_arg_conv;
36304         this_arg_conv.inner = untag_ptr(this_arg);
36305         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36307         this_arg_conv.is_owned = false;
36308         void* callback_ptr = untag_ptr(callback);
36309         CHECK_ACCESS(callback_ptr);
36310         LDKFutureCallback callback_conv = *(LDKFutureCallback*)(callback_ptr);
36311         if (callback_conv.free == LDKFutureCallback_JCalls_free) {
36312                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36313                 LDKFutureCallback_JCalls_cloned(&callback_conv);
36314         }
36315         Future_register_callback_fn(&this_arg_conv, callback_conv);
36316 }
36317
36318 uint32_t  __attribute__((export_name("TS_Level_clone"))) TS_Level_clone(uint64_t orig) {
36319         LDKLevel* orig_conv = (LDKLevel*)untag_ptr(orig);
36320         uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
36321         return ret_conv;
36322 }
36323
36324 uint32_t  __attribute__((export_name("TS_Level_gossip"))) TS_Level_gossip() {
36325         uint32_t ret_conv = LDKLevel_to_js(Level_gossip());
36326         return ret_conv;
36327 }
36328
36329 uint32_t  __attribute__((export_name("TS_Level_trace"))) TS_Level_trace() {
36330         uint32_t ret_conv = LDKLevel_to_js(Level_trace());
36331         return ret_conv;
36332 }
36333
36334 uint32_t  __attribute__((export_name("TS_Level_debug"))) TS_Level_debug() {
36335         uint32_t ret_conv = LDKLevel_to_js(Level_debug());
36336         return ret_conv;
36337 }
36338
36339 uint32_t  __attribute__((export_name("TS_Level_info"))) TS_Level_info() {
36340         uint32_t ret_conv = LDKLevel_to_js(Level_info());
36341         return ret_conv;
36342 }
36343
36344 uint32_t  __attribute__((export_name("TS_Level_warn"))) TS_Level_warn() {
36345         uint32_t ret_conv = LDKLevel_to_js(Level_warn());
36346         return ret_conv;
36347 }
36348
36349 uint32_t  __attribute__((export_name("TS_Level_error"))) TS_Level_error() {
36350         uint32_t ret_conv = LDKLevel_to_js(Level_error());
36351         return ret_conv;
36352 }
36353
36354 jboolean  __attribute__((export_name("TS_Level_eq"))) TS_Level_eq(uint64_t a, uint64_t b) {
36355         LDKLevel* a_conv = (LDKLevel*)untag_ptr(a);
36356         LDKLevel* b_conv = (LDKLevel*)untag_ptr(b);
36357         jboolean ret_conv = Level_eq(a_conv, b_conv);
36358         return ret_conv;
36359 }
36360
36361 int64_t  __attribute__((export_name("TS_Level_hash"))) TS_Level_hash(uint64_t o) {
36362         LDKLevel* o_conv = (LDKLevel*)untag_ptr(o);
36363         int64_t ret_conv = Level_hash(o_conv);
36364         return ret_conv;
36365 }
36366
36367 uint32_t  __attribute__((export_name("TS_Level_max"))) TS_Level_max() {
36368         uint32_t ret_conv = LDKLevel_to_js(Level_max());
36369         return ret_conv;
36370 }
36371
36372 void  __attribute__((export_name("TS_Record_free"))) TS_Record_free(uint64_t this_obj) {
36373         LDKRecord this_obj_conv;
36374         this_obj_conv.inner = untag_ptr(this_obj);
36375         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36377         Record_free(this_obj_conv);
36378 }
36379
36380 uint32_t  __attribute__((export_name("TS_Record_get_level"))) TS_Record_get_level(uint64_t this_ptr) {
36381         LDKRecord this_ptr_conv;
36382         this_ptr_conv.inner = untag_ptr(this_ptr);
36383         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36385         this_ptr_conv.is_owned = false;
36386         uint32_t ret_conv = LDKLevel_to_js(Record_get_level(&this_ptr_conv));
36387         return ret_conv;
36388 }
36389
36390 void  __attribute__((export_name("TS_Record_set_level"))) TS_Record_set_level(uint64_t this_ptr, uint32_t val) {
36391         LDKRecord this_ptr_conv;
36392         this_ptr_conv.inner = untag_ptr(this_ptr);
36393         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36395         this_ptr_conv.is_owned = false;
36396         LDKLevel val_conv = LDKLevel_from_js(val);
36397         Record_set_level(&this_ptr_conv, val_conv);
36398 }
36399
36400 int8_tArray  __attribute__((export_name("TS_Record_get_peer_id"))) TS_Record_get_peer_id(uint64_t this_ptr) {
36401         LDKRecord this_ptr_conv;
36402         this_ptr_conv.inner = untag_ptr(this_ptr);
36403         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36405         this_ptr_conv.is_owned = false;
36406         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36407         memcpy(ret_arr->elems, Record_get_peer_id(&this_ptr_conv).compressed_form, 33);
36408         return ret_arr;
36409 }
36410
36411 void  __attribute__((export_name("TS_Record_set_peer_id"))) TS_Record_set_peer_id(uint64_t this_ptr, int8_tArray val) {
36412         LDKRecord this_ptr_conv;
36413         this_ptr_conv.inner = untag_ptr(this_ptr);
36414         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36416         this_ptr_conv.is_owned = false;
36417         LDKPublicKey val_ref;
36418         CHECK(val->arr_len == 33);
36419         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36420         Record_set_peer_id(&this_ptr_conv, val_ref);
36421 }
36422
36423 uint64_t  __attribute__((export_name("TS_Record_get_channel_id"))) TS_Record_get_channel_id(uint64_t this_ptr) {
36424         LDKRecord this_ptr_conv;
36425         this_ptr_conv.inner = untag_ptr(this_ptr);
36426         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36428         this_ptr_conv.is_owned = false;
36429         LDKChannelId ret_var = Record_get_channel_id(&this_ptr_conv);
36430         uint64_t ret_ref = 0;
36431         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36432         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36433         return ret_ref;
36434 }
36435
36436 void  __attribute__((export_name("TS_Record_set_channel_id"))) TS_Record_set_channel_id(uint64_t this_ptr, uint64_t val) {
36437         LDKRecord this_ptr_conv;
36438         this_ptr_conv.inner = untag_ptr(this_ptr);
36439         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36441         this_ptr_conv.is_owned = false;
36442         LDKChannelId val_conv;
36443         val_conv.inner = untag_ptr(val);
36444         val_conv.is_owned = ptr_is_owned(val);
36445         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36446         val_conv = ChannelId_clone(&val_conv);
36447         Record_set_channel_id(&this_ptr_conv, val_conv);
36448 }
36449
36450 jstring  __attribute__((export_name("TS_Record_get_args"))) TS_Record_get_args(uint64_t this_ptr) {
36451         LDKRecord this_ptr_conv;
36452         this_ptr_conv.inner = untag_ptr(this_ptr);
36453         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36455         this_ptr_conv.is_owned = false;
36456         LDKStr ret_str = Record_get_args(&this_ptr_conv);
36457         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
36458         Str_free(ret_str);
36459         return ret_conv;
36460 }
36461
36462 void  __attribute__((export_name("TS_Record_set_args"))) TS_Record_set_args(uint64_t this_ptr, jstring val) {
36463         LDKRecord this_ptr_conv;
36464         this_ptr_conv.inner = untag_ptr(this_ptr);
36465         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36467         this_ptr_conv.is_owned = false;
36468         LDKStr val_conv = str_ref_to_owned_c(val);
36469         Record_set_args(&this_ptr_conv, val_conv);
36470 }
36471
36472 jstring  __attribute__((export_name("TS_Record_get_module_path"))) TS_Record_get_module_path(uint64_t this_ptr) {
36473         LDKRecord this_ptr_conv;
36474         this_ptr_conv.inner = untag_ptr(this_ptr);
36475         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36477         this_ptr_conv.is_owned = false;
36478         LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
36479         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
36480         Str_free(ret_str);
36481         return ret_conv;
36482 }
36483
36484 void  __attribute__((export_name("TS_Record_set_module_path"))) TS_Record_set_module_path(uint64_t this_ptr, jstring val) {
36485         LDKRecord this_ptr_conv;
36486         this_ptr_conv.inner = untag_ptr(this_ptr);
36487         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36489         this_ptr_conv.is_owned = false;
36490         LDKStr val_conv = str_ref_to_owned_c(val);
36491         Record_set_module_path(&this_ptr_conv, val_conv);
36492 }
36493
36494 jstring  __attribute__((export_name("TS_Record_get_file"))) TS_Record_get_file(uint64_t this_ptr) {
36495         LDKRecord this_ptr_conv;
36496         this_ptr_conv.inner = untag_ptr(this_ptr);
36497         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36499         this_ptr_conv.is_owned = false;
36500         LDKStr ret_str = Record_get_file(&this_ptr_conv);
36501         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
36502         Str_free(ret_str);
36503         return ret_conv;
36504 }
36505
36506 void  __attribute__((export_name("TS_Record_set_file"))) TS_Record_set_file(uint64_t this_ptr, jstring val) {
36507         LDKRecord this_ptr_conv;
36508         this_ptr_conv.inner = untag_ptr(this_ptr);
36509         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36511         this_ptr_conv.is_owned = false;
36512         LDKStr val_conv = str_ref_to_owned_c(val);
36513         Record_set_file(&this_ptr_conv, val_conv);
36514 }
36515
36516 int32_t  __attribute__((export_name("TS_Record_get_line"))) TS_Record_get_line(uint64_t this_ptr) {
36517         LDKRecord this_ptr_conv;
36518         this_ptr_conv.inner = untag_ptr(this_ptr);
36519         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36521         this_ptr_conv.is_owned = false;
36522         int32_t ret_conv = Record_get_line(&this_ptr_conv);
36523         return ret_conv;
36524 }
36525
36526 void  __attribute__((export_name("TS_Record_set_line"))) TS_Record_set_line(uint64_t this_ptr, int32_t val) {
36527         LDKRecord this_ptr_conv;
36528         this_ptr_conv.inner = untag_ptr(this_ptr);
36529         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36531         this_ptr_conv.is_owned = false;
36532         Record_set_line(&this_ptr_conv, val);
36533 }
36534
36535 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) {
36536         LDKLevel level_arg_conv = LDKLevel_from_js(level_arg);
36537         LDKPublicKey peer_id_arg_ref;
36538         CHECK(peer_id_arg->arr_len == 33);
36539         memcpy(peer_id_arg_ref.compressed_form, peer_id_arg->elems, 33); FREE(peer_id_arg);
36540         LDKChannelId channel_id_arg_conv;
36541         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
36542         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
36543         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
36544         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
36545         LDKStr args_arg_conv = str_ref_to_owned_c(args_arg);
36546         LDKStr module_path_arg_conv = str_ref_to_owned_c(module_path_arg);
36547         LDKStr file_arg_conv = str_ref_to_owned_c(file_arg);
36548         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);
36549         uint64_t ret_ref = 0;
36550         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36551         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36552         return ret_ref;
36553 }
36554
36555 static inline uint64_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
36556         LDKRecord ret_var = Record_clone(arg);
36557         uint64_t ret_ref = 0;
36558         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36559         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36560         return ret_ref;
36561 }
36562 int64_t  __attribute__((export_name("TS_Record_clone_ptr"))) TS_Record_clone_ptr(uint64_t arg) {
36563         LDKRecord arg_conv;
36564         arg_conv.inner = untag_ptr(arg);
36565         arg_conv.is_owned = ptr_is_owned(arg);
36566         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36567         arg_conv.is_owned = false;
36568         int64_t ret_conv = Record_clone_ptr(&arg_conv);
36569         return ret_conv;
36570 }
36571
36572 uint64_t  __attribute__((export_name("TS_Record_clone"))) TS_Record_clone(uint64_t orig) {
36573         LDKRecord orig_conv;
36574         orig_conv.inner = untag_ptr(orig);
36575         orig_conv.is_owned = ptr_is_owned(orig);
36576         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36577         orig_conv.is_owned = false;
36578         LDKRecord ret_var = Record_clone(&orig_conv);
36579         uint64_t ret_ref = 0;
36580         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36581         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36582         return ret_ref;
36583 }
36584
36585 void  __attribute__((export_name("TS_Logger_free"))) TS_Logger_free(uint64_t this_ptr) {
36586         if (!ptr_is_owned(this_ptr)) return;
36587         void* this_ptr_ptr = untag_ptr(this_ptr);
36588         CHECK_ACCESS(this_ptr_ptr);
36589         LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
36590         FREE(untag_ptr(this_ptr));
36591         Logger_free(this_ptr_conv);
36592 }
36593
36594 void  __attribute__((export_name("TS_ChannelHandshakeConfig_free"))) TS_ChannelHandshakeConfig_free(uint64_t this_obj) {
36595         LDKChannelHandshakeConfig this_obj_conv;
36596         this_obj_conv.inner = untag_ptr(this_obj);
36597         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36599         ChannelHandshakeConfig_free(this_obj_conv);
36600 }
36601
36602 int32_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_minimum_depth"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint64_t this_ptr) {
36603         LDKChannelHandshakeConfig this_ptr_conv;
36604         this_ptr_conv.inner = untag_ptr(this_ptr);
36605         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36607         this_ptr_conv.is_owned = false;
36608         int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
36609         return ret_conv;
36610 }
36611
36612 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_minimum_depth"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint64_t this_ptr, int32_t val) {
36613         LDKChannelHandshakeConfig this_ptr_conv;
36614         this_ptr_conv.inner = untag_ptr(this_ptr);
36615         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36617         this_ptr_conv.is_owned = false;
36618         ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
36619 }
36620
36621 int16_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_to_self_delay"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint64_t this_ptr) {
36622         LDKChannelHandshakeConfig this_ptr_conv;
36623         this_ptr_conv.inner = untag_ptr(this_ptr);
36624         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36626         this_ptr_conv.is_owned = false;
36627         int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
36628         return ret_conv;
36629 }
36630
36631 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) {
36632         LDKChannelHandshakeConfig this_ptr_conv;
36633         this_ptr_conv.inner = untag_ptr(this_ptr);
36634         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36636         this_ptr_conv.is_owned = false;
36637         ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
36638 }
36639
36640 int64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint64_t this_ptr) {
36641         LDKChannelHandshakeConfig this_ptr_conv;
36642         this_ptr_conv.inner = untag_ptr(this_ptr);
36643         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36645         this_ptr_conv.is_owned = false;
36646         int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
36647         return ret_conv;
36648 }
36649
36650 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) {
36651         LDKChannelHandshakeConfig this_ptr_conv;
36652         this_ptr_conv.inner = untag_ptr(this_ptr);
36653         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36655         this_ptr_conv.is_owned = false;
36656         ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
36657 }
36658
36659 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) {
36660         LDKChannelHandshakeConfig this_ptr_conv;
36661         this_ptr_conv.inner = untag_ptr(this_ptr);
36662         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36664         this_ptr_conv.is_owned = false;
36665         int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
36666         return ret_conv;
36667 }
36668
36669 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) {
36670         LDKChannelHandshakeConfig this_ptr_conv;
36671         this_ptr_conv.inner = untag_ptr(this_ptr);
36672         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36674         this_ptr_conv.is_owned = false;
36675         ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
36676 }
36677
36678 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_get_negotiate_scid_privacy(uint64_t this_ptr) {
36679         LDKChannelHandshakeConfig this_ptr_conv;
36680         this_ptr_conv.inner = untag_ptr(this_ptr);
36681         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36683         this_ptr_conv.is_owned = false;
36684         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
36685         return ret_conv;
36686 }
36687
36688 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_set_negotiate_scid_privacy(uint64_t this_ptr, jboolean val) {
36689         LDKChannelHandshakeConfig this_ptr_conv;
36690         this_ptr_conv.inner = untag_ptr(this_ptr);
36691         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36693         this_ptr_conv.is_owned = false;
36694         ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
36695 }
36696
36697 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_announced_channel"))) TS_ChannelHandshakeConfig_get_announced_channel(uint64_t this_ptr) {
36698         LDKChannelHandshakeConfig this_ptr_conv;
36699         this_ptr_conv.inner = untag_ptr(this_ptr);
36700         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36702         this_ptr_conv.is_owned = false;
36703         jboolean ret_conv = ChannelHandshakeConfig_get_announced_channel(&this_ptr_conv);
36704         return ret_conv;
36705 }
36706
36707 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_announced_channel"))) TS_ChannelHandshakeConfig_set_announced_channel(uint64_t this_ptr, jboolean val) {
36708         LDKChannelHandshakeConfig this_ptr_conv;
36709         this_ptr_conv.inner = untag_ptr(this_ptr);
36710         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36712         this_ptr_conv.is_owned = false;
36713         ChannelHandshakeConfig_set_announced_channel(&this_ptr_conv, val);
36714 }
36715
36716 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey"))) TS_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(uint64_t this_ptr) {
36717         LDKChannelHandshakeConfig this_ptr_conv;
36718         this_ptr_conv.inner = untag_ptr(this_ptr);
36719         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36721         this_ptr_conv.is_owned = false;
36722         jboolean ret_conv = ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
36723         return ret_conv;
36724 }
36725
36726 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey"))) TS_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(uint64_t this_ptr, jboolean val) {
36727         LDKChannelHandshakeConfig this_ptr_conv;
36728         this_ptr_conv.inner = untag_ptr(this_ptr);
36729         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36731         this_ptr_conv.is_owned = false;
36732         ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
36733 }
36734
36735 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) {
36736         LDKChannelHandshakeConfig this_ptr_conv;
36737         this_ptr_conv.inner = untag_ptr(this_ptr);
36738         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36740         this_ptr_conv.is_owned = false;
36741         int32_t ret_conv = ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(&this_ptr_conv);
36742         return ret_conv;
36743 }
36744
36745 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) {
36746         LDKChannelHandshakeConfig this_ptr_conv;
36747         this_ptr_conv.inner = untag_ptr(this_ptr);
36748         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36750         this_ptr_conv.is_owned = false;
36751         ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(&this_ptr_conv, val);
36752 }
36753
36754 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) {
36755         LDKChannelHandshakeConfig this_ptr_conv;
36756         this_ptr_conv.inner = untag_ptr(this_ptr);
36757         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36759         this_ptr_conv.is_owned = false;
36760         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_anchors_zero_fee_htlc_tx(&this_ptr_conv);
36761         return ret_conv;
36762 }
36763
36764 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) {
36765         LDKChannelHandshakeConfig this_ptr_conv;
36766         this_ptr_conv.inner = untag_ptr(this_ptr);
36767         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36769         this_ptr_conv.is_owned = false;
36770         ChannelHandshakeConfig_set_negotiate_anchors_zero_fee_htlc_tx(&this_ptr_conv, val);
36771 }
36772
36773 int16_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_max_accepted_htlcs"))) TS_ChannelHandshakeConfig_get_our_max_accepted_htlcs(uint64_t this_ptr) {
36774         LDKChannelHandshakeConfig this_ptr_conv;
36775         this_ptr_conv.inner = untag_ptr(this_ptr);
36776         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36778         this_ptr_conv.is_owned = false;
36779         int16_t ret_conv = ChannelHandshakeConfig_get_our_max_accepted_htlcs(&this_ptr_conv);
36780         return ret_conv;
36781 }
36782
36783 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) {
36784         LDKChannelHandshakeConfig this_ptr_conv;
36785         this_ptr_conv.inner = untag_ptr(this_ptr);
36786         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36788         this_ptr_conv.is_owned = false;
36789         ChannelHandshakeConfig_set_our_max_accepted_htlcs(&this_ptr_conv, val);
36790 }
36791
36792 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) {
36793         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);
36794         uint64_t ret_ref = 0;
36795         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36796         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36797         return ret_ref;
36798 }
36799
36800 static inline uint64_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
36801         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
36802         uint64_t ret_ref = 0;
36803         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36804         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36805         return ret_ref;
36806 }
36807 int64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_clone_ptr"))) TS_ChannelHandshakeConfig_clone_ptr(uint64_t arg) {
36808         LDKChannelHandshakeConfig arg_conv;
36809         arg_conv.inner = untag_ptr(arg);
36810         arg_conv.is_owned = ptr_is_owned(arg);
36811         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36812         arg_conv.is_owned = false;
36813         int64_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
36814         return ret_conv;
36815 }
36816
36817 uint64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_clone"))) TS_ChannelHandshakeConfig_clone(uint64_t orig) {
36818         LDKChannelHandshakeConfig orig_conv;
36819         orig_conv.inner = untag_ptr(orig);
36820         orig_conv.is_owned = ptr_is_owned(orig);
36821         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36822         orig_conv.is_owned = false;
36823         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
36824         uint64_t ret_ref = 0;
36825         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36826         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36827         return ret_ref;
36828 }
36829
36830 uint64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_default"))) TS_ChannelHandshakeConfig_default() {
36831         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
36832         uint64_t ret_ref = 0;
36833         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36834         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36835         return ret_ref;
36836 }
36837
36838 void  __attribute__((export_name("TS_ChannelHandshakeLimits_free"))) TS_ChannelHandshakeLimits_free(uint64_t this_obj) {
36839         LDKChannelHandshakeLimits this_obj_conv;
36840         this_obj_conv.inner = untag_ptr(this_obj);
36841         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36843         ChannelHandshakeLimits_free(this_obj_conv);
36844 }
36845
36846 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_funding_satoshis"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint64_t this_ptr) {
36847         LDKChannelHandshakeLimits this_ptr_conv;
36848         this_ptr_conv.inner = untag_ptr(this_ptr);
36849         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36851         this_ptr_conv.is_owned = false;
36852         int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
36853         return ret_conv;
36854 }
36855
36856 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_min_funding_satoshis"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint64_t this_ptr, int64_t val) {
36857         LDKChannelHandshakeLimits this_ptr_conv;
36858         this_ptr_conv.inner = untag_ptr(this_ptr);
36859         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36861         this_ptr_conv.is_owned = false;
36862         ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
36863 }
36864
36865 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_funding_satoshis"))) TS_ChannelHandshakeLimits_get_max_funding_satoshis(uint64_t this_ptr) {
36866         LDKChannelHandshakeLimits this_ptr_conv;
36867         this_ptr_conv.inner = untag_ptr(this_ptr);
36868         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36870         this_ptr_conv.is_owned = false;
36871         int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
36872         return ret_conv;
36873 }
36874
36875 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_funding_satoshis"))) TS_ChannelHandshakeLimits_set_max_funding_satoshis(uint64_t this_ptr, int64_t val) {
36876         LDKChannelHandshakeLimits this_ptr_conv;
36877         this_ptr_conv.inner = untag_ptr(this_ptr);
36878         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36880         this_ptr_conv.is_owned = false;
36881         ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
36882 }
36883
36884 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint64_t this_ptr) {
36885         LDKChannelHandshakeLimits this_ptr_conv;
36886         this_ptr_conv.inner = untag_ptr(this_ptr);
36887         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36889         this_ptr_conv.is_owned = false;
36890         int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
36891         return ret_conv;
36892 }
36893
36894 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) {
36895         LDKChannelHandshakeLimits this_ptr_conv;
36896         this_ptr_conv.inner = untag_ptr(this_ptr);
36897         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36899         this_ptr_conv.is_owned = false;
36900         ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
36901 }
36902
36903 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) {
36904         LDKChannelHandshakeLimits this_ptr_conv;
36905         this_ptr_conv.inner = untag_ptr(this_ptr);
36906         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36908         this_ptr_conv.is_owned = false;
36909         int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
36910         return ret_conv;
36911 }
36912
36913 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) {
36914         LDKChannelHandshakeLimits this_ptr_conv;
36915         this_ptr_conv.inner = untag_ptr(this_ptr);
36916         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36918         this_ptr_conv.is_owned = false;
36919         ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
36920 }
36921
36922 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint64_t this_ptr) {
36923         LDKChannelHandshakeLimits this_ptr_conv;
36924         this_ptr_conv.inner = untag_ptr(this_ptr);
36925         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36927         this_ptr_conv.is_owned = false;
36928         int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
36929         return ret_conv;
36930 }
36931
36932 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) {
36933         LDKChannelHandshakeLimits this_ptr_conv;
36934         this_ptr_conv.inner = untag_ptr(this_ptr);
36935         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36937         this_ptr_conv.is_owned = false;
36938         ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
36939 }
36940
36941 int16_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint64_t this_ptr) {
36942         LDKChannelHandshakeLimits this_ptr_conv;
36943         this_ptr_conv.inner = untag_ptr(this_ptr);
36944         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36946         this_ptr_conv.is_owned = false;
36947         int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
36948         return ret_conv;
36949 }
36950
36951 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) {
36952         LDKChannelHandshakeLimits this_ptr_conv;
36953         this_ptr_conv.inner = untag_ptr(this_ptr);
36954         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36956         this_ptr_conv.is_owned = false;
36957         ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
36958 }
36959
36960 int32_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_minimum_depth"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint64_t this_ptr) {
36961         LDKChannelHandshakeLimits this_ptr_conv;
36962         this_ptr_conv.inner = untag_ptr(this_ptr);
36963         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36965         this_ptr_conv.is_owned = false;
36966         int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
36967         return ret_conv;
36968 }
36969
36970 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_minimum_depth"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint64_t this_ptr, int32_t val) {
36971         LDKChannelHandshakeLimits this_ptr_conv;
36972         this_ptr_conv.inner = untag_ptr(this_ptr);
36973         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36975         this_ptr_conv.is_owned = false;
36976         ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
36977 }
36978
36979 jboolean  __attribute__((export_name("TS_ChannelHandshakeLimits_get_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_get_trust_own_funding_0conf(uint64_t this_ptr) {
36980         LDKChannelHandshakeLimits this_ptr_conv;
36981         this_ptr_conv.inner = untag_ptr(this_ptr);
36982         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36984         this_ptr_conv.is_owned = false;
36985         jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
36986         return ret_conv;
36987 }
36988
36989 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_set_trust_own_funding_0conf(uint64_t this_ptr, jboolean val) {
36990         LDKChannelHandshakeLimits 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         ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
36996 }
36997
36998 jboolean  __attribute__((export_name("TS_ChannelHandshakeLimits_get_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint64_t this_ptr) {
36999         LDKChannelHandshakeLimits this_ptr_conv;
37000         this_ptr_conv.inner = untag_ptr(this_ptr);
37001         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37003         this_ptr_conv.is_owned = false;
37004         jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
37005         return ret_conv;
37006 }
37007
37008 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint64_t this_ptr, jboolean val) {
37009         LDKChannelHandshakeLimits this_ptr_conv;
37010         this_ptr_conv.inner = untag_ptr(this_ptr);
37011         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37013         this_ptr_conv.is_owned = false;
37014         ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
37015 }
37016
37017 int16_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_their_to_self_delay"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint64_t this_ptr) {
37018         LDKChannelHandshakeLimits this_ptr_conv;
37019         this_ptr_conv.inner = untag_ptr(this_ptr);
37020         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37022         this_ptr_conv.is_owned = false;
37023         int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
37024         return ret_conv;
37025 }
37026
37027 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) {
37028         LDKChannelHandshakeLimits this_ptr_conv;
37029         this_ptr_conv.inner = untag_ptr(this_ptr);
37030         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37032         this_ptr_conv.is_owned = false;
37033         ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
37034 }
37035
37036 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) {
37037         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);
37038         uint64_t ret_ref = 0;
37039         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37040         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37041         return ret_ref;
37042 }
37043
37044 static inline uint64_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
37045         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
37046         uint64_t ret_ref = 0;
37047         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37048         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37049         return ret_ref;
37050 }
37051 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_clone_ptr"))) TS_ChannelHandshakeLimits_clone_ptr(uint64_t arg) {
37052         LDKChannelHandshakeLimits arg_conv;
37053         arg_conv.inner = untag_ptr(arg);
37054         arg_conv.is_owned = ptr_is_owned(arg);
37055         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37056         arg_conv.is_owned = false;
37057         int64_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
37058         return ret_conv;
37059 }
37060
37061 uint64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_clone"))) TS_ChannelHandshakeLimits_clone(uint64_t orig) {
37062         LDKChannelHandshakeLimits orig_conv;
37063         orig_conv.inner = untag_ptr(orig);
37064         orig_conv.is_owned = ptr_is_owned(orig);
37065         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37066         orig_conv.is_owned = false;
37067         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
37068         uint64_t ret_ref = 0;
37069         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37070         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37071         return ret_ref;
37072 }
37073
37074 uint64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_default"))) TS_ChannelHandshakeLimits_default() {
37075         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
37076         uint64_t ret_ref = 0;
37077         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37078         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37079         return ret_ref;
37080 }
37081
37082 void  __attribute__((export_name("TS_MaxDustHTLCExposure_free"))) TS_MaxDustHTLCExposure_free(uint64_t this_ptr) {
37083         if (!ptr_is_owned(this_ptr)) return;
37084         void* this_ptr_ptr = untag_ptr(this_ptr);
37085         CHECK_ACCESS(this_ptr_ptr);
37086         LDKMaxDustHTLCExposure this_ptr_conv = *(LDKMaxDustHTLCExposure*)(this_ptr_ptr);
37087         FREE(untag_ptr(this_ptr));
37088         MaxDustHTLCExposure_free(this_ptr_conv);
37089 }
37090
37091 static inline uint64_t MaxDustHTLCExposure_clone_ptr(LDKMaxDustHTLCExposure *NONNULL_PTR arg) {
37092         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
37093         *ret_copy = MaxDustHTLCExposure_clone(arg);
37094         uint64_t ret_ref = tag_ptr(ret_copy, true);
37095         return ret_ref;
37096 }
37097 int64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_clone_ptr"))) TS_MaxDustHTLCExposure_clone_ptr(uint64_t arg) {
37098         LDKMaxDustHTLCExposure* arg_conv = (LDKMaxDustHTLCExposure*)untag_ptr(arg);
37099         int64_t ret_conv = MaxDustHTLCExposure_clone_ptr(arg_conv);
37100         return ret_conv;
37101 }
37102
37103 uint64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_clone"))) TS_MaxDustHTLCExposure_clone(uint64_t orig) {
37104         LDKMaxDustHTLCExposure* orig_conv = (LDKMaxDustHTLCExposure*)untag_ptr(orig);
37105         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
37106         *ret_copy = MaxDustHTLCExposure_clone(orig_conv);
37107         uint64_t ret_ref = tag_ptr(ret_copy, true);
37108         return ret_ref;
37109 }
37110
37111 uint64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_fixed_limit_msat"))) TS_MaxDustHTLCExposure_fixed_limit_msat(int64_t a) {
37112         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
37113         *ret_copy = MaxDustHTLCExposure_fixed_limit_msat(a);
37114         uint64_t ret_ref = tag_ptr(ret_copy, true);
37115         return ret_ref;
37116 }
37117
37118 uint64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_fee_rate_multiplier"))) TS_MaxDustHTLCExposure_fee_rate_multiplier(int64_t a) {
37119         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
37120         *ret_copy = MaxDustHTLCExposure_fee_rate_multiplier(a);
37121         uint64_t ret_ref = tag_ptr(ret_copy, true);
37122         return ret_ref;
37123 }
37124
37125 jboolean  __attribute__((export_name("TS_MaxDustHTLCExposure_eq"))) TS_MaxDustHTLCExposure_eq(uint64_t a, uint64_t b) {
37126         LDKMaxDustHTLCExposure* a_conv = (LDKMaxDustHTLCExposure*)untag_ptr(a);
37127         LDKMaxDustHTLCExposure* b_conv = (LDKMaxDustHTLCExposure*)untag_ptr(b);
37128         jboolean ret_conv = MaxDustHTLCExposure_eq(a_conv, b_conv);
37129         return ret_conv;
37130 }
37131
37132 int8_tArray  __attribute__((export_name("TS_MaxDustHTLCExposure_write"))) TS_MaxDustHTLCExposure_write(uint64_t obj) {
37133         LDKMaxDustHTLCExposure* obj_conv = (LDKMaxDustHTLCExposure*)untag_ptr(obj);
37134         LDKCVec_u8Z ret_var = MaxDustHTLCExposure_write(obj_conv);
37135         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37136         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37137         CVec_u8Z_free(ret_var);
37138         return ret_arr;
37139 }
37140
37141 uint64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_read"))) TS_MaxDustHTLCExposure_read(int8_tArray ser) {
37142         LDKu8slice ser_ref;
37143         ser_ref.datalen = ser->arr_len;
37144         ser_ref.data = ser->elems;
37145         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
37146         *ret_conv = MaxDustHTLCExposure_read(ser_ref);
37147         FREE(ser);
37148         return tag_ptr(ret_conv, true);
37149 }
37150
37151 void  __attribute__((export_name("TS_ChannelConfig_free"))) TS_ChannelConfig_free(uint64_t this_obj) {
37152         LDKChannelConfig this_obj_conv;
37153         this_obj_conv.inner = untag_ptr(this_obj);
37154         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37156         ChannelConfig_free(this_obj_conv);
37157 }
37158
37159 int32_t  __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_proportional_millionths"))) TS_ChannelConfig_get_forwarding_fee_proportional_millionths(uint64_t this_ptr) {
37160         LDKChannelConfig this_ptr_conv;
37161         this_ptr_conv.inner = untag_ptr(this_ptr);
37162         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37164         this_ptr_conv.is_owned = false;
37165         int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
37166         return ret_conv;
37167 }
37168
37169 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) {
37170         LDKChannelConfig this_ptr_conv;
37171         this_ptr_conv.inner = untag_ptr(this_ptr);
37172         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37174         this_ptr_conv.is_owned = false;
37175         ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
37176 }
37177
37178 int32_t  __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_base_msat"))) TS_ChannelConfig_get_forwarding_fee_base_msat(uint64_t this_ptr) {
37179         LDKChannelConfig 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         int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
37185         return ret_conv;
37186 }
37187
37188 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) {
37189         LDKChannelConfig this_ptr_conv;
37190         this_ptr_conv.inner = untag_ptr(this_ptr);
37191         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37193         this_ptr_conv.is_owned = false;
37194         ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
37195 }
37196
37197 int16_t  __attribute__((export_name("TS_ChannelConfig_get_cltv_expiry_delta"))) TS_ChannelConfig_get_cltv_expiry_delta(uint64_t this_ptr) {
37198         LDKChannelConfig 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         int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
37204         return ret_conv;
37205 }
37206
37207 void  __attribute__((export_name("TS_ChannelConfig_set_cltv_expiry_delta"))) TS_ChannelConfig_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
37208         LDKChannelConfig this_ptr_conv;
37209         this_ptr_conv.inner = untag_ptr(this_ptr);
37210         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37212         this_ptr_conv.is_owned = false;
37213         ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
37214 }
37215
37216 uint64_t  __attribute__((export_name("TS_ChannelConfig_get_max_dust_htlc_exposure"))) TS_ChannelConfig_get_max_dust_htlc_exposure(uint64_t this_ptr) {
37217         LDKChannelConfig 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         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
37223         *ret_copy = ChannelConfig_get_max_dust_htlc_exposure(&this_ptr_conv);
37224         uint64_t ret_ref = tag_ptr(ret_copy, true);
37225         return ret_ref;
37226 }
37227
37228 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) {
37229         LDKChannelConfig this_ptr_conv;
37230         this_ptr_conv.inner = untag_ptr(this_ptr);
37231         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37233         this_ptr_conv.is_owned = false;
37234         void* val_ptr = untag_ptr(val);
37235         CHECK_ACCESS(val_ptr);
37236         LDKMaxDustHTLCExposure val_conv = *(LDKMaxDustHTLCExposure*)(val_ptr);
37237         val_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(val));
37238         ChannelConfig_set_max_dust_htlc_exposure(&this_ptr_conv, val_conv);
37239 }
37240
37241 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) {
37242         LDKChannelConfig this_ptr_conv;
37243         this_ptr_conv.inner = untag_ptr(this_ptr);
37244         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37246         this_ptr_conv.is_owned = false;
37247         int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
37248         return ret_conv;
37249 }
37250
37251 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) {
37252         LDKChannelConfig this_ptr_conv;
37253         this_ptr_conv.inner = untag_ptr(this_ptr);
37254         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37256         this_ptr_conv.is_owned = false;
37257         ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
37258 }
37259
37260 jboolean  __attribute__((export_name("TS_ChannelConfig_get_accept_underpaying_htlcs"))) TS_ChannelConfig_get_accept_underpaying_htlcs(uint64_t this_ptr) {
37261         LDKChannelConfig this_ptr_conv;
37262         this_ptr_conv.inner = untag_ptr(this_ptr);
37263         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37265         this_ptr_conv.is_owned = false;
37266         jboolean ret_conv = ChannelConfig_get_accept_underpaying_htlcs(&this_ptr_conv);
37267         return ret_conv;
37268 }
37269
37270 void  __attribute__((export_name("TS_ChannelConfig_set_accept_underpaying_htlcs"))) TS_ChannelConfig_set_accept_underpaying_htlcs(uint64_t this_ptr, jboolean val) {
37271         LDKChannelConfig this_ptr_conv;
37272         this_ptr_conv.inner = untag_ptr(this_ptr);
37273         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37275         this_ptr_conv.is_owned = false;
37276         ChannelConfig_set_accept_underpaying_htlcs(&this_ptr_conv, val);
37277 }
37278
37279 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) {
37280         void* max_dust_htlc_exposure_arg_ptr = untag_ptr(max_dust_htlc_exposure_arg);
37281         CHECK_ACCESS(max_dust_htlc_exposure_arg_ptr);
37282         LDKMaxDustHTLCExposure max_dust_htlc_exposure_arg_conv = *(LDKMaxDustHTLCExposure*)(max_dust_htlc_exposure_arg_ptr);
37283         max_dust_htlc_exposure_arg_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(max_dust_htlc_exposure_arg));
37284         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);
37285         uint64_t ret_ref = 0;
37286         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37287         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37288         return ret_ref;
37289 }
37290
37291 static inline uint64_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
37292         LDKChannelConfig ret_var = ChannelConfig_clone(arg);
37293         uint64_t ret_ref = 0;
37294         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37295         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37296         return ret_ref;
37297 }
37298 int64_t  __attribute__((export_name("TS_ChannelConfig_clone_ptr"))) TS_ChannelConfig_clone_ptr(uint64_t arg) {
37299         LDKChannelConfig arg_conv;
37300         arg_conv.inner = untag_ptr(arg);
37301         arg_conv.is_owned = ptr_is_owned(arg);
37302         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37303         arg_conv.is_owned = false;
37304         int64_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
37305         return ret_conv;
37306 }
37307
37308 uint64_t  __attribute__((export_name("TS_ChannelConfig_clone"))) TS_ChannelConfig_clone(uint64_t orig) {
37309         LDKChannelConfig orig_conv;
37310         orig_conv.inner = untag_ptr(orig);
37311         orig_conv.is_owned = ptr_is_owned(orig);
37312         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37313         orig_conv.is_owned = false;
37314         LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
37315         uint64_t ret_ref = 0;
37316         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37317         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37318         return ret_ref;
37319 }
37320
37321 jboolean  __attribute__((export_name("TS_ChannelConfig_eq"))) TS_ChannelConfig_eq(uint64_t a, uint64_t b) {
37322         LDKChannelConfig a_conv;
37323         a_conv.inner = untag_ptr(a);
37324         a_conv.is_owned = ptr_is_owned(a);
37325         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37326         a_conv.is_owned = false;
37327         LDKChannelConfig b_conv;
37328         b_conv.inner = untag_ptr(b);
37329         b_conv.is_owned = ptr_is_owned(b);
37330         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37331         b_conv.is_owned = false;
37332         jboolean ret_conv = ChannelConfig_eq(&a_conv, &b_conv);
37333         return ret_conv;
37334 }
37335
37336 void  __attribute__((export_name("TS_ChannelConfig_apply"))) TS_ChannelConfig_apply(uint64_t this_arg, uint64_t update) {
37337         LDKChannelConfig this_arg_conv;
37338         this_arg_conv.inner = untag_ptr(this_arg);
37339         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37341         this_arg_conv.is_owned = false;
37342         LDKChannelConfigUpdate update_conv;
37343         update_conv.inner = untag_ptr(update);
37344         update_conv.is_owned = ptr_is_owned(update);
37345         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
37346         update_conv.is_owned = false;
37347         ChannelConfig_apply(&this_arg_conv, &update_conv);
37348 }
37349
37350 uint64_t  __attribute__((export_name("TS_ChannelConfig_default"))) TS_ChannelConfig_default() {
37351         LDKChannelConfig ret_var = ChannelConfig_default();
37352         uint64_t ret_ref = 0;
37353         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37354         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37355         return ret_ref;
37356 }
37357
37358 int8_tArray  __attribute__((export_name("TS_ChannelConfig_write"))) TS_ChannelConfig_write(uint64_t obj) {
37359         LDKChannelConfig obj_conv;
37360         obj_conv.inner = untag_ptr(obj);
37361         obj_conv.is_owned = ptr_is_owned(obj);
37362         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37363         obj_conv.is_owned = false;
37364         LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
37365         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37366         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37367         CVec_u8Z_free(ret_var);
37368         return ret_arr;
37369 }
37370
37371 uint64_t  __attribute__((export_name("TS_ChannelConfig_read"))) TS_ChannelConfig_read(int8_tArray ser) {
37372         LDKu8slice ser_ref;
37373         ser_ref.datalen = ser->arr_len;
37374         ser_ref.data = ser->elems;
37375         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
37376         *ret_conv = ChannelConfig_read(ser_ref);
37377         FREE(ser);
37378         return tag_ptr(ret_conv, true);
37379 }
37380
37381 void  __attribute__((export_name("TS_ChannelConfigUpdate_free"))) TS_ChannelConfigUpdate_free(uint64_t this_obj) {
37382         LDKChannelConfigUpdate this_obj_conv;
37383         this_obj_conv.inner = untag_ptr(this_obj);
37384         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37386         ChannelConfigUpdate_free(this_obj_conv);
37387 }
37388
37389 uint64_t  __attribute__((export_name("TS_ChannelConfigUpdate_get_forwarding_fee_proportional_millionths"))) TS_ChannelConfigUpdate_get_forwarding_fee_proportional_millionths(uint64_t this_ptr) {
37390         LDKChannelConfigUpdate this_ptr_conv;
37391         this_ptr_conv.inner = untag_ptr(this_ptr);
37392         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37394         this_ptr_conv.is_owned = false;
37395         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
37396         *ret_copy = ChannelConfigUpdate_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
37397         uint64_t ret_ref = tag_ptr(ret_copy, true);
37398         return ret_ref;
37399 }
37400
37401 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) {
37402         LDKChannelConfigUpdate this_ptr_conv;
37403         this_ptr_conv.inner = untag_ptr(this_ptr);
37404         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37406         this_ptr_conv.is_owned = false;
37407         void* val_ptr = untag_ptr(val);
37408         CHECK_ACCESS(val_ptr);
37409         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
37410         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
37411         ChannelConfigUpdate_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val_conv);
37412 }
37413
37414 uint64_t  __attribute__((export_name("TS_ChannelConfigUpdate_get_forwarding_fee_base_msat"))) TS_ChannelConfigUpdate_get_forwarding_fee_base_msat(uint64_t this_ptr) {
37415         LDKChannelConfigUpdate this_ptr_conv;
37416         this_ptr_conv.inner = untag_ptr(this_ptr);
37417         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37419         this_ptr_conv.is_owned = false;
37420         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
37421         *ret_copy = ChannelConfigUpdate_get_forwarding_fee_base_msat(&this_ptr_conv);
37422         uint64_t ret_ref = tag_ptr(ret_copy, true);
37423         return ret_ref;
37424 }
37425
37426 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) {
37427         LDKChannelConfigUpdate this_ptr_conv;
37428         this_ptr_conv.inner = untag_ptr(this_ptr);
37429         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37431         this_ptr_conv.is_owned = false;
37432         void* val_ptr = untag_ptr(val);
37433         CHECK_ACCESS(val_ptr);
37434         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
37435         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
37436         ChannelConfigUpdate_set_forwarding_fee_base_msat(&this_ptr_conv, val_conv);
37437 }
37438
37439 uint64_t  __attribute__((export_name("TS_ChannelConfigUpdate_get_cltv_expiry_delta"))) TS_ChannelConfigUpdate_get_cltv_expiry_delta(uint64_t this_ptr) {
37440         LDKChannelConfigUpdate this_ptr_conv;
37441         this_ptr_conv.inner = untag_ptr(this_ptr);
37442         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37444         this_ptr_conv.is_owned = false;
37445         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
37446         *ret_copy = ChannelConfigUpdate_get_cltv_expiry_delta(&this_ptr_conv);
37447         uint64_t ret_ref = tag_ptr(ret_copy, true);
37448         return ret_ref;
37449 }
37450
37451 void  __attribute__((export_name("TS_ChannelConfigUpdate_set_cltv_expiry_delta"))) TS_ChannelConfigUpdate_set_cltv_expiry_delta(uint64_t this_ptr, uint64_t val) {
37452         LDKChannelConfigUpdate this_ptr_conv;
37453         this_ptr_conv.inner = untag_ptr(this_ptr);
37454         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37456         this_ptr_conv.is_owned = false;
37457         void* val_ptr = untag_ptr(val);
37458         CHECK_ACCESS(val_ptr);
37459         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
37460         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
37461         ChannelConfigUpdate_set_cltv_expiry_delta(&this_ptr_conv, val_conv);
37462 }
37463
37464 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) {
37465         LDKChannelConfigUpdate this_ptr_conv;
37466         this_ptr_conv.inner = untag_ptr(this_ptr);
37467         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37469         this_ptr_conv.is_owned = false;
37470         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
37471         *ret_copy = ChannelConfigUpdate_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
37472         uint64_t ret_ref = tag_ptr(ret_copy, true);
37473         return ret_ref;
37474 }
37475
37476 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) {
37477         LDKChannelConfigUpdate this_ptr_conv;
37478         this_ptr_conv.inner = untag_ptr(this_ptr);
37479         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37481         this_ptr_conv.is_owned = false;
37482         void* val_ptr = untag_ptr(val);
37483         CHECK_ACCESS(val_ptr);
37484         LDKCOption_MaxDustHTLCExposureZ val_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(val_ptr);
37485         val_conv = COption_MaxDustHTLCExposureZ_clone((LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(val));
37486         ChannelConfigUpdate_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val_conv);
37487 }
37488
37489 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) {
37490         LDKChannelConfigUpdate this_ptr_conv;
37491         this_ptr_conv.inner = untag_ptr(this_ptr);
37492         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37494         this_ptr_conv.is_owned = false;
37495         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37496         *ret_copy = ChannelConfigUpdate_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
37497         uint64_t ret_ref = tag_ptr(ret_copy, true);
37498         return ret_ref;
37499 }
37500
37501 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) {
37502         LDKChannelConfigUpdate this_ptr_conv;
37503         this_ptr_conv.inner = untag_ptr(this_ptr);
37504         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37506         this_ptr_conv.is_owned = false;
37507         void* val_ptr = untag_ptr(val);
37508         CHECK_ACCESS(val_ptr);
37509         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
37510         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
37511         ChannelConfigUpdate_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val_conv);
37512 }
37513
37514 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) {
37515         void* forwarding_fee_proportional_millionths_arg_ptr = untag_ptr(forwarding_fee_proportional_millionths_arg);
37516         CHECK_ACCESS(forwarding_fee_proportional_millionths_arg_ptr);
37517         LDKCOption_u32Z forwarding_fee_proportional_millionths_arg_conv = *(LDKCOption_u32Z*)(forwarding_fee_proportional_millionths_arg_ptr);
37518         forwarding_fee_proportional_millionths_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(forwarding_fee_proportional_millionths_arg));
37519         void* forwarding_fee_base_msat_arg_ptr = untag_ptr(forwarding_fee_base_msat_arg);
37520         CHECK_ACCESS(forwarding_fee_base_msat_arg_ptr);
37521         LDKCOption_u32Z forwarding_fee_base_msat_arg_conv = *(LDKCOption_u32Z*)(forwarding_fee_base_msat_arg_ptr);
37522         forwarding_fee_base_msat_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(forwarding_fee_base_msat_arg));
37523         void* cltv_expiry_delta_arg_ptr = untag_ptr(cltv_expiry_delta_arg);
37524         CHECK_ACCESS(cltv_expiry_delta_arg_ptr);
37525         LDKCOption_u16Z cltv_expiry_delta_arg_conv = *(LDKCOption_u16Z*)(cltv_expiry_delta_arg_ptr);
37526         cltv_expiry_delta_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(cltv_expiry_delta_arg));
37527         void* max_dust_htlc_exposure_msat_arg_ptr = untag_ptr(max_dust_htlc_exposure_msat_arg);
37528         CHECK_ACCESS(max_dust_htlc_exposure_msat_arg_ptr);
37529         LDKCOption_MaxDustHTLCExposureZ max_dust_htlc_exposure_msat_arg_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(max_dust_htlc_exposure_msat_arg_ptr);
37530         max_dust_htlc_exposure_msat_arg_conv = COption_MaxDustHTLCExposureZ_clone((LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(max_dust_htlc_exposure_msat_arg));
37531         void* force_close_avoidance_max_fee_satoshis_arg_ptr = untag_ptr(force_close_avoidance_max_fee_satoshis_arg);
37532         CHECK_ACCESS(force_close_avoidance_max_fee_satoshis_arg_ptr);
37533         LDKCOption_u64Z force_close_avoidance_max_fee_satoshis_arg_conv = *(LDKCOption_u64Z*)(force_close_avoidance_max_fee_satoshis_arg_ptr);
37534         force_close_avoidance_max_fee_satoshis_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(force_close_avoidance_max_fee_satoshis_arg));
37535         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);
37536         uint64_t ret_ref = 0;
37537         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37538         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37539         return ret_ref;
37540 }
37541
37542 uint64_t  __attribute__((export_name("TS_ChannelConfigUpdate_default"))) TS_ChannelConfigUpdate_default() {
37543         LDKChannelConfigUpdate ret_var = ChannelConfigUpdate_default();
37544         uint64_t ret_ref = 0;
37545         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37546         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37547         return ret_ref;
37548 }
37549
37550 void  __attribute__((export_name("TS_UserConfig_free"))) TS_UserConfig_free(uint64_t this_obj) {
37551         LDKUserConfig this_obj_conv;
37552         this_obj_conv.inner = untag_ptr(this_obj);
37553         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37555         UserConfig_free(this_obj_conv);
37556 }
37557
37558 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_handshake_config"))) TS_UserConfig_get_channel_handshake_config(uint64_t this_ptr) {
37559         LDKUserConfig this_ptr_conv;
37560         this_ptr_conv.inner = untag_ptr(this_ptr);
37561         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37563         this_ptr_conv.is_owned = false;
37564         LDKChannelHandshakeConfig ret_var = UserConfig_get_channel_handshake_config(&this_ptr_conv);
37565         uint64_t ret_ref = 0;
37566         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37567         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37568         return ret_ref;
37569 }
37570
37571 void  __attribute__((export_name("TS_UserConfig_set_channel_handshake_config"))) TS_UserConfig_set_channel_handshake_config(uint64_t this_ptr, uint64_t val) {
37572         LDKUserConfig this_ptr_conv;
37573         this_ptr_conv.inner = untag_ptr(this_ptr);
37574         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37576         this_ptr_conv.is_owned = false;
37577         LDKChannelHandshakeConfig val_conv;
37578         val_conv.inner = untag_ptr(val);
37579         val_conv.is_owned = ptr_is_owned(val);
37580         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37581         val_conv = ChannelHandshakeConfig_clone(&val_conv);
37582         UserConfig_set_channel_handshake_config(&this_ptr_conv, val_conv);
37583 }
37584
37585 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_handshake_limits"))) TS_UserConfig_get_channel_handshake_limits(uint64_t this_ptr) {
37586         LDKUserConfig this_ptr_conv;
37587         this_ptr_conv.inner = untag_ptr(this_ptr);
37588         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37590         this_ptr_conv.is_owned = false;
37591         LDKChannelHandshakeLimits ret_var = UserConfig_get_channel_handshake_limits(&this_ptr_conv);
37592         uint64_t ret_ref = 0;
37593         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37594         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37595         return ret_ref;
37596 }
37597
37598 void  __attribute__((export_name("TS_UserConfig_set_channel_handshake_limits"))) TS_UserConfig_set_channel_handshake_limits(uint64_t this_ptr, uint64_t val) {
37599         LDKUserConfig this_ptr_conv;
37600         this_ptr_conv.inner = untag_ptr(this_ptr);
37601         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37603         this_ptr_conv.is_owned = false;
37604         LDKChannelHandshakeLimits val_conv;
37605         val_conv.inner = untag_ptr(val);
37606         val_conv.is_owned = ptr_is_owned(val);
37607         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37608         val_conv = ChannelHandshakeLimits_clone(&val_conv);
37609         UserConfig_set_channel_handshake_limits(&this_ptr_conv, val_conv);
37610 }
37611
37612 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_config"))) TS_UserConfig_get_channel_config(uint64_t this_ptr) {
37613         LDKUserConfig this_ptr_conv;
37614         this_ptr_conv.inner = untag_ptr(this_ptr);
37615         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37617         this_ptr_conv.is_owned = false;
37618         LDKChannelConfig ret_var = UserConfig_get_channel_config(&this_ptr_conv);
37619         uint64_t ret_ref = 0;
37620         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37621         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37622         return ret_ref;
37623 }
37624
37625 void  __attribute__((export_name("TS_UserConfig_set_channel_config"))) TS_UserConfig_set_channel_config(uint64_t this_ptr, uint64_t val) {
37626         LDKUserConfig this_ptr_conv;
37627         this_ptr_conv.inner = untag_ptr(this_ptr);
37628         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37630         this_ptr_conv.is_owned = false;
37631         LDKChannelConfig val_conv;
37632         val_conv.inner = untag_ptr(val);
37633         val_conv.is_owned = ptr_is_owned(val);
37634         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37635         val_conv = ChannelConfig_clone(&val_conv);
37636         UserConfig_set_channel_config(&this_ptr_conv, val_conv);
37637 }
37638
37639 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_forwards_to_priv_channels"))) TS_UserConfig_get_accept_forwards_to_priv_channels(uint64_t this_ptr) {
37640         LDKUserConfig this_ptr_conv;
37641         this_ptr_conv.inner = untag_ptr(this_ptr);
37642         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37644         this_ptr_conv.is_owned = false;
37645         jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
37646         return ret_conv;
37647 }
37648
37649 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) {
37650         LDKUserConfig this_ptr_conv;
37651         this_ptr_conv.inner = untag_ptr(this_ptr);
37652         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37654         this_ptr_conv.is_owned = false;
37655         UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
37656 }
37657
37658 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_inbound_channels"))) TS_UserConfig_get_accept_inbound_channels(uint64_t this_ptr) {
37659         LDKUserConfig this_ptr_conv;
37660         this_ptr_conv.inner = untag_ptr(this_ptr);
37661         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37663         this_ptr_conv.is_owned = false;
37664         jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
37665         return ret_conv;
37666 }
37667
37668 void  __attribute__((export_name("TS_UserConfig_set_accept_inbound_channels"))) TS_UserConfig_set_accept_inbound_channels(uint64_t this_ptr, jboolean val) {
37669         LDKUserConfig this_ptr_conv;
37670         this_ptr_conv.inner = untag_ptr(this_ptr);
37671         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37673         this_ptr_conv.is_owned = false;
37674         UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
37675 }
37676
37677 jboolean  __attribute__((export_name("TS_UserConfig_get_manually_accept_inbound_channels"))) TS_UserConfig_get_manually_accept_inbound_channels(uint64_t this_ptr) {
37678         LDKUserConfig this_ptr_conv;
37679         this_ptr_conv.inner = untag_ptr(this_ptr);
37680         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37682         this_ptr_conv.is_owned = false;
37683         jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
37684         return ret_conv;
37685 }
37686
37687 void  __attribute__((export_name("TS_UserConfig_set_manually_accept_inbound_channels"))) TS_UserConfig_set_manually_accept_inbound_channels(uint64_t this_ptr, jboolean val) {
37688         LDKUserConfig this_ptr_conv;
37689         this_ptr_conv.inner = untag_ptr(this_ptr);
37690         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37692         this_ptr_conv.is_owned = false;
37693         UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
37694 }
37695
37696 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_intercept_htlcs"))) TS_UserConfig_get_accept_intercept_htlcs(uint64_t this_ptr) {
37697         LDKUserConfig this_ptr_conv;
37698         this_ptr_conv.inner = untag_ptr(this_ptr);
37699         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37701         this_ptr_conv.is_owned = false;
37702         jboolean ret_conv = UserConfig_get_accept_intercept_htlcs(&this_ptr_conv);
37703         return ret_conv;
37704 }
37705
37706 void  __attribute__((export_name("TS_UserConfig_set_accept_intercept_htlcs"))) TS_UserConfig_set_accept_intercept_htlcs(uint64_t this_ptr, jboolean val) {
37707         LDKUserConfig this_ptr_conv;
37708         this_ptr_conv.inner = untag_ptr(this_ptr);
37709         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37711         this_ptr_conv.is_owned = false;
37712         UserConfig_set_accept_intercept_htlcs(&this_ptr_conv, val);
37713 }
37714
37715 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_mpp_keysend"))) TS_UserConfig_get_accept_mpp_keysend(uint64_t this_ptr) {
37716         LDKUserConfig this_ptr_conv;
37717         this_ptr_conv.inner = untag_ptr(this_ptr);
37718         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37720         this_ptr_conv.is_owned = false;
37721         jboolean ret_conv = UserConfig_get_accept_mpp_keysend(&this_ptr_conv);
37722         return ret_conv;
37723 }
37724
37725 void  __attribute__((export_name("TS_UserConfig_set_accept_mpp_keysend"))) TS_UserConfig_set_accept_mpp_keysend(uint64_t this_ptr, jboolean val) {
37726         LDKUserConfig 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         UserConfig_set_accept_mpp_keysend(&this_ptr_conv, val);
37732 }
37733
37734 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) {
37735         LDKChannelHandshakeConfig channel_handshake_config_arg_conv;
37736         channel_handshake_config_arg_conv.inner = untag_ptr(channel_handshake_config_arg);
37737         channel_handshake_config_arg_conv.is_owned = ptr_is_owned(channel_handshake_config_arg);
37738         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_config_arg_conv);
37739         channel_handshake_config_arg_conv = ChannelHandshakeConfig_clone(&channel_handshake_config_arg_conv);
37740         LDKChannelHandshakeLimits channel_handshake_limits_arg_conv;
37741         channel_handshake_limits_arg_conv.inner = untag_ptr(channel_handshake_limits_arg);
37742         channel_handshake_limits_arg_conv.is_owned = ptr_is_owned(channel_handshake_limits_arg);
37743         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_limits_arg_conv);
37744         channel_handshake_limits_arg_conv = ChannelHandshakeLimits_clone(&channel_handshake_limits_arg_conv);
37745         LDKChannelConfig channel_config_arg_conv;
37746         channel_config_arg_conv.inner = untag_ptr(channel_config_arg);
37747         channel_config_arg_conv.is_owned = ptr_is_owned(channel_config_arg);
37748         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_config_arg_conv);
37749         channel_config_arg_conv = ChannelConfig_clone(&channel_config_arg_conv);
37750         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);
37751         uint64_t ret_ref = 0;
37752         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37753         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37754         return ret_ref;
37755 }
37756
37757 static inline uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
37758         LDKUserConfig ret_var = UserConfig_clone(arg);
37759         uint64_t ret_ref = 0;
37760         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37761         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37762         return ret_ref;
37763 }
37764 int64_t  __attribute__((export_name("TS_UserConfig_clone_ptr"))) TS_UserConfig_clone_ptr(uint64_t arg) {
37765         LDKUserConfig arg_conv;
37766         arg_conv.inner = untag_ptr(arg);
37767         arg_conv.is_owned = ptr_is_owned(arg);
37768         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37769         arg_conv.is_owned = false;
37770         int64_t ret_conv = UserConfig_clone_ptr(&arg_conv);
37771         return ret_conv;
37772 }
37773
37774 uint64_t  __attribute__((export_name("TS_UserConfig_clone"))) TS_UserConfig_clone(uint64_t orig) {
37775         LDKUserConfig orig_conv;
37776         orig_conv.inner = untag_ptr(orig);
37777         orig_conv.is_owned = ptr_is_owned(orig);
37778         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37779         orig_conv.is_owned = false;
37780         LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
37781         uint64_t ret_ref = 0;
37782         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37783         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37784         return ret_ref;
37785 }
37786
37787 uint64_t  __attribute__((export_name("TS_UserConfig_default"))) TS_UserConfig_default() {
37788         LDKUserConfig ret_var = UserConfig_default();
37789         uint64_t ret_ref = 0;
37790         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37791         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37792         return ret_ref;
37793 }
37794
37795 void  __attribute__((export_name("TS_BestBlock_free"))) TS_BestBlock_free(uint64_t this_obj) {
37796         LDKBestBlock this_obj_conv;
37797         this_obj_conv.inner = untag_ptr(this_obj);
37798         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37800         BestBlock_free(this_obj_conv);
37801 }
37802
37803 int8_tArray  __attribute__((export_name("TS_BestBlock_get_block_hash"))) TS_BestBlock_get_block_hash(uint64_t this_ptr) {
37804         LDKBestBlock this_ptr_conv;
37805         this_ptr_conv.inner = untag_ptr(this_ptr);
37806         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37808         this_ptr_conv.is_owned = false;
37809         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37810         memcpy(ret_arr->elems, *BestBlock_get_block_hash(&this_ptr_conv), 32);
37811         return ret_arr;
37812 }
37813
37814 void  __attribute__((export_name("TS_BestBlock_set_block_hash"))) TS_BestBlock_set_block_hash(uint64_t this_ptr, int8_tArray val) {
37815         LDKBestBlock this_ptr_conv;
37816         this_ptr_conv.inner = untag_ptr(this_ptr);
37817         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37819         this_ptr_conv.is_owned = false;
37820         LDKThirtyTwoBytes val_ref;
37821         CHECK(val->arr_len == 32);
37822         memcpy(val_ref.data, val->elems, 32); FREE(val);
37823         BestBlock_set_block_hash(&this_ptr_conv, val_ref);
37824 }
37825
37826 int32_t  __attribute__((export_name("TS_BestBlock_get_height"))) TS_BestBlock_get_height(uint64_t this_ptr) {
37827         LDKBestBlock 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         int32_t ret_conv = BestBlock_get_height(&this_ptr_conv);
37833         return ret_conv;
37834 }
37835
37836 void  __attribute__((export_name("TS_BestBlock_set_height"))) TS_BestBlock_set_height(uint64_t this_ptr, int32_t val) {
37837         LDKBestBlock 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         BestBlock_set_height(&this_ptr_conv, val);
37843 }
37844
37845 uint64_t  __attribute__((export_name("TS_BestBlock_new"))) TS_BestBlock_new(int8_tArray block_hash_arg, int32_t height_arg) {
37846         LDKThirtyTwoBytes block_hash_arg_ref;
37847         CHECK(block_hash_arg->arr_len == 32);
37848         memcpy(block_hash_arg_ref.data, block_hash_arg->elems, 32); FREE(block_hash_arg);
37849         LDKBestBlock ret_var = BestBlock_new(block_hash_arg_ref, height_arg);
37850         uint64_t ret_ref = 0;
37851         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37852         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37853         return ret_ref;
37854 }
37855
37856 static inline uint64_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
37857         LDKBestBlock ret_var = BestBlock_clone(arg);
37858         uint64_t ret_ref = 0;
37859         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37860         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37861         return ret_ref;
37862 }
37863 int64_t  __attribute__((export_name("TS_BestBlock_clone_ptr"))) TS_BestBlock_clone_ptr(uint64_t arg) {
37864         LDKBestBlock arg_conv;
37865         arg_conv.inner = untag_ptr(arg);
37866         arg_conv.is_owned = ptr_is_owned(arg);
37867         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37868         arg_conv.is_owned = false;
37869         int64_t ret_conv = BestBlock_clone_ptr(&arg_conv);
37870         return ret_conv;
37871 }
37872
37873 uint64_t  __attribute__((export_name("TS_BestBlock_clone"))) TS_BestBlock_clone(uint64_t orig) {
37874         LDKBestBlock orig_conv;
37875         orig_conv.inner = untag_ptr(orig);
37876         orig_conv.is_owned = ptr_is_owned(orig);
37877         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37878         orig_conv.is_owned = false;
37879         LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
37880         uint64_t ret_ref = 0;
37881         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37882         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37883         return ret_ref;
37884 }
37885
37886 int64_t  __attribute__((export_name("TS_BestBlock_hash"))) TS_BestBlock_hash(uint64_t o) {
37887         LDKBestBlock o_conv;
37888         o_conv.inner = untag_ptr(o);
37889         o_conv.is_owned = ptr_is_owned(o);
37890         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37891         o_conv.is_owned = false;
37892         int64_t ret_conv = BestBlock_hash(&o_conv);
37893         return ret_conv;
37894 }
37895
37896 jboolean  __attribute__((export_name("TS_BestBlock_eq"))) TS_BestBlock_eq(uint64_t a, uint64_t b) {
37897         LDKBestBlock a_conv;
37898         a_conv.inner = untag_ptr(a);
37899         a_conv.is_owned = ptr_is_owned(a);
37900         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37901         a_conv.is_owned = false;
37902         LDKBestBlock b_conv;
37903         b_conv.inner = untag_ptr(b);
37904         b_conv.is_owned = ptr_is_owned(b);
37905         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37906         b_conv.is_owned = false;
37907         jboolean ret_conv = BestBlock_eq(&a_conv, &b_conv);
37908         return ret_conv;
37909 }
37910
37911 uint64_t  __attribute__((export_name("TS_BestBlock_from_network"))) TS_BestBlock_from_network(uint32_t network) {
37912         LDKNetwork network_conv = LDKNetwork_from_js(network);
37913         LDKBestBlock ret_var = BestBlock_from_network(network_conv);
37914         uint64_t ret_ref = 0;
37915         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37916         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37917         return ret_ref;
37918 }
37919
37920 int8_tArray  __attribute__((export_name("TS_BestBlock_write"))) TS_BestBlock_write(uint64_t obj) {
37921         LDKBestBlock obj_conv;
37922         obj_conv.inner = untag_ptr(obj);
37923         obj_conv.is_owned = ptr_is_owned(obj);
37924         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37925         obj_conv.is_owned = false;
37926         LDKCVec_u8Z ret_var = BestBlock_write(&obj_conv);
37927         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37928         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37929         CVec_u8Z_free(ret_var);
37930         return ret_arr;
37931 }
37932
37933 uint64_t  __attribute__((export_name("TS_BestBlock_read"))) TS_BestBlock_read(int8_tArray ser) {
37934         LDKu8slice ser_ref;
37935         ser_ref.datalen = ser->arr_len;
37936         ser_ref.data = ser->elems;
37937         LDKCResult_BestBlockDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BestBlockDecodeErrorZ), "LDKCResult_BestBlockDecodeErrorZ");
37938         *ret_conv = BestBlock_read(ser_ref);
37939         FREE(ser);
37940         return tag_ptr(ret_conv, true);
37941 }
37942
37943 void  __attribute__((export_name("TS_Listen_free"))) TS_Listen_free(uint64_t this_ptr) {
37944         if (!ptr_is_owned(this_ptr)) return;
37945         void* this_ptr_ptr = untag_ptr(this_ptr);
37946         CHECK_ACCESS(this_ptr_ptr);
37947         LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
37948         FREE(untag_ptr(this_ptr));
37949         Listen_free(this_ptr_conv);
37950 }
37951
37952 void  __attribute__((export_name("TS_Confirm_free"))) TS_Confirm_free(uint64_t this_ptr) {
37953         if (!ptr_is_owned(this_ptr)) return;
37954         void* this_ptr_ptr = untag_ptr(this_ptr);
37955         CHECK_ACCESS(this_ptr_ptr);
37956         LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
37957         FREE(untag_ptr(this_ptr));
37958         Confirm_free(this_ptr_conv);
37959 }
37960
37961 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_clone"))) TS_ChannelMonitorUpdateStatus_clone(uint64_t orig) {
37962         LDKChannelMonitorUpdateStatus* orig_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(orig);
37963         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_clone(orig_conv));
37964         return ret_conv;
37965 }
37966
37967 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_completed"))) TS_ChannelMonitorUpdateStatus_completed() {
37968         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_completed());
37969         return ret_conv;
37970 }
37971
37972 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_in_progress"))) TS_ChannelMonitorUpdateStatus_in_progress() {
37973         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_in_progress());
37974         return ret_conv;
37975 }
37976
37977 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_unrecoverable_error"))) TS_ChannelMonitorUpdateStatus_unrecoverable_error() {
37978         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_unrecoverable_error());
37979         return ret_conv;
37980 }
37981
37982 jboolean  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_eq"))) TS_ChannelMonitorUpdateStatus_eq(uint64_t a, uint64_t b) {
37983         LDKChannelMonitorUpdateStatus* a_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(a);
37984         LDKChannelMonitorUpdateStatus* b_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(b);
37985         jboolean ret_conv = ChannelMonitorUpdateStatus_eq(a_conv, b_conv);
37986         return ret_conv;
37987 }
37988
37989 void  __attribute__((export_name("TS_Watch_free"))) TS_Watch_free(uint64_t this_ptr) {
37990         if (!ptr_is_owned(this_ptr)) return;
37991         void* this_ptr_ptr = untag_ptr(this_ptr);
37992         CHECK_ACCESS(this_ptr_ptr);
37993         LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
37994         FREE(untag_ptr(this_ptr));
37995         Watch_free(this_ptr_conv);
37996 }
37997
37998 void  __attribute__((export_name("TS_Filter_free"))) TS_Filter_free(uint64_t this_ptr) {
37999         if (!ptr_is_owned(this_ptr)) return;
38000         void* this_ptr_ptr = untag_ptr(this_ptr);
38001         CHECK_ACCESS(this_ptr_ptr);
38002         LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
38003         FREE(untag_ptr(this_ptr));
38004         Filter_free(this_ptr_conv);
38005 }
38006
38007 void  __attribute__((export_name("TS_WatchedOutput_free"))) TS_WatchedOutput_free(uint64_t this_obj) {
38008         LDKWatchedOutput this_obj_conv;
38009         this_obj_conv.inner = untag_ptr(this_obj);
38010         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38012         WatchedOutput_free(this_obj_conv);
38013 }
38014
38015 uint64_t  __attribute__((export_name("TS_WatchedOutput_get_block_hash"))) TS_WatchedOutput_get_block_hash(uint64_t this_ptr) {
38016         LDKWatchedOutput this_ptr_conv;
38017         this_ptr_conv.inner = untag_ptr(this_ptr);
38018         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38020         this_ptr_conv.is_owned = false;
38021         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
38022         *ret_copy = WatchedOutput_get_block_hash(&this_ptr_conv);
38023         uint64_t ret_ref = tag_ptr(ret_copy, true);
38024         return ret_ref;
38025 }
38026
38027 void  __attribute__((export_name("TS_WatchedOutput_set_block_hash"))) TS_WatchedOutput_set_block_hash(uint64_t this_ptr, uint64_t val) {
38028         LDKWatchedOutput this_ptr_conv;
38029         this_ptr_conv.inner = untag_ptr(this_ptr);
38030         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38032         this_ptr_conv.is_owned = false;
38033         void* val_ptr = untag_ptr(val);
38034         CHECK_ACCESS(val_ptr);
38035         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
38036         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
38037         WatchedOutput_set_block_hash(&this_ptr_conv, val_conv);
38038 }
38039
38040 uint64_t  __attribute__((export_name("TS_WatchedOutput_get_outpoint"))) TS_WatchedOutput_get_outpoint(uint64_t this_ptr) {
38041         LDKWatchedOutput this_ptr_conv;
38042         this_ptr_conv.inner = untag_ptr(this_ptr);
38043         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38045         this_ptr_conv.is_owned = false;
38046         LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
38047         uint64_t ret_ref = 0;
38048         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38049         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38050         return ret_ref;
38051 }
38052
38053 void  __attribute__((export_name("TS_WatchedOutput_set_outpoint"))) TS_WatchedOutput_set_outpoint(uint64_t this_ptr, uint64_t val) {
38054         LDKWatchedOutput this_ptr_conv;
38055         this_ptr_conv.inner = untag_ptr(this_ptr);
38056         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38058         this_ptr_conv.is_owned = false;
38059         LDKOutPoint val_conv;
38060         val_conv.inner = untag_ptr(val);
38061         val_conv.is_owned = ptr_is_owned(val);
38062         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38063         val_conv = OutPoint_clone(&val_conv);
38064         WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
38065 }
38066
38067 int8_tArray  __attribute__((export_name("TS_WatchedOutput_get_script_pubkey"))) TS_WatchedOutput_get_script_pubkey(uint64_t this_ptr) {
38068         LDKWatchedOutput 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         LDKCVec_u8Z ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
38074         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38075         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38076         CVec_u8Z_free(ret_var);
38077         return ret_arr;
38078 }
38079
38080 void  __attribute__((export_name("TS_WatchedOutput_set_script_pubkey"))) TS_WatchedOutput_set_script_pubkey(uint64_t this_ptr, int8_tArray val) {
38081         LDKWatchedOutput this_ptr_conv;
38082         this_ptr_conv.inner = untag_ptr(this_ptr);
38083         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38085         this_ptr_conv.is_owned = false;
38086         LDKCVec_u8Z val_ref;
38087         val_ref.datalen = val->arr_len;
38088         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
38089         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
38090         WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
38091 }
38092
38093 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) {
38094         void* block_hash_arg_ptr = untag_ptr(block_hash_arg);
38095         CHECK_ACCESS(block_hash_arg_ptr);
38096         LDKCOption_ThirtyTwoBytesZ block_hash_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(block_hash_arg_ptr);
38097         block_hash_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(block_hash_arg));
38098         LDKOutPoint outpoint_arg_conv;
38099         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
38100         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
38101         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
38102         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
38103         LDKCVec_u8Z script_pubkey_arg_ref;
38104         script_pubkey_arg_ref.datalen = script_pubkey_arg->arr_len;
38105         script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
38106         memcpy(script_pubkey_arg_ref.data, script_pubkey_arg->elems, script_pubkey_arg_ref.datalen); FREE(script_pubkey_arg);
38107         LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_conv, outpoint_arg_conv, script_pubkey_arg_ref);
38108         uint64_t ret_ref = 0;
38109         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38110         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38111         return ret_ref;
38112 }
38113
38114 static inline uint64_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
38115         LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
38116         uint64_t ret_ref = 0;
38117         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38118         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38119         return ret_ref;
38120 }
38121 int64_t  __attribute__((export_name("TS_WatchedOutput_clone_ptr"))) TS_WatchedOutput_clone_ptr(uint64_t arg) {
38122         LDKWatchedOutput arg_conv;
38123         arg_conv.inner = untag_ptr(arg);
38124         arg_conv.is_owned = ptr_is_owned(arg);
38125         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38126         arg_conv.is_owned = false;
38127         int64_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
38128         return ret_conv;
38129 }
38130
38131 uint64_t  __attribute__((export_name("TS_WatchedOutput_clone"))) TS_WatchedOutput_clone(uint64_t orig) {
38132         LDKWatchedOutput orig_conv;
38133         orig_conv.inner = untag_ptr(orig);
38134         orig_conv.is_owned = ptr_is_owned(orig);
38135         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38136         orig_conv.is_owned = false;
38137         LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
38138         uint64_t ret_ref = 0;
38139         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38140         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38141         return ret_ref;
38142 }
38143
38144 jboolean  __attribute__((export_name("TS_WatchedOutput_eq"))) TS_WatchedOutput_eq(uint64_t a, uint64_t b) {
38145         LDKWatchedOutput a_conv;
38146         a_conv.inner = untag_ptr(a);
38147         a_conv.is_owned = ptr_is_owned(a);
38148         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38149         a_conv.is_owned = false;
38150         LDKWatchedOutput b_conv;
38151         b_conv.inner = untag_ptr(b);
38152         b_conv.is_owned = ptr_is_owned(b);
38153         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38154         b_conv.is_owned = false;
38155         jboolean ret_conv = WatchedOutput_eq(&a_conv, &b_conv);
38156         return ret_conv;
38157 }
38158
38159 int64_t  __attribute__((export_name("TS_WatchedOutput_hash"))) TS_WatchedOutput_hash(uint64_t o) {
38160         LDKWatchedOutput o_conv;
38161         o_conv.inner = untag_ptr(o);
38162         o_conv.is_owned = ptr_is_owned(o);
38163         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38164         o_conv.is_owned = false;
38165         int64_t ret_conv = WatchedOutput_hash(&o_conv);
38166         return ret_conv;
38167 }
38168
38169 void  __attribute__((export_name("TS_BroadcasterInterface_free"))) TS_BroadcasterInterface_free(uint64_t this_ptr) {
38170         if (!ptr_is_owned(this_ptr)) return;
38171         void* this_ptr_ptr = untag_ptr(this_ptr);
38172         CHECK_ACCESS(this_ptr_ptr);
38173         LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
38174         FREE(untag_ptr(this_ptr));
38175         BroadcasterInterface_free(this_ptr_conv);
38176 }
38177
38178 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_clone"))) TS_ConfirmationTarget_clone(uint64_t orig) {
38179         LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)untag_ptr(orig);
38180         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
38181         return ret_conv;
38182 }
38183
38184 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_on_chain_sweep"))) TS_ConfirmationTarget_on_chain_sweep() {
38185         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_on_chain_sweep());
38186         return ret_conv;
38187 }
38188
38189 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_min_allowed_anchor_channel_remote_fee"))) TS_ConfirmationTarget_min_allowed_anchor_channel_remote_fee() {
38190         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_min_allowed_anchor_channel_remote_fee());
38191         return ret_conv;
38192 }
38193
38194 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_min_allowed_non_anchor_channel_remote_fee"))) TS_ConfirmationTarget_min_allowed_non_anchor_channel_remote_fee() {
38195         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_min_allowed_non_anchor_channel_remote_fee());
38196         return ret_conv;
38197 }
38198
38199 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_anchor_channel_fee"))) TS_ConfirmationTarget_anchor_channel_fee() {
38200         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_anchor_channel_fee());
38201         return ret_conv;
38202 }
38203
38204 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_non_anchor_channel_fee"))) TS_ConfirmationTarget_non_anchor_channel_fee() {
38205         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_non_anchor_channel_fee());
38206         return ret_conv;
38207 }
38208
38209 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_channel_close_minimum"))) TS_ConfirmationTarget_channel_close_minimum() {
38210         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_channel_close_minimum());
38211         return ret_conv;
38212 }
38213
38214 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_output_spending_fee"))) TS_ConfirmationTarget_output_spending_fee() {
38215         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_output_spending_fee());
38216         return ret_conv;
38217 }
38218
38219 int64_t  __attribute__((export_name("TS_ConfirmationTarget_hash"))) TS_ConfirmationTarget_hash(uint64_t o) {
38220         LDKConfirmationTarget* o_conv = (LDKConfirmationTarget*)untag_ptr(o);
38221         int64_t ret_conv = ConfirmationTarget_hash(o_conv);
38222         return ret_conv;
38223 }
38224
38225 jboolean  __attribute__((export_name("TS_ConfirmationTarget_eq"))) TS_ConfirmationTarget_eq(uint64_t a, uint64_t b) {
38226         LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)untag_ptr(a);
38227         LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)untag_ptr(b);
38228         jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
38229         return ret_conv;
38230 }
38231
38232 void  __attribute__((export_name("TS_FeeEstimator_free"))) TS_FeeEstimator_free(uint64_t this_ptr) {
38233         if (!ptr_is_owned(this_ptr)) return;
38234         void* this_ptr_ptr = untag_ptr(this_ptr);
38235         CHECK_ACCESS(this_ptr_ptr);
38236         LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
38237         FREE(untag_ptr(this_ptr));
38238         FeeEstimator_free(this_ptr_conv);
38239 }
38240
38241 void  __attribute__((export_name("TS_MonitorUpdateId_free"))) TS_MonitorUpdateId_free(uint64_t this_obj) {
38242         LDKMonitorUpdateId this_obj_conv;
38243         this_obj_conv.inner = untag_ptr(this_obj);
38244         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38246         MonitorUpdateId_free(this_obj_conv);
38247 }
38248
38249 static inline uint64_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
38250         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
38251         uint64_t ret_ref = 0;
38252         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38253         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38254         return ret_ref;
38255 }
38256 int64_t  __attribute__((export_name("TS_MonitorUpdateId_clone_ptr"))) TS_MonitorUpdateId_clone_ptr(uint64_t arg) {
38257         LDKMonitorUpdateId arg_conv;
38258         arg_conv.inner = untag_ptr(arg);
38259         arg_conv.is_owned = ptr_is_owned(arg);
38260         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38261         arg_conv.is_owned = false;
38262         int64_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
38263         return ret_conv;
38264 }
38265
38266 uint64_t  __attribute__((export_name("TS_MonitorUpdateId_clone"))) TS_MonitorUpdateId_clone(uint64_t orig) {
38267         LDKMonitorUpdateId orig_conv;
38268         orig_conv.inner = untag_ptr(orig);
38269         orig_conv.is_owned = ptr_is_owned(orig);
38270         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38271         orig_conv.is_owned = false;
38272         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
38273         uint64_t ret_ref = 0;
38274         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38275         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38276         return ret_ref;
38277 }
38278
38279 int64_t  __attribute__((export_name("TS_MonitorUpdateId_hash"))) TS_MonitorUpdateId_hash(uint64_t o) {
38280         LDKMonitorUpdateId o_conv;
38281         o_conv.inner = untag_ptr(o);
38282         o_conv.is_owned = ptr_is_owned(o);
38283         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38284         o_conv.is_owned = false;
38285         int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
38286         return ret_conv;
38287 }
38288
38289 jboolean  __attribute__((export_name("TS_MonitorUpdateId_eq"))) TS_MonitorUpdateId_eq(uint64_t a, uint64_t b) {
38290         LDKMonitorUpdateId a_conv;
38291         a_conv.inner = untag_ptr(a);
38292         a_conv.is_owned = ptr_is_owned(a);
38293         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38294         a_conv.is_owned = false;
38295         LDKMonitorUpdateId b_conv;
38296         b_conv.inner = untag_ptr(b);
38297         b_conv.is_owned = ptr_is_owned(b);
38298         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38299         b_conv.is_owned = false;
38300         jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
38301         return ret_conv;
38302 }
38303
38304 void  __attribute__((export_name("TS_Persist_free"))) TS_Persist_free(uint64_t this_ptr) {
38305         if (!ptr_is_owned(this_ptr)) return;
38306         void* this_ptr_ptr = untag_ptr(this_ptr);
38307         CHECK_ACCESS(this_ptr_ptr);
38308         LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
38309         FREE(untag_ptr(this_ptr));
38310         Persist_free(this_ptr_conv);
38311 }
38312
38313 void  __attribute__((export_name("TS_LockedChannelMonitor_free"))) TS_LockedChannelMonitor_free(uint64_t this_obj) {
38314         LDKLockedChannelMonitor this_obj_conv;
38315         this_obj_conv.inner = untag_ptr(this_obj);
38316         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38318         LockedChannelMonitor_free(this_obj_conv);
38319 }
38320
38321 void  __attribute__((export_name("TS_ChainMonitor_free"))) TS_ChainMonitor_free(uint64_t this_obj) {
38322         LDKChainMonitor this_obj_conv;
38323         this_obj_conv.inner = untag_ptr(this_obj);
38324         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38326         ChainMonitor_free(this_obj_conv);
38327 }
38328
38329 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) {
38330         void* chain_source_ptr = untag_ptr(chain_source);
38331         CHECK_ACCESS(chain_source_ptr);
38332         LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
38333         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
38334         if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
38335                 // Manually implement clone for Java trait instances
38336                 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
38337                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38338                         LDKFilter_JCalls_cloned(&chain_source_conv.some);
38339                 }
38340         }
38341         void* broadcaster_ptr = untag_ptr(broadcaster);
38342         CHECK_ACCESS(broadcaster_ptr);
38343         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
38344         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
38345                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38346                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
38347         }
38348         void* logger_ptr = untag_ptr(logger);
38349         CHECK_ACCESS(logger_ptr);
38350         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
38351         if (logger_conv.free == LDKLogger_JCalls_free) {
38352                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38353                 LDKLogger_JCalls_cloned(&logger_conv);
38354         }
38355         void* feeest_ptr = untag_ptr(feeest);
38356         CHECK_ACCESS(feeest_ptr);
38357         LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
38358         if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
38359                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38360                 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
38361         }
38362         void* persister_ptr = untag_ptr(persister);
38363         CHECK_ACCESS(persister_ptr);
38364         LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
38365         if (persister_conv.free == LDKPersist_JCalls_free) {
38366                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38367                 LDKPersist_JCalls_cloned(&persister_conv);
38368         }
38369         LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
38370         uint64_t ret_ref = 0;
38371         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38372         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38373         return ret_ref;
38374 }
38375
38376 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_get_claimable_balances"))) TS_ChainMonitor_get_claimable_balances(uint64_t this_arg, uint64_tArray ignored_channels) {
38377         LDKChainMonitor this_arg_conv;
38378         this_arg_conv.inner = untag_ptr(this_arg);
38379         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38381         this_arg_conv.is_owned = false;
38382         LDKCVec_ChannelDetailsZ ignored_channels_constr;
38383         ignored_channels_constr.datalen = ignored_channels->arr_len;
38384         if (ignored_channels_constr.datalen > 0)
38385                 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
38386         else
38387                 ignored_channels_constr.data = NULL;
38388         uint64_t* ignored_channels_vals = ignored_channels->elems;
38389         for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
38390                 uint64_t ignored_channels_conv_16 = ignored_channels_vals[q];
38391                 LDKChannelDetails ignored_channels_conv_16_conv;
38392                 ignored_channels_conv_16_conv.inner = untag_ptr(ignored_channels_conv_16);
38393                 ignored_channels_conv_16_conv.is_owned = ptr_is_owned(ignored_channels_conv_16);
38394                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
38395                 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
38396                 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
38397         }
38398         FREE(ignored_channels);
38399         LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
38400         uint64_tArray ret_arr = NULL;
38401         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
38402         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
38403         for (size_t j = 0; j < ret_var.datalen; j++) {
38404                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
38405                 *ret_conv_9_copy = ret_var.data[j];
38406                 uint64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
38407                 ret_arr_ptr[j] = ret_conv_9_ref;
38408         }
38409         
38410         FREE(ret_var.data);
38411         return ret_arr;
38412 }
38413
38414 uint64_t  __attribute__((export_name("TS_ChainMonitor_get_monitor"))) TS_ChainMonitor_get_monitor(uint64_t this_arg, uint64_t funding_txo) {
38415         LDKChainMonitor this_arg_conv;
38416         this_arg_conv.inner = untag_ptr(this_arg);
38417         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38419         this_arg_conv.is_owned = false;
38420         LDKOutPoint funding_txo_conv;
38421         funding_txo_conv.inner = untag_ptr(funding_txo);
38422         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
38423         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
38424         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
38425         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
38426         *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
38427         return tag_ptr(ret_conv, true);
38428 }
38429
38430 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_list_monitors"))) TS_ChainMonitor_list_monitors(uint64_t this_arg) {
38431         LDKChainMonitor this_arg_conv;
38432         this_arg_conv.inner = untag_ptr(this_arg);
38433         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38435         this_arg_conv.is_owned = false;
38436         LDKCVec_C2Tuple_OutPointChannelIdZZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
38437         uint64_tArray ret_arr = NULL;
38438         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
38439         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
38440         for (size_t d = 0; d < ret_var.datalen; d++) {
38441                 LDKC2Tuple_OutPointChannelIdZ* ret_conv_29_conv = MALLOC(sizeof(LDKC2Tuple_OutPointChannelIdZ), "LDKC2Tuple_OutPointChannelIdZ");
38442                 *ret_conv_29_conv = ret_var.data[d];
38443                 ret_arr_ptr[d] = tag_ptr(ret_conv_29_conv, true);
38444         }
38445         
38446         FREE(ret_var.data);
38447         return ret_arr;
38448 }
38449
38450 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_list_pending_monitor_updates"))) TS_ChainMonitor_list_pending_monitor_updates(uint64_t this_arg) {
38451         LDKChainMonitor this_arg_conv;
38452         this_arg_conv.inner = untag_ptr(this_arg);
38453         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38455         this_arg_conv.is_owned = false;
38456         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret_var = ChainMonitor_list_pending_monitor_updates(&this_arg_conv);
38457         uint64_tArray ret_arr = NULL;
38458         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
38459         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
38460         for (size_t p = 0; p < ret_var.datalen; p++) {
38461                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv_41_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
38462                 *ret_conv_41_conv = ret_var.data[p];
38463                 ret_arr_ptr[p] = tag_ptr(ret_conv_41_conv, true);
38464         }
38465         
38466         FREE(ret_var.data);
38467         return ret_arr;
38468 }
38469
38470 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) {
38471         LDKChainMonitor this_arg_conv;
38472         this_arg_conv.inner = untag_ptr(this_arg);
38473         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38475         this_arg_conv.is_owned = false;
38476         LDKOutPoint funding_txo_conv;
38477         funding_txo_conv.inner = untag_ptr(funding_txo);
38478         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
38479         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
38480         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
38481         LDKMonitorUpdateId completed_update_id_conv;
38482         completed_update_id_conv.inner = untag_ptr(completed_update_id);
38483         completed_update_id_conv.is_owned = ptr_is_owned(completed_update_id);
38484         CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
38485         completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
38486         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38487         *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
38488         return tag_ptr(ret_conv, true);
38489 }
38490
38491 uint64_t  __attribute__((export_name("TS_ChainMonitor_get_update_future"))) TS_ChainMonitor_get_update_future(uint64_t this_arg) {
38492         LDKChainMonitor this_arg_conv;
38493         this_arg_conv.inner = untag_ptr(this_arg);
38494         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38496         this_arg_conv.is_owned = false;
38497         LDKFuture ret_var = ChainMonitor_get_update_future(&this_arg_conv);
38498         uint64_t ret_ref = 0;
38499         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38500         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38501         return ret_ref;
38502 }
38503
38504 void  __attribute__((export_name("TS_ChainMonitor_rebroadcast_pending_claims"))) TS_ChainMonitor_rebroadcast_pending_claims(uint64_t this_arg) {
38505         LDKChainMonitor this_arg_conv;
38506         this_arg_conv.inner = untag_ptr(this_arg);
38507         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38509         this_arg_conv.is_owned = false;
38510         ChainMonitor_rebroadcast_pending_claims(&this_arg_conv);
38511 }
38512
38513 void  __attribute__((export_name("TS_ChainMonitor_signer_unblocked"))) TS_ChainMonitor_signer_unblocked(uint64_t this_arg, uint64_t monitor_opt) {
38514         LDKChainMonitor this_arg_conv;
38515         this_arg_conv.inner = untag_ptr(this_arg);
38516         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38518         this_arg_conv.is_owned = false;
38519         LDKOutPoint monitor_opt_conv;
38520         monitor_opt_conv.inner = untag_ptr(monitor_opt);
38521         monitor_opt_conv.is_owned = ptr_is_owned(monitor_opt);
38522         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_opt_conv);
38523         monitor_opt_conv = OutPoint_clone(&monitor_opt_conv);
38524         ChainMonitor_signer_unblocked(&this_arg_conv, monitor_opt_conv);
38525 }
38526
38527 void  __attribute__((export_name("TS_ChainMonitor_archive_fully_resolved_channel_monitors"))) TS_ChainMonitor_archive_fully_resolved_channel_monitors(uint64_t this_arg) {
38528         LDKChainMonitor this_arg_conv;
38529         this_arg_conv.inner = untag_ptr(this_arg);
38530         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38532         this_arg_conv.is_owned = false;
38533         ChainMonitor_archive_fully_resolved_channel_monitors(&this_arg_conv);
38534 }
38535
38536 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Listen"))) TS_ChainMonitor_as_Listen(uint64_t this_arg) {
38537         LDKChainMonitor this_arg_conv;
38538         this_arg_conv.inner = untag_ptr(this_arg);
38539         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38541         this_arg_conv.is_owned = false;
38542         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
38543         *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
38544         return tag_ptr(ret_ret, true);
38545 }
38546
38547 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Confirm"))) TS_ChainMonitor_as_Confirm(uint64_t this_arg) {
38548         LDKChainMonitor this_arg_conv;
38549         this_arg_conv.inner = untag_ptr(this_arg);
38550         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38552         this_arg_conv.is_owned = false;
38553         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
38554         *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
38555         return tag_ptr(ret_ret, true);
38556 }
38557
38558 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Watch"))) TS_ChainMonitor_as_Watch(uint64_t this_arg) {
38559         LDKChainMonitor this_arg_conv;
38560         this_arg_conv.inner = untag_ptr(this_arg);
38561         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38563         this_arg_conv.is_owned = false;
38564         LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
38565         *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
38566         return tag_ptr(ret_ret, true);
38567 }
38568
38569 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_EventsProvider"))) TS_ChainMonitor_as_EventsProvider(uint64_t this_arg) {
38570         LDKChainMonitor this_arg_conv;
38571         this_arg_conv.inner = untag_ptr(this_arg);
38572         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38574         this_arg_conv.is_owned = false;
38575         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
38576         *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
38577         return tag_ptr(ret_ret, true);
38578 }
38579
38580 void  __attribute__((export_name("TS_ChannelMonitorUpdate_free"))) TS_ChannelMonitorUpdate_free(uint64_t this_obj) {
38581         LDKChannelMonitorUpdate this_obj_conv;
38582         this_obj_conv.inner = untag_ptr(this_obj);
38583         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38585         ChannelMonitorUpdate_free(this_obj_conv);
38586 }
38587
38588 int64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_get_update_id"))) TS_ChannelMonitorUpdate_get_update_id(uint64_t this_ptr) {
38589         LDKChannelMonitorUpdate this_ptr_conv;
38590         this_ptr_conv.inner = untag_ptr(this_ptr);
38591         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38593         this_ptr_conv.is_owned = false;
38594         int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
38595         return ret_conv;
38596 }
38597
38598 void  __attribute__((export_name("TS_ChannelMonitorUpdate_set_update_id"))) TS_ChannelMonitorUpdate_set_update_id(uint64_t this_ptr, int64_t val) {
38599         LDKChannelMonitorUpdate this_ptr_conv;
38600         this_ptr_conv.inner = untag_ptr(this_ptr);
38601         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38603         this_ptr_conv.is_owned = false;
38604         ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
38605 }
38606
38607 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_get_channel_id"))) TS_ChannelMonitorUpdate_get_channel_id(uint64_t this_ptr) {
38608         LDKChannelMonitorUpdate this_ptr_conv;
38609         this_ptr_conv.inner = untag_ptr(this_ptr);
38610         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38612         this_ptr_conv.is_owned = false;
38613         LDKChannelId ret_var = ChannelMonitorUpdate_get_channel_id(&this_ptr_conv);
38614         uint64_t ret_ref = 0;
38615         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38616         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38617         return ret_ref;
38618 }
38619
38620 void  __attribute__((export_name("TS_ChannelMonitorUpdate_set_channel_id"))) TS_ChannelMonitorUpdate_set_channel_id(uint64_t this_ptr, uint64_t val) {
38621         LDKChannelMonitorUpdate this_ptr_conv;
38622         this_ptr_conv.inner = untag_ptr(this_ptr);
38623         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38625         this_ptr_conv.is_owned = false;
38626         LDKChannelId val_conv;
38627         val_conv.inner = untag_ptr(val);
38628         val_conv.is_owned = ptr_is_owned(val);
38629         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38630         val_conv = ChannelId_clone(&val_conv);
38631         ChannelMonitorUpdate_set_channel_id(&this_ptr_conv, val_conv);
38632 }
38633
38634 static inline uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
38635         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
38636         uint64_t ret_ref = 0;
38637         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38638         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38639         return ret_ref;
38640 }
38641 int64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_clone_ptr"))) TS_ChannelMonitorUpdate_clone_ptr(uint64_t arg) {
38642         LDKChannelMonitorUpdate arg_conv;
38643         arg_conv.inner = untag_ptr(arg);
38644         arg_conv.is_owned = ptr_is_owned(arg);
38645         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38646         arg_conv.is_owned = false;
38647         int64_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
38648         return ret_conv;
38649 }
38650
38651 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_clone"))) TS_ChannelMonitorUpdate_clone(uint64_t orig) {
38652         LDKChannelMonitorUpdate orig_conv;
38653         orig_conv.inner = untag_ptr(orig);
38654         orig_conv.is_owned = ptr_is_owned(orig);
38655         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38656         orig_conv.is_owned = false;
38657         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
38658         uint64_t ret_ref = 0;
38659         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38660         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38661         return ret_ref;
38662 }
38663
38664 jboolean  __attribute__((export_name("TS_ChannelMonitorUpdate_eq"))) TS_ChannelMonitorUpdate_eq(uint64_t a, uint64_t b) {
38665         LDKChannelMonitorUpdate a_conv;
38666         a_conv.inner = untag_ptr(a);
38667         a_conv.is_owned = ptr_is_owned(a);
38668         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38669         a_conv.is_owned = false;
38670         LDKChannelMonitorUpdate b_conv;
38671         b_conv.inner = untag_ptr(b);
38672         b_conv.is_owned = ptr_is_owned(b);
38673         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38674         b_conv.is_owned = false;
38675         jboolean ret_conv = ChannelMonitorUpdate_eq(&a_conv, &b_conv);
38676         return ret_conv;
38677 }
38678
38679 int8_tArray  __attribute__((export_name("TS_ChannelMonitorUpdate_write"))) TS_ChannelMonitorUpdate_write(uint64_t obj) {
38680         LDKChannelMonitorUpdate obj_conv;
38681         obj_conv.inner = untag_ptr(obj);
38682         obj_conv.is_owned = ptr_is_owned(obj);
38683         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38684         obj_conv.is_owned = false;
38685         LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
38686         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38687         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38688         CVec_u8Z_free(ret_var);
38689         return ret_arr;
38690 }
38691
38692 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_read"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
38693         LDKu8slice ser_ref;
38694         ser_ref.datalen = ser->arr_len;
38695         ser_ref.data = ser->elems;
38696         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
38697         *ret_conv = ChannelMonitorUpdate_read(ser_ref);
38698         FREE(ser);
38699         return tag_ptr(ret_conv, true);
38700 }
38701
38702 void  __attribute__((export_name("TS_MonitorEvent_free"))) TS_MonitorEvent_free(uint64_t this_ptr) {
38703         if (!ptr_is_owned(this_ptr)) return;
38704         void* this_ptr_ptr = untag_ptr(this_ptr);
38705         CHECK_ACCESS(this_ptr_ptr);
38706         LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
38707         FREE(untag_ptr(this_ptr));
38708         MonitorEvent_free(this_ptr_conv);
38709 }
38710
38711 static inline uint64_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
38712         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
38713         *ret_copy = MonitorEvent_clone(arg);
38714         uint64_t ret_ref = tag_ptr(ret_copy, true);
38715         return ret_ref;
38716 }
38717 int64_t  __attribute__((export_name("TS_MonitorEvent_clone_ptr"))) TS_MonitorEvent_clone_ptr(uint64_t arg) {
38718         LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)untag_ptr(arg);
38719         int64_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
38720         return ret_conv;
38721 }
38722
38723 uint64_t  __attribute__((export_name("TS_MonitorEvent_clone"))) TS_MonitorEvent_clone(uint64_t orig) {
38724         LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)untag_ptr(orig);
38725         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
38726         *ret_copy = MonitorEvent_clone(orig_conv);
38727         uint64_t ret_ref = tag_ptr(ret_copy, true);
38728         return ret_ref;
38729 }
38730
38731 uint64_t  __attribute__((export_name("TS_MonitorEvent_htlcevent"))) TS_MonitorEvent_htlcevent(uint64_t a) {
38732         LDKHTLCUpdate a_conv;
38733         a_conv.inner = untag_ptr(a);
38734         a_conv.is_owned = ptr_is_owned(a);
38735         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38736         a_conv = HTLCUpdate_clone(&a_conv);
38737         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
38738         *ret_copy = MonitorEvent_htlcevent(a_conv);
38739         uint64_t ret_ref = tag_ptr(ret_copy, true);
38740         return ret_ref;
38741 }
38742
38743 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) {
38744         void* reason_ptr = untag_ptr(reason);
38745         CHECK_ACCESS(reason_ptr);
38746         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
38747         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
38748         LDKOutPoint outpoint_conv;
38749         outpoint_conv.inner = untag_ptr(outpoint);
38750         outpoint_conv.is_owned = ptr_is_owned(outpoint);
38751         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
38752         outpoint_conv = OutPoint_clone(&outpoint_conv);
38753         LDKChannelId channel_id_conv;
38754         channel_id_conv.inner = untag_ptr(channel_id);
38755         channel_id_conv.is_owned = ptr_is_owned(channel_id);
38756         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
38757         channel_id_conv = ChannelId_clone(&channel_id_conv);
38758         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
38759         *ret_copy = MonitorEvent_holder_force_closed_with_info(reason_conv, outpoint_conv, channel_id_conv);
38760         uint64_t ret_ref = tag_ptr(ret_copy, true);
38761         return ret_ref;
38762 }
38763
38764 uint64_t  __attribute__((export_name("TS_MonitorEvent_holder_force_closed"))) TS_MonitorEvent_holder_force_closed(uint64_t a) {
38765         LDKOutPoint a_conv;
38766         a_conv.inner = untag_ptr(a);
38767         a_conv.is_owned = ptr_is_owned(a);
38768         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38769         a_conv = OutPoint_clone(&a_conv);
38770         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
38771         *ret_copy = MonitorEvent_holder_force_closed(a_conv);
38772         uint64_t ret_ref = tag_ptr(ret_copy, true);
38773         return ret_ref;
38774 }
38775
38776 uint64_t  __attribute__((export_name("TS_MonitorEvent_completed"))) TS_MonitorEvent_completed(uint64_t funding_txo, uint64_t channel_id, int64_t monitor_update_id) {
38777         LDKOutPoint funding_txo_conv;
38778         funding_txo_conv.inner = untag_ptr(funding_txo);
38779         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
38780         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
38781         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
38782         LDKChannelId channel_id_conv;
38783         channel_id_conv.inner = untag_ptr(channel_id);
38784         channel_id_conv.is_owned = ptr_is_owned(channel_id);
38785         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
38786         channel_id_conv = ChannelId_clone(&channel_id_conv);
38787         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
38788         *ret_copy = MonitorEvent_completed(funding_txo_conv, channel_id_conv, monitor_update_id);
38789         uint64_t ret_ref = tag_ptr(ret_copy, true);
38790         return ret_ref;
38791 }
38792
38793 jboolean  __attribute__((export_name("TS_MonitorEvent_eq"))) TS_MonitorEvent_eq(uint64_t a, uint64_t b) {
38794         LDKMonitorEvent* a_conv = (LDKMonitorEvent*)untag_ptr(a);
38795         LDKMonitorEvent* b_conv = (LDKMonitorEvent*)untag_ptr(b);
38796         jboolean ret_conv = MonitorEvent_eq(a_conv, b_conv);
38797         return ret_conv;
38798 }
38799
38800 int8_tArray  __attribute__((export_name("TS_MonitorEvent_write"))) TS_MonitorEvent_write(uint64_t obj) {
38801         LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)untag_ptr(obj);
38802         LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
38803         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38804         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38805         CVec_u8Z_free(ret_var);
38806         return ret_arr;
38807 }
38808
38809 uint64_t  __attribute__((export_name("TS_MonitorEvent_read"))) TS_MonitorEvent_read(int8_tArray ser) {
38810         LDKu8slice ser_ref;
38811         ser_ref.datalen = ser->arr_len;
38812         ser_ref.data = ser->elems;
38813         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
38814         *ret_conv = MonitorEvent_read(ser_ref);
38815         FREE(ser);
38816         return tag_ptr(ret_conv, true);
38817 }
38818
38819 void  __attribute__((export_name("TS_HTLCUpdate_free"))) TS_HTLCUpdate_free(uint64_t this_obj) {
38820         LDKHTLCUpdate this_obj_conv;
38821         this_obj_conv.inner = untag_ptr(this_obj);
38822         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38824         HTLCUpdate_free(this_obj_conv);
38825 }
38826
38827 static inline uint64_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
38828         LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
38829         uint64_t ret_ref = 0;
38830         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38831         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38832         return ret_ref;
38833 }
38834 int64_t  __attribute__((export_name("TS_HTLCUpdate_clone_ptr"))) TS_HTLCUpdate_clone_ptr(uint64_t arg) {
38835         LDKHTLCUpdate arg_conv;
38836         arg_conv.inner = untag_ptr(arg);
38837         arg_conv.is_owned = ptr_is_owned(arg);
38838         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38839         arg_conv.is_owned = false;
38840         int64_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
38841         return ret_conv;
38842 }
38843
38844 uint64_t  __attribute__((export_name("TS_HTLCUpdate_clone"))) TS_HTLCUpdate_clone(uint64_t orig) {
38845         LDKHTLCUpdate orig_conv;
38846         orig_conv.inner = untag_ptr(orig);
38847         orig_conv.is_owned = ptr_is_owned(orig);
38848         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38849         orig_conv.is_owned = false;
38850         LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
38851         uint64_t ret_ref = 0;
38852         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38853         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38854         return ret_ref;
38855 }
38856
38857 jboolean  __attribute__((export_name("TS_HTLCUpdate_eq"))) TS_HTLCUpdate_eq(uint64_t a, uint64_t b) {
38858         LDKHTLCUpdate a_conv;
38859         a_conv.inner = untag_ptr(a);
38860         a_conv.is_owned = ptr_is_owned(a);
38861         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38862         a_conv.is_owned = false;
38863         LDKHTLCUpdate b_conv;
38864         b_conv.inner = untag_ptr(b);
38865         b_conv.is_owned = ptr_is_owned(b);
38866         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38867         b_conv.is_owned = false;
38868         jboolean ret_conv = HTLCUpdate_eq(&a_conv, &b_conv);
38869         return ret_conv;
38870 }
38871
38872 int8_tArray  __attribute__((export_name("TS_HTLCUpdate_write"))) TS_HTLCUpdate_write(uint64_t obj) {
38873         LDKHTLCUpdate obj_conv;
38874         obj_conv.inner = untag_ptr(obj);
38875         obj_conv.is_owned = ptr_is_owned(obj);
38876         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38877         obj_conv.is_owned = false;
38878         LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
38879         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38880         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38881         CVec_u8Z_free(ret_var);
38882         return ret_arr;
38883 }
38884
38885 uint64_t  __attribute__((export_name("TS_HTLCUpdate_read"))) TS_HTLCUpdate_read(int8_tArray ser) {
38886         LDKu8slice ser_ref;
38887         ser_ref.datalen = ser->arr_len;
38888         ser_ref.data = ser->elems;
38889         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
38890         *ret_conv = HTLCUpdate_read(ser_ref);
38891         FREE(ser);
38892         return tag_ptr(ret_conv, true);
38893 }
38894
38895 void  __attribute__((export_name("TS_Balance_free"))) TS_Balance_free(uint64_t this_ptr) {
38896         if (!ptr_is_owned(this_ptr)) return;
38897         void* this_ptr_ptr = untag_ptr(this_ptr);
38898         CHECK_ACCESS(this_ptr_ptr);
38899         LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
38900         FREE(untag_ptr(this_ptr));
38901         Balance_free(this_ptr_conv);
38902 }
38903
38904 static inline uint64_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
38905         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
38906         *ret_copy = Balance_clone(arg);
38907         uint64_t ret_ref = tag_ptr(ret_copy, true);
38908         return ret_ref;
38909 }
38910 int64_t  __attribute__((export_name("TS_Balance_clone_ptr"))) TS_Balance_clone_ptr(uint64_t arg) {
38911         LDKBalance* arg_conv = (LDKBalance*)untag_ptr(arg);
38912         int64_t ret_conv = Balance_clone_ptr(arg_conv);
38913         return ret_conv;
38914 }
38915
38916 uint64_t  __attribute__((export_name("TS_Balance_clone"))) TS_Balance_clone(uint64_t orig) {
38917         LDKBalance* orig_conv = (LDKBalance*)untag_ptr(orig);
38918         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
38919         *ret_copy = Balance_clone(orig_conv);
38920         uint64_t ret_ref = tag_ptr(ret_copy, true);
38921         return ret_ref;
38922 }
38923
38924 uint64_t  __attribute__((export_name("TS_Balance_claimable_on_channel_close"))) TS_Balance_claimable_on_channel_close(int64_t amount_satoshis) {
38925         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
38926         *ret_copy = Balance_claimable_on_channel_close(amount_satoshis);
38927         uint64_t ret_ref = tag_ptr(ret_copy, true);
38928         return ret_ref;
38929 }
38930
38931 uint64_t  __attribute__((export_name("TS_Balance_claimable_awaiting_confirmations"))) TS_Balance_claimable_awaiting_confirmations(int64_t amount_satoshis, int32_t confirmation_height) {
38932         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
38933         *ret_copy = Balance_claimable_awaiting_confirmations(amount_satoshis, confirmation_height);
38934         uint64_t ret_ref = tag_ptr(ret_copy, true);
38935         return ret_ref;
38936 }
38937
38938 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) {
38939         LDKThirtyTwoBytes payment_hash_ref;
38940         CHECK(payment_hash->arr_len == 32);
38941         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
38942         LDKThirtyTwoBytes payment_preimage_ref;
38943         CHECK(payment_preimage->arr_len == 32);
38944         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
38945         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
38946         *ret_copy = Balance_contentious_claimable(amount_satoshis, timeout_height, payment_hash_ref, payment_preimage_ref);
38947         uint64_t ret_ref = tag_ptr(ret_copy, true);
38948         return ret_ref;
38949 }
38950
38951 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) {
38952         LDKThirtyTwoBytes payment_hash_ref;
38953         CHECK(payment_hash->arr_len == 32);
38954         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
38955         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
38956         *ret_copy = Balance_maybe_timeout_claimable_htlc(amount_satoshis, claimable_height, payment_hash_ref);
38957         uint64_t ret_ref = tag_ptr(ret_copy, true);
38958         return ret_ref;
38959 }
38960
38961 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) {
38962         LDKThirtyTwoBytes payment_hash_ref;
38963         CHECK(payment_hash->arr_len == 32);
38964         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
38965         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
38966         *ret_copy = Balance_maybe_preimage_claimable_htlc(amount_satoshis, expiry_height, payment_hash_ref);
38967         uint64_t ret_ref = tag_ptr(ret_copy, true);
38968         return ret_ref;
38969 }
38970
38971 uint64_t  __attribute__((export_name("TS_Balance_counterparty_revoked_output_claimable"))) TS_Balance_counterparty_revoked_output_claimable(int64_t amount_satoshis) {
38972         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
38973         *ret_copy = Balance_counterparty_revoked_output_claimable(amount_satoshis);
38974         uint64_t ret_ref = tag_ptr(ret_copy, true);
38975         return ret_ref;
38976 }
38977
38978 jboolean  __attribute__((export_name("TS_Balance_eq"))) TS_Balance_eq(uint64_t a, uint64_t b) {
38979         LDKBalance* a_conv = (LDKBalance*)untag_ptr(a);
38980         LDKBalance* b_conv = (LDKBalance*)untag_ptr(b);
38981         jboolean ret_conv = Balance_eq(a_conv, b_conv);
38982         return ret_conv;
38983 }
38984
38985 int64_t  __attribute__((export_name("TS_Balance_claimable_amount_satoshis"))) TS_Balance_claimable_amount_satoshis(uint64_t this_arg) {
38986         LDKBalance* this_arg_conv = (LDKBalance*)untag_ptr(this_arg);
38987         int64_t ret_conv = Balance_claimable_amount_satoshis(this_arg_conv);
38988         return ret_conv;
38989 }
38990
38991 void  __attribute__((export_name("TS_ChannelMonitor_free"))) TS_ChannelMonitor_free(uint64_t this_obj) {
38992         LDKChannelMonitor this_obj_conv;
38993         this_obj_conv.inner = untag_ptr(this_obj);
38994         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38996         ChannelMonitor_free(this_obj_conv);
38997 }
38998
38999 static inline uint64_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
39000         LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
39001         uint64_t ret_ref = 0;
39002         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39003         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39004         return ret_ref;
39005 }
39006 int64_t  __attribute__((export_name("TS_ChannelMonitor_clone_ptr"))) TS_ChannelMonitor_clone_ptr(uint64_t arg) {
39007         LDKChannelMonitor arg_conv;
39008         arg_conv.inner = untag_ptr(arg);
39009         arg_conv.is_owned = ptr_is_owned(arg);
39010         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39011         arg_conv.is_owned = false;
39012         int64_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
39013         return ret_conv;
39014 }
39015
39016 uint64_t  __attribute__((export_name("TS_ChannelMonitor_clone"))) TS_ChannelMonitor_clone(uint64_t orig) {
39017         LDKChannelMonitor orig_conv;
39018         orig_conv.inner = untag_ptr(orig);
39019         orig_conv.is_owned = ptr_is_owned(orig);
39020         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39021         orig_conv.is_owned = false;
39022         LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
39023         uint64_t ret_ref = 0;
39024         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39025         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39026         return ret_ref;
39027 }
39028
39029 int8_tArray  __attribute__((export_name("TS_ChannelMonitor_write"))) TS_ChannelMonitor_write(uint64_t obj) {
39030         LDKChannelMonitor obj_conv;
39031         obj_conv.inner = untag_ptr(obj);
39032         obj_conv.is_owned = ptr_is_owned(obj);
39033         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39034         obj_conv.is_owned = false;
39035         LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
39036         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39037         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39038         CVec_u8Z_free(ret_var);
39039         return ret_arr;
39040 }
39041
39042 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) {
39043         LDKChannelMonitor this_arg_conv;
39044         this_arg_conv.inner = untag_ptr(this_arg);
39045         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39047         this_arg_conv.is_owned = false;
39048         LDKChannelMonitorUpdate updates_conv;
39049         updates_conv.inner = untag_ptr(updates);
39050         updates_conv.is_owned = ptr_is_owned(updates);
39051         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
39052         updates_conv.is_owned = false;
39053         void* broadcaster_ptr = untag_ptr(broadcaster);
39054         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
39055         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
39056         void* fee_estimator_ptr = untag_ptr(fee_estimator);
39057         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
39058         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
39059         void* logger_ptr = untag_ptr(logger);
39060         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
39061         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
39062         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
39063         *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
39064         return tag_ptr(ret_conv, true);
39065 }
39066
39067 int64_t  __attribute__((export_name("TS_ChannelMonitor_get_latest_update_id"))) TS_ChannelMonitor_get_latest_update_id(uint64_t this_arg) {
39068         LDKChannelMonitor this_arg_conv;
39069         this_arg_conv.inner = untag_ptr(this_arg);
39070         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39072         this_arg_conv.is_owned = false;
39073         int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
39074         return ret_conv;
39075 }
39076
39077 uint64_t  __attribute__((export_name("TS_ChannelMonitor_get_funding_txo"))) TS_ChannelMonitor_get_funding_txo(uint64_t this_arg) {
39078         LDKChannelMonitor this_arg_conv;
39079         this_arg_conv.inner = untag_ptr(this_arg);
39080         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39082         this_arg_conv.is_owned = false;
39083         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
39084         *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
39085         return tag_ptr(ret_conv, true);
39086 }
39087
39088 uint64_t  __attribute__((export_name("TS_ChannelMonitor_channel_id"))) TS_ChannelMonitor_channel_id(uint64_t this_arg) {
39089         LDKChannelMonitor this_arg_conv;
39090         this_arg_conv.inner = untag_ptr(this_arg);
39091         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39093         this_arg_conv.is_owned = false;
39094         LDKChannelId ret_var = ChannelMonitor_channel_id(&this_arg_conv);
39095         uint64_t ret_ref = 0;
39096         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39097         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39098         return ret_ref;
39099 }
39100
39101 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_outputs_to_watch"))) TS_ChannelMonitor_get_outputs_to_watch(uint64_t this_arg) {
39102         LDKChannelMonitor this_arg_conv;
39103         this_arg_conv.inner = untag_ptr(this_arg);
39104         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39106         this_arg_conv.is_owned = false;
39107         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
39108         uint64_tArray ret_arr = NULL;
39109         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
39110         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
39111         for (size_t a = 0; a < ret_var.datalen; a++) {
39112                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv_52_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
39113                 *ret_conv_52_conv = ret_var.data[a];
39114                 ret_arr_ptr[a] = tag_ptr(ret_conv_52_conv, true);
39115         }
39116         
39117         FREE(ret_var.data);
39118         return ret_arr;
39119 }
39120
39121 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) {
39122         LDKChannelMonitor this_arg_conv;
39123         this_arg_conv.inner = untag_ptr(this_arg);
39124         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39126         this_arg_conv.is_owned = false;
39127         void* filter_ptr = untag_ptr(filter);
39128         if (ptr_is_owned(filter)) { CHECK_ACCESS(filter_ptr); }
39129         LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
39130         void* logger_ptr = untag_ptr(logger);
39131         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
39132         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
39133         ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv, logger_conv);
39134 }
39135
39136 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) {
39137         LDKChannelMonitor this_arg_conv;
39138         this_arg_conv.inner = untag_ptr(this_arg);
39139         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39141         this_arg_conv.is_owned = false;
39142         LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
39143         uint64_tArray ret_arr = NULL;
39144         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
39145         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
39146         for (size_t o = 0; o < ret_var.datalen; o++) {
39147                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
39148                 *ret_conv_14_copy = ret_var.data[o];
39149                 uint64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
39150                 ret_arr_ptr[o] = ret_conv_14_ref;
39151         }
39152         
39153         FREE(ret_var.data);
39154         return ret_arr;
39155 }
39156
39157 void  __attribute__((export_name("TS_ChannelMonitor_process_pending_events"))) TS_ChannelMonitor_process_pending_events(uint64_t this_arg, uint64_t handler) {
39158         LDKChannelMonitor this_arg_conv;
39159         this_arg_conv.inner = untag_ptr(this_arg);
39160         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39162         this_arg_conv.is_owned = false;
39163         void* handler_ptr = untag_ptr(handler);
39164         if (ptr_is_owned(handler)) { CHECK_ACCESS(handler_ptr); }
39165         LDKEventHandler* handler_conv = (LDKEventHandler*)handler_ptr;
39166         ChannelMonitor_process_pending_events(&this_arg_conv, handler_conv);
39167 }
39168
39169 uint64_t  __attribute__((export_name("TS_ChannelMonitor_initial_counterparty_commitment_tx"))) TS_ChannelMonitor_initial_counterparty_commitment_tx(uint64_t this_arg) {
39170         LDKChannelMonitor this_arg_conv;
39171         this_arg_conv.inner = untag_ptr(this_arg);
39172         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39174         this_arg_conv.is_owned = false;
39175         LDKCommitmentTransaction ret_var = ChannelMonitor_initial_counterparty_commitment_tx(&this_arg_conv);
39176         uint64_t ret_ref = 0;
39177         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39178         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39179         return ret_ref;
39180 }
39181
39182 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) {
39183         LDKChannelMonitor this_arg_conv;
39184         this_arg_conv.inner = untag_ptr(this_arg);
39185         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39187         this_arg_conv.is_owned = false;
39188         LDKChannelMonitorUpdate update_conv;
39189         update_conv.inner = untag_ptr(update);
39190         update_conv.is_owned = ptr_is_owned(update);
39191         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
39192         update_conv.is_owned = false;
39193         LDKCVec_CommitmentTransactionZ ret_var = ChannelMonitor_counterparty_commitment_txs_from_update(&this_arg_conv, &update_conv);
39194         uint64_tArray ret_arr = NULL;
39195         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
39196         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
39197         for (size_t x = 0; x < ret_var.datalen; x++) {
39198                 LDKCommitmentTransaction ret_conv_23_var = ret_var.data[x];
39199                 uint64_t ret_conv_23_ref = 0;
39200                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_23_var);
39201                 ret_conv_23_ref = tag_ptr(ret_conv_23_var.inner, ret_conv_23_var.is_owned);
39202                 ret_arr_ptr[x] = ret_conv_23_ref;
39203         }
39204         
39205         FREE(ret_var.data);
39206         return ret_arr;
39207 }
39208
39209 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) {
39210         LDKChannelMonitor this_arg_conv;
39211         this_arg_conv.inner = untag_ptr(this_arg);
39212         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39214         this_arg_conv.is_owned = false;
39215         LDKTransaction justice_tx_ref;
39216         justice_tx_ref.datalen = justice_tx->arr_len;
39217         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
39218         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
39219         justice_tx_ref.data_is_owned = true;
39220         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
39221         *ret_conv = ChannelMonitor_sign_to_local_justice_tx(&this_arg_conv, justice_tx_ref, input_idx, value, commitment_number);
39222         return tag_ptr(ret_conv, true);
39223 }
39224
39225 int8_tArray  __attribute__((export_name("TS_ChannelMonitor_get_counterparty_node_id"))) TS_ChannelMonitor_get_counterparty_node_id(uint64_t this_arg) {
39226         LDKChannelMonitor this_arg_conv;
39227         this_arg_conv.inner = untag_ptr(this_arg);
39228         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39230         this_arg_conv.is_owned = false;
39231         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
39232         memcpy(ret_arr->elems, ChannelMonitor_get_counterparty_node_id(&this_arg_conv).compressed_form, 33);
39233         return ret_arr;
39234 }
39235
39236 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) {
39237         LDKChannelMonitor this_arg_conv;
39238         this_arg_conv.inner = untag_ptr(this_arg);
39239         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39241         this_arg_conv.is_owned = false;
39242         void* broadcaster_ptr = untag_ptr(broadcaster);
39243         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
39244         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
39245         void* fee_estimator_ptr = untag_ptr(fee_estimator);
39246         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
39247         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
39248         void* logger_ptr = untag_ptr(logger);
39249         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
39250         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
39251         ChannelMonitor_broadcast_latest_holder_commitment_txn(&this_arg_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
39252 }
39253
39254 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) {
39255         LDKChannelMonitor this_arg_conv;
39256         this_arg_conv.inner = untag_ptr(this_arg);
39257         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39259         this_arg_conv.is_owned = false;
39260         uint8_t header_arr[80];
39261         CHECK(header->arr_len == 80);
39262         memcpy(header_arr, header->elems, 80); FREE(header);
39263         uint8_t (*header_ref)[80] = &header_arr;
39264         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
39265         txdata_constr.datalen = txdata->arr_len;
39266         if (txdata_constr.datalen > 0)
39267                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
39268         else
39269                 txdata_constr.data = NULL;
39270         uint64_t* txdata_vals = txdata->elems;
39271         for (size_t c = 0; c < txdata_constr.datalen; c++) {
39272                 uint64_t txdata_conv_28 = txdata_vals[c];
39273                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
39274                 CHECK_ACCESS(txdata_conv_28_ptr);
39275                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
39276                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
39277                 txdata_constr.data[c] = txdata_conv_28_conv;
39278         }
39279         FREE(txdata);
39280         void* broadcaster_ptr = untag_ptr(broadcaster);
39281         CHECK_ACCESS(broadcaster_ptr);
39282         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
39283         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
39284                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39285                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
39286         }
39287         void* fee_estimator_ptr = untag_ptr(fee_estimator);
39288         CHECK_ACCESS(fee_estimator_ptr);
39289         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
39290         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
39291                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39292                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
39293         }
39294         void* logger_ptr = untag_ptr(logger);
39295         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
39296         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
39297         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);
39298         uint64_tArray ret_arr = NULL;
39299         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
39300         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
39301         for (size_t x = 0; x < ret_var.datalen; x++) {
39302                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
39303                 *ret_conv_49_conv = ret_var.data[x];
39304                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
39305         }
39306         
39307         FREE(ret_var.data);
39308         return ret_arr;
39309 }
39310
39311 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) {
39312         LDKChannelMonitor this_arg_conv;
39313         this_arg_conv.inner = untag_ptr(this_arg);
39314         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39316         this_arg_conv.is_owned = false;
39317         uint8_t header_arr[80];
39318         CHECK(header->arr_len == 80);
39319         memcpy(header_arr, header->elems, 80); FREE(header);
39320         uint8_t (*header_ref)[80] = &header_arr;
39321         void* broadcaster_ptr = untag_ptr(broadcaster);
39322         CHECK_ACCESS(broadcaster_ptr);
39323         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
39324         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
39325                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39326                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
39327         }
39328         void* fee_estimator_ptr = untag_ptr(fee_estimator);
39329         CHECK_ACCESS(fee_estimator_ptr);
39330         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
39331         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
39332                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39333                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
39334         }
39335         void* logger_ptr = untag_ptr(logger);
39336         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
39337         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
39338         ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
39339 }
39340
39341 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) {
39342         LDKChannelMonitor this_arg_conv;
39343         this_arg_conv.inner = untag_ptr(this_arg);
39344         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39346         this_arg_conv.is_owned = false;
39347         uint8_t header_arr[80];
39348         CHECK(header->arr_len == 80);
39349         memcpy(header_arr, header->elems, 80); FREE(header);
39350         uint8_t (*header_ref)[80] = &header_arr;
39351         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
39352         txdata_constr.datalen = txdata->arr_len;
39353         if (txdata_constr.datalen > 0)
39354                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
39355         else
39356                 txdata_constr.data = NULL;
39357         uint64_t* txdata_vals = txdata->elems;
39358         for (size_t c = 0; c < txdata_constr.datalen; c++) {
39359                 uint64_t txdata_conv_28 = txdata_vals[c];
39360                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
39361                 CHECK_ACCESS(txdata_conv_28_ptr);
39362                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
39363                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
39364                 txdata_constr.data[c] = txdata_conv_28_conv;
39365         }
39366         FREE(txdata);
39367         void* broadcaster_ptr = untag_ptr(broadcaster);
39368         CHECK_ACCESS(broadcaster_ptr);
39369         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
39370         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
39371                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39372                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
39373         }
39374         void* fee_estimator_ptr = untag_ptr(fee_estimator);
39375         CHECK_ACCESS(fee_estimator_ptr);
39376         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
39377         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
39378                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39379                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
39380         }
39381         void* logger_ptr = untag_ptr(logger);
39382         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
39383         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
39384         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);
39385         uint64_tArray ret_arr = NULL;
39386         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
39387         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
39388         for (size_t x = 0; x < ret_var.datalen; x++) {
39389                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
39390                 *ret_conv_49_conv = ret_var.data[x];
39391                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
39392         }
39393         
39394         FREE(ret_var.data);
39395         return ret_arr;
39396 }
39397
39398 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) {
39399         LDKChannelMonitor this_arg_conv;
39400         this_arg_conv.inner = untag_ptr(this_arg);
39401         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39403         this_arg_conv.is_owned = false;
39404         uint8_t txid_arr[32];
39405         CHECK(txid->arr_len == 32);
39406         memcpy(txid_arr, txid->elems, 32); FREE(txid);
39407         uint8_t (*txid_ref)[32] = &txid_arr;
39408         void* broadcaster_ptr = untag_ptr(broadcaster);
39409         CHECK_ACCESS(broadcaster_ptr);
39410         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
39411         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
39412                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39413                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
39414         }
39415         void* fee_estimator_ptr = untag_ptr(fee_estimator);
39416         CHECK_ACCESS(fee_estimator_ptr);
39417         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
39418         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
39419                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39420                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
39421         }
39422         void* logger_ptr = untag_ptr(logger);
39423         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
39424         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
39425         ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
39426 }
39427
39428 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) {
39429         LDKChannelMonitor this_arg_conv;
39430         this_arg_conv.inner = untag_ptr(this_arg);
39431         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39433         this_arg_conv.is_owned = false;
39434         uint8_t header_arr[80];
39435         CHECK(header->arr_len == 80);
39436         memcpy(header_arr, header->elems, 80); FREE(header);
39437         uint8_t (*header_ref)[80] = &header_arr;
39438         void* broadcaster_ptr = untag_ptr(broadcaster);
39439         CHECK_ACCESS(broadcaster_ptr);
39440         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
39441         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
39442                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39443                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
39444         }
39445         void* fee_estimator_ptr = untag_ptr(fee_estimator);
39446         CHECK_ACCESS(fee_estimator_ptr);
39447         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
39448         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
39449                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39450                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
39451         }
39452         void* logger_ptr = untag_ptr(logger);
39453         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
39454         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
39455         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
39456         uint64_tArray ret_arr = NULL;
39457         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
39458         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
39459         for (size_t x = 0; x < ret_var.datalen; x++) {
39460                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
39461                 *ret_conv_49_conv = ret_var.data[x];
39462                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
39463         }
39464         
39465         FREE(ret_var.data);
39466         return ret_arr;
39467 }
39468
39469 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_relevant_txids"))) TS_ChannelMonitor_get_relevant_txids(uint64_t this_arg) {
39470         LDKChannelMonitor this_arg_conv;
39471         this_arg_conv.inner = untag_ptr(this_arg);
39472         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39474         this_arg_conv.is_owned = false;
39475         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
39476         uint64_tArray ret_arr = NULL;
39477         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
39478         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
39479         for (size_t c = 0; c < ret_var.datalen; c++) {
39480                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv_54_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
39481                 *ret_conv_54_conv = ret_var.data[c];
39482                 ret_arr_ptr[c] = tag_ptr(ret_conv_54_conv, true);
39483         }
39484         
39485         FREE(ret_var.data);
39486         return ret_arr;
39487 }
39488
39489 uint64_t  __attribute__((export_name("TS_ChannelMonitor_current_best_block"))) TS_ChannelMonitor_current_best_block(uint64_t this_arg) {
39490         LDKChannelMonitor this_arg_conv;
39491         this_arg_conv.inner = untag_ptr(this_arg);
39492         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39494         this_arg_conv.is_owned = false;
39495         LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
39496         uint64_t ret_ref = 0;
39497         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39498         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39499         return ret_ref;
39500 }
39501
39502 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) {
39503         LDKChannelMonitor this_arg_conv;
39504         this_arg_conv.inner = untag_ptr(this_arg);
39505         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39507         this_arg_conv.is_owned = false;
39508         void* broadcaster_ptr = untag_ptr(broadcaster);
39509         CHECK_ACCESS(broadcaster_ptr);
39510         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
39511         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
39512                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39513                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
39514         }
39515         void* fee_estimator_ptr = untag_ptr(fee_estimator);
39516         CHECK_ACCESS(fee_estimator_ptr);
39517         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
39518         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
39519                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39520                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
39521         }
39522         void* logger_ptr = untag_ptr(logger);
39523         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
39524         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
39525         ChannelMonitor_rebroadcast_pending_claims(&this_arg_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
39526 }
39527
39528 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) {
39529         LDKChannelMonitor this_arg_conv;
39530         this_arg_conv.inner = untag_ptr(this_arg);
39531         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39533         this_arg_conv.is_owned = false;
39534         void* broadcaster_ptr = untag_ptr(broadcaster);
39535         CHECK_ACCESS(broadcaster_ptr);
39536         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
39537         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
39538                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39539                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
39540         }
39541         void* fee_estimator_ptr = untag_ptr(fee_estimator);
39542         CHECK_ACCESS(fee_estimator_ptr);
39543         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
39544         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
39545                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39546                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
39547         }
39548         void* logger_ptr = untag_ptr(logger);
39549         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
39550         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
39551         ChannelMonitor_signer_unblocked(&this_arg_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
39552 }
39553
39554 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) {
39555         LDKChannelMonitor this_arg_conv;
39556         this_arg_conv.inner = untag_ptr(this_arg);
39557         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39559         this_arg_conv.is_owned = false;
39560         LDKTransaction tx_ref;
39561         tx_ref.datalen = tx->arr_len;
39562         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
39563         memcpy(tx_ref.data, tx->elems, tx_ref.datalen); FREE(tx);
39564         tx_ref.data_is_owned = true;
39565         LDKCVec_SpendableOutputDescriptorZ ret_var = ChannelMonitor_get_spendable_outputs(&this_arg_conv, tx_ref, confirmation_height);
39566         uint64_tArray ret_arr = NULL;
39567         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
39568         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
39569         for (size_t b = 0; b < ret_var.datalen; b++) {
39570                 LDKSpendableOutputDescriptor *ret_conv_27_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
39571                 *ret_conv_27_copy = ret_var.data[b];
39572                 uint64_t ret_conv_27_ref = tag_ptr(ret_conv_27_copy, true);
39573                 ret_arr_ptr[b] = ret_conv_27_ref;
39574         }
39575         
39576         FREE(ret_var.data);
39577         return ret_arr;
39578 }
39579
39580 jboolean  __attribute__((export_name("TS_ChannelMonitor_is_fully_resolved"))) TS_ChannelMonitor_is_fully_resolved(uint64_t this_arg, uint64_t logger) {
39581         LDKChannelMonitor this_arg_conv;
39582         this_arg_conv.inner = untag_ptr(this_arg);
39583         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39585         this_arg_conv.is_owned = false;
39586         void* logger_ptr = untag_ptr(logger);
39587         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
39588         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
39589         jboolean ret_conv = ChannelMonitor_is_fully_resolved(&this_arg_conv, logger_conv);
39590         return ret_conv;
39591 }
39592
39593 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_claimable_balances"))) TS_ChannelMonitor_get_claimable_balances(uint64_t this_arg) {
39594         LDKChannelMonitor this_arg_conv;
39595         this_arg_conv.inner = untag_ptr(this_arg);
39596         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39598         this_arg_conv.is_owned = false;
39599         LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
39600         uint64_tArray ret_arr = NULL;
39601         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
39602         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
39603         for (size_t j = 0; j < ret_var.datalen; j++) {
39604                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
39605                 *ret_conv_9_copy = ret_var.data[j];
39606                 uint64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
39607                 ret_arr_ptr[j] = ret_conv_9_ref;
39608         }
39609         
39610         FREE(ret_var.data);
39611         return ret_arr;
39612 }
39613
39614 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_read"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_read(int8_tArray ser, uint64_t arg_a, uint64_t arg_b) {
39615         LDKu8slice ser_ref;
39616         ser_ref.datalen = ser->arr_len;
39617         ser_ref.data = ser->elems;
39618         void* arg_a_ptr = untag_ptr(arg_a);
39619         if (ptr_is_owned(arg_a)) { CHECK_ACCESS(arg_a_ptr); }
39620         LDKEntropySource* arg_a_conv = (LDKEntropySource*)arg_a_ptr;
39621         void* arg_b_ptr = untag_ptr(arg_b);
39622         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
39623         LDKSignerProvider* arg_b_conv = (LDKSignerProvider*)arg_b_ptr;
39624         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
39625         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_read(ser_ref, arg_a_conv, arg_b_conv);
39626         FREE(ser);
39627         return tag_ptr(ret_conv, true);
39628 }
39629
39630 void  __attribute__((export_name("TS_OutPoint_free"))) TS_OutPoint_free(uint64_t this_obj) {
39631         LDKOutPoint this_obj_conv;
39632         this_obj_conv.inner = untag_ptr(this_obj);
39633         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39635         OutPoint_free(this_obj_conv);
39636 }
39637
39638 int8_tArray  __attribute__((export_name("TS_OutPoint_get_txid"))) TS_OutPoint_get_txid(uint64_t this_ptr) {
39639         LDKOutPoint this_ptr_conv;
39640         this_ptr_conv.inner = untag_ptr(this_ptr);
39641         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39643         this_ptr_conv.is_owned = false;
39644         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39645         memcpy(ret_arr->elems, *OutPoint_get_txid(&this_ptr_conv), 32);
39646         return ret_arr;
39647 }
39648
39649 void  __attribute__((export_name("TS_OutPoint_set_txid"))) TS_OutPoint_set_txid(uint64_t this_ptr, int8_tArray val) {
39650         LDKOutPoint this_ptr_conv;
39651         this_ptr_conv.inner = untag_ptr(this_ptr);
39652         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39654         this_ptr_conv.is_owned = false;
39655         LDKThirtyTwoBytes val_ref;
39656         CHECK(val->arr_len == 32);
39657         memcpy(val_ref.data, val->elems, 32); FREE(val);
39658         OutPoint_set_txid(&this_ptr_conv, val_ref);
39659 }
39660
39661 int16_t  __attribute__((export_name("TS_OutPoint_get_index"))) TS_OutPoint_get_index(uint64_t this_ptr) {
39662         LDKOutPoint this_ptr_conv;
39663         this_ptr_conv.inner = untag_ptr(this_ptr);
39664         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39666         this_ptr_conv.is_owned = false;
39667         int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
39668         return ret_conv;
39669 }
39670
39671 void  __attribute__((export_name("TS_OutPoint_set_index"))) TS_OutPoint_set_index(uint64_t this_ptr, int16_t val) {
39672         LDKOutPoint this_ptr_conv;
39673         this_ptr_conv.inner = untag_ptr(this_ptr);
39674         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39676         this_ptr_conv.is_owned = false;
39677         OutPoint_set_index(&this_ptr_conv, val);
39678 }
39679
39680 uint64_t  __attribute__((export_name("TS_OutPoint_new"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
39681         LDKThirtyTwoBytes txid_arg_ref;
39682         CHECK(txid_arg->arr_len == 32);
39683         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
39684         LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
39685         uint64_t ret_ref = 0;
39686         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39687         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39688         return ret_ref;
39689 }
39690
39691 static inline uint64_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
39692         LDKOutPoint ret_var = OutPoint_clone(arg);
39693         uint64_t ret_ref = 0;
39694         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39695         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39696         return ret_ref;
39697 }
39698 int64_t  __attribute__((export_name("TS_OutPoint_clone_ptr"))) TS_OutPoint_clone_ptr(uint64_t arg) {
39699         LDKOutPoint arg_conv;
39700         arg_conv.inner = untag_ptr(arg);
39701         arg_conv.is_owned = ptr_is_owned(arg);
39702         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39703         arg_conv.is_owned = false;
39704         int64_t ret_conv = OutPoint_clone_ptr(&arg_conv);
39705         return ret_conv;
39706 }
39707
39708 uint64_t  __attribute__((export_name("TS_OutPoint_clone"))) TS_OutPoint_clone(uint64_t orig) {
39709         LDKOutPoint orig_conv;
39710         orig_conv.inner = untag_ptr(orig);
39711         orig_conv.is_owned = ptr_is_owned(orig);
39712         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39713         orig_conv.is_owned = false;
39714         LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
39715         uint64_t ret_ref = 0;
39716         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39717         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39718         return ret_ref;
39719 }
39720
39721 jboolean  __attribute__((export_name("TS_OutPoint_eq"))) TS_OutPoint_eq(uint64_t a, uint64_t b) {
39722         LDKOutPoint a_conv;
39723         a_conv.inner = untag_ptr(a);
39724         a_conv.is_owned = ptr_is_owned(a);
39725         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39726         a_conv.is_owned = false;
39727         LDKOutPoint b_conv;
39728         b_conv.inner = untag_ptr(b);
39729         b_conv.is_owned = ptr_is_owned(b);
39730         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39731         b_conv.is_owned = false;
39732         jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
39733         return ret_conv;
39734 }
39735
39736 int64_t  __attribute__((export_name("TS_OutPoint_hash"))) TS_OutPoint_hash(uint64_t o) {
39737         LDKOutPoint o_conv;
39738         o_conv.inner = untag_ptr(o);
39739         o_conv.is_owned = ptr_is_owned(o);
39740         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39741         o_conv.is_owned = false;
39742         int64_t ret_conv = OutPoint_hash(&o_conv);
39743         return ret_conv;
39744 }
39745
39746 int8_tArray  __attribute__((export_name("TS_OutPoint_write"))) TS_OutPoint_write(uint64_t obj) {
39747         LDKOutPoint obj_conv;
39748         obj_conv.inner = untag_ptr(obj);
39749         obj_conv.is_owned = ptr_is_owned(obj);
39750         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39751         obj_conv.is_owned = false;
39752         LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
39753         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39754         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39755         CVec_u8Z_free(ret_var);
39756         return ret_arr;
39757 }
39758
39759 uint64_t  __attribute__((export_name("TS_OutPoint_read"))) TS_OutPoint_read(int8_tArray ser) {
39760         LDKu8slice ser_ref;
39761         ser_ref.datalen = ser->arr_len;
39762         ser_ref.data = ser->elems;
39763         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
39764         *ret_conv = OutPoint_read(ser_ref);
39765         FREE(ser);
39766         return tag_ptr(ret_conv, true);
39767 }
39768
39769 void  __attribute__((export_name("TS_InboundHTLCErr_free"))) TS_InboundHTLCErr_free(uint64_t this_obj) {
39770         LDKInboundHTLCErr this_obj_conv;
39771         this_obj_conv.inner = untag_ptr(this_obj);
39772         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39774         InboundHTLCErr_free(this_obj_conv);
39775 }
39776
39777 int16_t  __attribute__((export_name("TS_InboundHTLCErr_get_err_code"))) TS_InboundHTLCErr_get_err_code(uint64_t this_ptr) {
39778         LDKInboundHTLCErr this_ptr_conv;
39779         this_ptr_conv.inner = untag_ptr(this_ptr);
39780         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39782         this_ptr_conv.is_owned = false;
39783         int16_t ret_conv = InboundHTLCErr_get_err_code(&this_ptr_conv);
39784         return ret_conv;
39785 }
39786
39787 void  __attribute__((export_name("TS_InboundHTLCErr_set_err_code"))) TS_InboundHTLCErr_set_err_code(uint64_t this_ptr, int16_t val) {
39788         LDKInboundHTLCErr this_ptr_conv;
39789         this_ptr_conv.inner = untag_ptr(this_ptr);
39790         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39792         this_ptr_conv.is_owned = false;
39793         InboundHTLCErr_set_err_code(&this_ptr_conv, val);
39794 }
39795
39796 int8_tArray  __attribute__((export_name("TS_InboundHTLCErr_get_err_data"))) TS_InboundHTLCErr_get_err_data(uint64_t this_ptr) {
39797         LDKInboundHTLCErr this_ptr_conv;
39798         this_ptr_conv.inner = untag_ptr(this_ptr);
39799         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39801         this_ptr_conv.is_owned = false;
39802         LDKCVec_u8Z ret_var = InboundHTLCErr_get_err_data(&this_ptr_conv);
39803         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39804         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39805         CVec_u8Z_free(ret_var);
39806         return ret_arr;
39807 }
39808
39809 void  __attribute__((export_name("TS_InboundHTLCErr_set_err_data"))) TS_InboundHTLCErr_set_err_data(uint64_t this_ptr, int8_tArray val) {
39810         LDKInboundHTLCErr this_ptr_conv;
39811         this_ptr_conv.inner = untag_ptr(this_ptr);
39812         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39814         this_ptr_conv.is_owned = false;
39815         LDKCVec_u8Z val_ref;
39816         val_ref.datalen = val->arr_len;
39817         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
39818         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
39819         InboundHTLCErr_set_err_data(&this_ptr_conv, val_ref);
39820 }
39821
39822 jstring  __attribute__((export_name("TS_InboundHTLCErr_get_msg"))) TS_InboundHTLCErr_get_msg(uint64_t this_ptr) {
39823         LDKInboundHTLCErr this_ptr_conv;
39824         this_ptr_conv.inner = untag_ptr(this_ptr);
39825         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39827         this_ptr_conv.is_owned = false;
39828         LDKStr ret_str = InboundHTLCErr_get_msg(&this_ptr_conv);
39829         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
39830         Str_free(ret_str);
39831         return ret_conv;
39832 }
39833
39834 void  __attribute__((export_name("TS_InboundHTLCErr_set_msg"))) TS_InboundHTLCErr_set_msg(uint64_t this_ptr, jstring val) {
39835         LDKInboundHTLCErr this_ptr_conv;
39836         this_ptr_conv.inner = untag_ptr(this_ptr);
39837         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39839         this_ptr_conv.is_owned = false;
39840         LDKStr val_conv = str_ref_to_owned_c(val);
39841         InboundHTLCErr_set_msg(&this_ptr_conv, val_conv);
39842 }
39843
39844 uint64_t  __attribute__((export_name("TS_InboundHTLCErr_new"))) TS_InboundHTLCErr_new(int16_t err_code_arg, int8_tArray err_data_arg, jstring msg_arg) {
39845         LDKCVec_u8Z err_data_arg_ref;
39846         err_data_arg_ref.datalen = err_data_arg->arr_len;
39847         err_data_arg_ref.data = MALLOC(err_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
39848         memcpy(err_data_arg_ref.data, err_data_arg->elems, err_data_arg_ref.datalen); FREE(err_data_arg);
39849         LDKStr msg_arg_conv = str_ref_to_owned_c(msg_arg);
39850         LDKInboundHTLCErr ret_var = InboundHTLCErr_new(err_code_arg, err_data_arg_ref, msg_arg_conv);
39851         uint64_t ret_ref = 0;
39852         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39853         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39854         return ret_ref;
39855 }
39856
39857 static inline uint64_t InboundHTLCErr_clone_ptr(LDKInboundHTLCErr *NONNULL_PTR arg) {
39858         LDKInboundHTLCErr ret_var = InboundHTLCErr_clone(arg);
39859         uint64_t ret_ref = 0;
39860         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39861         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39862         return ret_ref;
39863 }
39864 int64_t  __attribute__((export_name("TS_InboundHTLCErr_clone_ptr"))) TS_InboundHTLCErr_clone_ptr(uint64_t arg) {
39865         LDKInboundHTLCErr arg_conv;
39866         arg_conv.inner = untag_ptr(arg);
39867         arg_conv.is_owned = ptr_is_owned(arg);
39868         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39869         arg_conv.is_owned = false;
39870         int64_t ret_conv = InboundHTLCErr_clone_ptr(&arg_conv);
39871         return ret_conv;
39872 }
39873
39874 uint64_t  __attribute__((export_name("TS_InboundHTLCErr_clone"))) TS_InboundHTLCErr_clone(uint64_t orig) {
39875         LDKInboundHTLCErr orig_conv;
39876         orig_conv.inner = untag_ptr(orig);
39877         orig_conv.is_owned = ptr_is_owned(orig);
39878         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39879         orig_conv.is_owned = false;
39880         LDKInboundHTLCErr ret_var = InboundHTLCErr_clone(&orig_conv);
39881         uint64_t ret_ref = 0;
39882         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39883         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39884         return ret_ref;
39885 }
39886
39887 int64_t  __attribute__((export_name("TS_InboundHTLCErr_hash"))) TS_InboundHTLCErr_hash(uint64_t o) {
39888         LDKInboundHTLCErr o_conv;
39889         o_conv.inner = untag_ptr(o);
39890         o_conv.is_owned = ptr_is_owned(o);
39891         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39892         o_conv.is_owned = false;
39893         int64_t ret_conv = InboundHTLCErr_hash(&o_conv);
39894         return ret_conv;
39895 }
39896
39897 jboolean  __attribute__((export_name("TS_InboundHTLCErr_eq"))) TS_InboundHTLCErr_eq(uint64_t a, uint64_t b) {
39898         LDKInboundHTLCErr a_conv;
39899         a_conv.inner = untag_ptr(a);
39900         a_conv.is_owned = ptr_is_owned(a);
39901         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39902         a_conv.is_owned = false;
39903         LDKInboundHTLCErr b_conv;
39904         b_conv.inner = untag_ptr(b);
39905         b_conv.is_owned = ptr_is_owned(b);
39906         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39907         b_conv.is_owned = false;
39908         jboolean ret_conv = InboundHTLCErr_eq(&a_conv, &b_conv);
39909         return ret_conv;
39910 }
39911
39912 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) {
39913         LDKUpdateAddHTLC msg_conv;
39914         msg_conv.inner = untag_ptr(msg);
39915         msg_conv.is_owned = ptr_is_owned(msg);
39916         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
39917         msg_conv.is_owned = false;
39918         void* node_signer_ptr = untag_ptr(node_signer);
39919         if (ptr_is_owned(node_signer)) { CHECK_ACCESS(node_signer_ptr); }
39920         LDKNodeSigner* node_signer_conv = (LDKNodeSigner*)node_signer_ptr;
39921         void* logger_ptr = untag_ptr(logger);
39922         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
39923         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
39924         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
39925         *ret_conv = peel_payment_onion(&msg_conv, node_signer_conv, logger_conv, cur_height, accept_mpp_keysend, allow_skimmed_fees);
39926         return tag_ptr(ret_conv, true);
39927 }
39928
39929 void  __attribute__((export_name("TS_PendingHTLCRouting_free"))) TS_PendingHTLCRouting_free(uint64_t this_ptr) {
39930         if (!ptr_is_owned(this_ptr)) return;
39931         void* this_ptr_ptr = untag_ptr(this_ptr);
39932         CHECK_ACCESS(this_ptr_ptr);
39933         LDKPendingHTLCRouting this_ptr_conv = *(LDKPendingHTLCRouting*)(this_ptr_ptr);
39934         FREE(untag_ptr(this_ptr));
39935         PendingHTLCRouting_free(this_ptr_conv);
39936 }
39937
39938 static inline uint64_t PendingHTLCRouting_clone_ptr(LDKPendingHTLCRouting *NONNULL_PTR arg) {
39939         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
39940         *ret_copy = PendingHTLCRouting_clone(arg);
39941         uint64_t ret_ref = tag_ptr(ret_copy, true);
39942         return ret_ref;
39943 }
39944 int64_t  __attribute__((export_name("TS_PendingHTLCRouting_clone_ptr"))) TS_PendingHTLCRouting_clone_ptr(uint64_t arg) {
39945         LDKPendingHTLCRouting* arg_conv = (LDKPendingHTLCRouting*)untag_ptr(arg);
39946         int64_t ret_conv = PendingHTLCRouting_clone_ptr(arg_conv);
39947         return ret_conv;
39948 }
39949
39950 uint64_t  __attribute__((export_name("TS_PendingHTLCRouting_clone"))) TS_PendingHTLCRouting_clone(uint64_t orig) {
39951         LDKPendingHTLCRouting* orig_conv = (LDKPendingHTLCRouting*)untag_ptr(orig);
39952         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
39953         *ret_copy = PendingHTLCRouting_clone(orig_conv);
39954         uint64_t ret_ref = tag_ptr(ret_copy, true);
39955         return ret_ref;
39956 }
39957
39958 uint64_t  __attribute__((export_name("TS_PendingHTLCRouting_forward"))) TS_PendingHTLCRouting_forward(uint64_t onion_packet, int64_t short_channel_id, uint64_t blinded) {
39959         LDKOnionPacket onion_packet_conv;
39960         onion_packet_conv.inner = untag_ptr(onion_packet);
39961         onion_packet_conv.is_owned = ptr_is_owned(onion_packet);
39962         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_packet_conv);
39963         onion_packet_conv = OnionPacket_clone(&onion_packet_conv);
39964         LDKBlindedForward blinded_conv;
39965         blinded_conv.inner = untag_ptr(blinded);
39966         blinded_conv.is_owned = ptr_is_owned(blinded);
39967         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_conv);
39968         blinded_conv = BlindedForward_clone(&blinded_conv);
39969         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
39970         *ret_copy = PendingHTLCRouting_forward(onion_packet_conv, short_channel_id, blinded_conv);
39971         uint64_t ret_ref = tag_ptr(ret_copy, true);
39972         return ret_ref;
39973 }
39974
39975 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) {
39976         LDKFinalOnionHopData payment_data_conv;
39977         payment_data_conv.inner = untag_ptr(payment_data);
39978         payment_data_conv.is_owned = ptr_is_owned(payment_data);
39979         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_conv);
39980         payment_data_conv = FinalOnionHopData_clone(&payment_data_conv);
39981         void* payment_metadata_ptr = untag_ptr(payment_metadata);
39982         CHECK_ACCESS(payment_metadata_ptr);
39983         LDKCOption_CVec_u8ZZ payment_metadata_conv = *(LDKCOption_CVec_u8ZZ*)(payment_metadata_ptr);
39984         payment_metadata_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(payment_metadata));
39985         void* payment_context_ptr = untag_ptr(payment_context);
39986         CHECK_ACCESS(payment_context_ptr);
39987         LDKCOption_PaymentContextZ payment_context_conv = *(LDKCOption_PaymentContextZ*)(payment_context_ptr);
39988         payment_context_conv = COption_PaymentContextZ_clone((LDKCOption_PaymentContextZ*)untag_ptr(payment_context));
39989         LDKThirtyTwoBytes phantom_shared_secret_ref;
39990         CHECK(phantom_shared_secret->arr_len == 32);
39991         memcpy(phantom_shared_secret_ref.data, phantom_shared_secret->elems, 32); FREE(phantom_shared_secret);
39992         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_constr;
39993         custom_tlvs_constr.datalen = custom_tlvs->arr_len;
39994         if (custom_tlvs_constr.datalen > 0)
39995                 custom_tlvs_constr.data = MALLOC(custom_tlvs_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
39996         else
39997                 custom_tlvs_constr.data = NULL;
39998         uint64_t* custom_tlvs_vals = custom_tlvs->elems;
39999         for (size_t x = 0; x < custom_tlvs_constr.datalen; x++) {
40000                 uint64_t custom_tlvs_conv_23 = custom_tlvs_vals[x];
40001                 void* custom_tlvs_conv_23_ptr = untag_ptr(custom_tlvs_conv_23);
40002                 CHECK_ACCESS(custom_tlvs_conv_23_ptr);
40003                 LDKC2Tuple_u64CVec_u8ZZ custom_tlvs_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(custom_tlvs_conv_23_ptr);
40004                 custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone((LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(custom_tlvs_conv_23));
40005                 custom_tlvs_constr.data[x] = custom_tlvs_conv_23_conv;
40006         }
40007         FREE(custom_tlvs);
40008         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
40009         *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);
40010         uint64_t ret_ref = tag_ptr(ret_copy, true);
40011         return ret_ref;
40012 }
40013
40014 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) {
40015         LDKFinalOnionHopData payment_data_conv;
40016         payment_data_conv.inner = untag_ptr(payment_data);
40017         payment_data_conv.is_owned = ptr_is_owned(payment_data);
40018         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_conv);
40019         payment_data_conv = FinalOnionHopData_clone(&payment_data_conv);
40020         LDKThirtyTwoBytes payment_preimage_ref;
40021         CHECK(payment_preimage->arr_len == 32);
40022         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
40023         void* payment_metadata_ptr = untag_ptr(payment_metadata);
40024         CHECK_ACCESS(payment_metadata_ptr);
40025         LDKCOption_CVec_u8ZZ payment_metadata_conv = *(LDKCOption_CVec_u8ZZ*)(payment_metadata_ptr);
40026         payment_metadata_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(payment_metadata));
40027         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_constr;
40028         custom_tlvs_constr.datalen = custom_tlvs->arr_len;
40029         if (custom_tlvs_constr.datalen > 0)
40030                 custom_tlvs_constr.data = MALLOC(custom_tlvs_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
40031         else
40032                 custom_tlvs_constr.data = NULL;
40033         uint64_t* custom_tlvs_vals = custom_tlvs->elems;
40034         for (size_t x = 0; x < custom_tlvs_constr.datalen; x++) {
40035                 uint64_t custom_tlvs_conv_23 = custom_tlvs_vals[x];
40036                 void* custom_tlvs_conv_23_ptr = untag_ptr(custom_tlvs_conv_23);
40037                 CHECK_ACCESS(custom_tlvs_conv_23_ptr);
40038                 LDKC2Tuple_u64CVec_u8ZZ custom_tlvs_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(custom_tlvs_conv_23_ptr);
40039                 custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone((LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(custom_tlvs_conv_23));
40040                 custom_tlvs_constr.data[x] = custom_tlvs_conv_23_conv;
40041         }
40042         FREE(custom_tlvs);
40043         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
40044         *ret_copy = PendingHTLCRouting_receive_keysend(payment_data_conv, payment_preimage_ref, payment_metadata_conv, incoming_cltv_expiry, custom_tlvs_constr, requires_blinded_error);
40045         uint64_t ret_ref = tag_ptr(ret_copy, true);
40046         return ret_ref;
40047 }
40048
40049 void  __attribute__((export_name("TS_BlindedForward_free"))) TS_BlindedForward_free(uint64_t this_obj) {
40050         LDKBlindedForward this_obj_conv;
40051         this_obj_conv.inner = untag_ptr(this_obj);
40052         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40054         BlindedForward_free(this_obj_conv);
40055 }
40056
40057 int8_tArray  __attribute__((export_name("TS_BlindedForward_get_inbound_blinding_point"))) TS_BlindedForward_get_inbound_blinding_point(uint64_t this_ptr) {
40058         LDKBlindedForward this_ptr_conv;
40059         this_ptr_conv.inner = untag_ptr(this_ptr);
40060         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40062         this_ptr_conv.is_owned = false;
40063         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40064         memcpy(ret_arr->elems, BlindedForward_get_inbound_blinding_point(&this_ptr_conv).compressed_form, 33);
40065         return ret_arr;
40066 }
40067
40068 void  __attribute__((export_name("TS_BlindedForward_set_inbound_blinding_point"))) TS_BlindedForward_set_inbound_blinding_point(uint64_t this_ptr, int8_tArray val) {
40069         LDKBlindedForward this_ptr_conv;
40070         this_ptr_conv.inner = untag_ptr(this_ptr);
40071         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40073         this_ptr_conv.is_owned = false;
40074         LDKPublicKey val_ref;
40075         CHECK(val->arr_len == 33);
40076         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
40077         BlindedForward_set_inbound_blinding_point(&this_ptr_conv, val_ref);
40078 }
40079
40080 uint32_t  __attribute__((export_name("TS_BlindedForward_get_failure"))) TS_BlindedForward_get_failure(uint64_t this_ptr) {
40081         LDKBlindedForward this_ptr_conv;
40082         this_ptr_conv.inner = untag_ptr(this_ptr);
40083         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40085         this_ptr_conv.is_owned = false;
40086         uint32_t ret_conv = LDKBlindedFailure_to_js(BlindedForward_get_failure(&this_ptr_conv));
40087         return ret_conv;
40088 }
40089
40090 void  __attribute__((export_name("TS_BlindedForward_set_failure"))) TS_BlindedForward_set_failure(uint64_t this_ptr, uint32_t val) {
40091         LDKBlindedForward this_ptr_conv;
40092         this_ptr_conv.inner = untag_ptr(this_ptr);
40093         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40095         this_ptr_conv.is_owned = false;
40096         LDKBlindedFailure val_conv = LDKBlindedFailure_from_js(val);
40097         BlindedForward_set_failure(&this_ptr_conv, val_conv);
40098 }
40099
40100 uint64_t  __attribute__((export_name("TS_BlindedForward_new"))) TS_BlindedForward_new(int8_tArray inbound_blinding_point_arg, uint32_t failure_arg) {
40101         LDKPublicKey inbound_blinding_point_arg_ref;
40102         CHECK(inbound_blinding_point_arg->arr_len == 33);
40103         memcpy(inbound_blinding_point_arg_ref.compressed_form, inbound_blinding_point_arg->elems, 33); FREE(inbound_blinding_point_arg);
40104         LDKBlindedFailure failure_arg_conv = LDKBlindedFailure_from_js(failure_arg);
40105         LDKBlindedForward ret_var = BlindedForward_new(inbound_blinding_point_arg_ref, failure_arg_conv);
40106         uint64_t ret_ref = 0;
40107         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40108         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40109         return ret_ref;
40110 }
40111
40112 static inline uint64_t BlindedForward_clone_ptr(LDKBlindedForward *NONNULL_PTR arg) {
40113         LDKBlindedForward ret_var = BlindedForward_clone(arg);
40114         uint64_t ret_ref = 0;
40115         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40116         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40117         return ret_ref;
40118 }
40119 int64_t  __attribute__((export_name("TS_BlindedForward_clone_ptr"))) TS_BlindedForward_clone_ptr(uint64_t arg) {
40120         LDKBlindedForward arg_conv;
40121         arg_conv.inner = untag_ptr(arg);
40122         arg_conv.is_owned = ptr_is_owned(arg);
40123         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40124         arg_conv.is_owned = false;
40125         int64_t ret_conv = BlindedForward_clone_ptr(&arg_conv);
40126         return ret_conv;
40127 }
40128
40129 uint64_t  __attribute__((export_name("TS_BlindedForward_clone"))) TS_BlindedForward_clone(uint64_t orig) {
40130         LDKBlindedForward orig_conv;
40131         orig_conv.inner = untag_ptr(orig);
40132         orig_conv.is_owned = ptr_is_owned(orig);
40133         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40134         orig_conv.is_owned = false;
40135         LDKBlindedForward ret_var = BlindedForward_clone(&orig_conv);
40136         uint64_t ret_ref = 0;
40137         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40138         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40139         return ret_ref;
40140 }
40141
40142 int64_t  __attribute__((export_name("TS_BlindedForward_hash"))) TS_BlindedForward_hash(uint64_t o) {
40143         LDKBlindedForward o_conv;
40144         o_conv.inner = untag_ptr(o);
40145         o_conv.is_owned = ptr_is_owned(o);
40146         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40147         o_conv.is_owned = false;
40148         int64_t ret_conv = BlindedForward_hash(&o_conv);
40149         return ret_conv;
40150 }
40151
40152 jboolean  __attribute__((export_name("TS_BlindedForward_eq"))) TS_BlindedForward_eq(uint64_t a, uint64_t b) {
40153         LDKBlindedForward a_conv;
40154         a_conv.inner = untag_ptr(a);
40155         a_conv.is_owned = ptr_is_owned(a);
40156         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40157         a_conv.is_owned = false;
40158         LDKBlindedForward b_conv;
40159         b_conv.inner = untag_ptr(b);
40160         b_conv.is_owned = ptr_is_owned(b);
40161         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40162         b_conv.is_owned = false;
40163         jboolean ret_conv = BlindedForward_eq(&a_conv, &b_conv);
40164         return ret_conv;
40165 }
40166
40167 void  __attribute__((export_name("TS_PendingHTLCInfo_free"))) TS_PendingHTLCInfo_free(uint64_t this_obj) {
40168         LDKPendingHTLCInfo this_obj_conv;
40169         this_obj_conv.inner = untag_ptr(this_obj);
40170         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40172         PendingHTLCInfo_free(this_obj_conv);
40173 }
40174
40175 uint64_t  __attribute__((export_name("TS_PendingHTLCInfo_get_routing"))) TS_PendingHTLCInfo_get_routing(uint64_t this_ptr) {
40176         LDKPendingHTLCInfo this_ptr_conv;
40177         this_ptr_conv.inner = untag_ptr(this_ptr);
40178         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40180         this_ptr_conv.is_owned = false;
40181         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
40182         *ret_copy = PendingHTLCInfo_get_routing(&this_ptr_conv);
40183         uint64_t ret_ref = tag_ptr(ret_copy, true);
40184         return ret_ref;
40185 }
40186
40187 void  __attribute__((export_name("TS_PendingHTLCInfo_set_routing"))) TS_PendingHTLCInfo_set_routing(uint64_t this_ptr, uint64_t val) {
40188         LDKPendingHTLCInfo this_ptr_conv;
40189         this_ptr_conv.inner = untag_ptr(this_ptr);
40190         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40192         this_ptr_conv.is_owned = false;
40193         void* val_ptr = untag_ptr(val);
40194         CHECK_ACCESS(val_ptr);
40195         LDKPendingHTLCRouting val_conv = *(LDKPendingHTLCRouting*)(val_ptr);
40196         val_conv = PendingHTLCRouting_clone((LDKPendingHTLCRouting*)untag_ptr(val));
40197         PendingHTLCInfo_set_routing(&this_ptr_conv, val_conv);
40198 }
40199
40200 int8_tArray  __attribute__((export_name("TS_PendingHTLCInfo_get_incoming_shared_secret"))) TS_PendingHTLCInfo_get_incoming_shared_secret(uint64_t this_ptr) {
40201         LDKPendingHTLCInfo this_ptr_conv;
40202         this_ptr_conv.inner = untag_ptr(this_ptr);
40203         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40205         this_ptr_conv.is_owned = false;
40206         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40207         memcpy(ret_arr->elems, *PendingHTLCInfo_get_incoming_shared_secret(&this_ptr_conv), 32);
40208         return ret_arr;
40209 }
40210
40211 void  __attribute__((export_name("TS_PendingHTLCInfo_set_incoming_shared_secret"))) TS_PendingHTLCInfo_set_incoming_shared_secret(uint64_t this_ptr, int8_tArray val) {
40212         LDKPendingHTLCInfo this_ptr_conv;
40213         this_ptr_conv.inner = untag_ptr(this_ptr);
40214         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40216         this_ptr_conv.is_owned = false;
40217         LDKThirtyTwoBytes val_ref;
40218         CHECK(val->arr_len == 32);
40219         memcpy(val_ref.data, val->elems, 32); FREE(val);
40220         PendingHTLCInfo_set_incoming_shared_secret(&this_ptr_conv, val_ref);
40221 }
40222
40223 int8_tArray  __attribute__((export_name("TS_PendingHTLCInfo_get_payment_hash"))) TS_PendingHTLCInfo_get_payment_hash(uint64_t this_ptr) {
40224         LDKPendingHTLCInfo this_ptr_conv;
40225         this_ptr_conv.inner = untag_ptr(this_ptr);
40226         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40228         this_ptr_conv.is_owned = false;
40229         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40230         memcpy(ret_arr->elems, *PendingHTLCInfo_get_payment_hash(&this_ptr_conv), 32);
40231         return ret_arr;
40232 }
40233
40234 void  __attribute__((export_name("TS_PendingHTLCInfo_set_payment_hash"))) TS_PendingHTLCInfo_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
40235         LDKPendingHTLCInfo this_ptr_conv;
40236         this_ptr_conv.inner = untag_ptr(this_ptr);
40237         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40239         this_ptr_conv.is_owned = false;
40240         LDKThirtyTwoBytes val_ref;
40241         CHECK(val->arr_len == 32);
40242         memcpy(val_ref.data, val->elems, 32); FREE(val);
40243         PendingHTLCInfo_set_payment_hash(&this_ptr_conv, val_ref);
40244 }
40245
40246 uint64_t  __attribute__((export_name("TS_PendingHTLCInfo_get_incoming_amt_msat"))) TS_PendingHTLCInfo_get_incoming_amt_msat(uint64_t this_ptr) {
40247         LDKPendingHTLCInfo this_ptr_conv;
40248         this_ptr_conv.inner = untag_ptr(this_ptr);
40249         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40251         this_ptr_conv.is_owned = false;
40252         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
40253         *ret_copy = PendingHTLCInfo_get_incoming_amt_msat(&this_ptr_conv);
40254         uint64_t ret_ref = tag_ptr(ret_copy, true);
40255         return ret_ref;
40256 }
40257
40258 void  __attribute__((export_name("TS_PendingHTLCInfo_set_incoming_amt_msat"))) TS_PendingHTLCInfo_set_incoming_amt_msat(uint64_t this_ptr, uint64_t val) {
40259         LDKPendingHTLCInfo this_ptr_conv;
40260         this_ptr_conv.inner = untag_ptr(this_ptr);
40261         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40263         this_ptr_conv.is_owned = false;
40264         void* val_ptr = untag_ptr(val);
40265         CHECK_ACCESS(val_ptr);
40266         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
40267         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
40268         PendingHTLCInfo_set_incoming_amt_msat(&this_ptr_conv, val_conv);
40269 }
40270
40271 int64_t  __attribute__((export_name("TS_PendingHTLCInfo_get_outgoing_amt_msat"))) TS_PendingHTLCInfo_get_outgoing_amt_msat(uint64_t this_ptr) {
40272         LDKPendingHTLCInfo this_ptr_conv;
40273         this_ptr_conv.inner = untag_ptr(this_ptr);
40274         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40276         this_ptr_conv.is_owned = false;
40277         int64_t ret_conv = PendingHTLCInfo_get_outgoing_amt_msat(&this_ptr_conv);
40278         return ret_conv;
40279 }
40280
40281 void  __attribute__((export_name("TS_PendingHTLCInfo_set_outgoing_amt_msat"))) TS_PendingHTLCInfo_set_outgoing_amt_msat(uint64_t this_ptr, int64_t val) {
40282         LDKPendingHTLCInfo this_ptr_conv;
40283         this_ptr_conv.inner = untag_ptr(this_ptr);
40284         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40286         this_ptr_conv.is_owned = false;
40287         PendingHTLCInfo_set_outgoing_amt_msat(&this_ptr_conv, val);
40288 }
40289
40290 int32_t  __attribute__((export_name("TS_PendingHTLCInfo_get_outgoing_cltv_value"))) TS_PendingHTLCInfo_get_outgoing_cltv_value(uint64_t this_ptr) {
40291         LDKPendingHTLCInfo this_ptr_conv;
40292         this_ptr_conv.inner = untag_ptr(this_ptr);
40293         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40295         this_ptr_conv.is_owned = false;
40296         int32_t ret_conv = PendingHTLCInfo_get_outgoing_cltv_value(&this_ptr_conv);
40297         return ret_conv;
40298 }
40299
40300 void  __attribute__((export_name("TS_PendingHTLCInfo_set_outgoing_cltv_value"))) TS_PendingHTLCInfo_set_outgoing_cltv_value(uint64_t this_ptr, int32_t val) {
40301         LDKPendingHTLCInfo this_ptr_conv;
40302         this_ptr_conv.inner = untag_ptr(this_ptr);
40303         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40305         this_ptr_conv.is_owned = false;
40306         PendingHTLCInfo_set_outgoing_cltv_value(&this_ptr_conv, val);
40307 }
40308
40309 uint64_t  __attribute__((export_name("TS_PendingHTLCInfo_get_skimmed_fee_msat"))) TS_PendingHTLCInfo_get_skimmed_fee_msat(uint64_t this_ptr) {
40310         LDKPendingHTLCInfo this_ptr_conv;
40311         this_ptr_conv.inner = untag_ptr(this_ptr);
40312         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40314         this_ptr_conv.is_owned = false;
40315         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
40316         *ret_copy = PendingHTLCInfo_get_skimmed_fee_msat(&this_ptr_conv);
40317         uint64_t ret_ref = tag_ptr(ret_copy, true);
40318         return ret_ref;
40319 }
40320
40321 void  __attribute__((export_name("TS_PendingHTLCInfo_set_skimmed_fee_msat"))) TS_PendingHTLCInfo_set_skimmed_fee_msat(uint64_t this_ptr, uint64_t val) {
40322         LDKPendingHTLCInfo this_ptr_conv;
40323         this_ptr_conv.inner = untag_ptr(this_ptr);
40324         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40326         this_ptr_conv.is_owned = false;
40327         void* val_ptr = untag_ptr(val);
40328         CHECK_ACCESS(val_ptr);
40329         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
40330         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
40331         PendingHTLCInfo_set_skimmed_fee_msat(&this_ptr_conv, val_conv);
40332 }
40333
40334 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) {
40335         void* routing_arg_ptr = untag_ptr(routing_arg);
40336         CHECK_ACCESS(routing_arg_ptr);
40337         LDKPendingHTLCRouting routing_arg_conv = *(LDKPendingHTLCRouting*)(routing_arg_ptr);
40338         routing_arg_conv = PendingHTLCRouting_clone((LDKPendingHTLCRouting*)untag_ptr(routing_arg));
40339         LDKThirtyTwoBytes incoming_shared_secret_arg_ref;
40340         CHECK(incoming_shared_secret_arg->arr_len == 32);
40341         memcpy(incoming_shared_secret_arg_ref.data, incoming_shared_secret_arg->elems, 32); FREE(incoming_shared_secret_arg);
40342         LDKThirtyTwoBytes payment_hash_arg_ref;
40343         CHECK(payment_hash_arg->arr_len == 32);
40344         memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
40345         void* incoming_amt_msat_arg_ptr = untag_ptr(incoming_amt_msat_arg);
40346         CHECK_ACCESS(incoming_amt_msat_arg_ptr);
40347         LDKCOption_u64Z incoming_amt_msat_arg_conv = *(LDKCOption_u64Z*)(incoming_amt_msat_arg_ptr);
40348         incoming_amt_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(incoming_amt_msat_arg));
40349         void* skimmed_fee_msat_arg_ptr = untag_ptr(skimmed_fee_msat_arg);
40350         CHECK_ACCESS(skimmed_fee_msat_arg_ptr);
40351         LDKCOption_u64Z skimmed_fee_msat_arg_conv = *(LDKCOption_u64Z*)(skimmed_fee_msat_arg_ptr);
40352         skimmed_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(skimmed_fee_msat_arg));
40353         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);
40354         uint64_t ret_ref = 0;
40355         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40356         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40357         return ret_ref;
40358 }
40359
40360 static inline uint64_t PendingHTLCInfo_clone_ptr(LDKPendingHTLCInfo *NONNULL_PTR arg) {
40361         LDKPendingHTLCInfo ret_var = PendingHTLCInfo_clone(arg);
40362         uint64_t ret_ref = 0;
40363         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40364         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40365         return ret_ref;
40366 }
40367 int64_t  __attribute__((export_name("TS_PendingHTLCInfo_clone_ptr"))) TS_PendingHTLCInfo_clone_ptr(uint64_t arg) {
40368         LDKPendingHTLCInfo arg_conv;
40369         arg_conv.inner = untag_ptr(arg);
40370         arg_conv.is_owned = ptr_is_owned(arg);
40371         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40372         arg_conv.is_owned = false;
40373         int64_t ret_conv = PendingHTLCInfo_clone_ptr(&arg_conv);
40374         return ret_conv;
40375 }
40376
40377 uint64_t  __attribute__((export_name("TS_PendingHTLCInfo_clone"))) TS_PendingHTLCInfo_clone(uint64_t orig) {
40378         LDKPendingHTLCInfo orig_conv;
40379         orig_conv.inner = untag_ptr(orig);
40380         orig_conv.is_owned = ptr_is_owned(orig);
40381         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40382         orig_conv.is_owned = false;
40383         LDKPendingHTLCInfo ret_var = PendingHTLCInfo_clone(&orig_conv);
40384         uint64_t ret_ref = 0;
40385         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40386         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40387         return ret_ref;
40388 }
40389
40390 uint32_t  __attribute__((export_name("TS_BlindedFailure_clone"))) TS_BlindedFailure_clone(uint64_t orig) {
40391         LDKBlindedFailure* orig_conv = (LDKBlindedFailure*)untag_ptr(orig);
40392         uint32_t ret_conv = LDKBlindedFailure_to_js(BlindedFailure_clone(orig_conv));
40393         return ret_conv;
40394 }
40395
40396 uint32_t  __attribute__((export_name("TS_BlindedFailure_from_introduction_node"))) TS_BlindedFailure_from_introduction_node() {
40397         uint32_t ret_conv = LDKBlindedFailure_to_js(BlindedFailure_from_introduction_node());
40398         return ret_conv;
40399 }
40400
40401 uint32_t  __attribute__((export_name("TS_BlindedFailure_from_blinded_node"))) TS_BlindedFailure_from_blinded_node() {
40402         uint32_t ret_conv = LDKBlindedFailure_to_js(BlindedFailure_from_blinded_node());
40403         return ret_conv;
40404 }
40405
40406 int64_t  __attribute__((export_name("TS_BlindedFailure_hash"))) TS_BlindedFailure_hash(uint64_t o) {
40407         LDKBlindedFailure* o_conv = (LDKBlindedFailure*)untag_ptr(o);
40408         int64_t ret_conv = BlindedFailure_hash(o_conv);
40409         return ret_conv;
40410 }
40411
40412 jboolean  __attribute__((export_name("TS_BlindedFailure_eq"))) TS_BlindedFailure_eq(uint64_t a, uint64_t b) {
40413         LDKBlindedFailure* a_conv = (LDKBlindedFailure*)untag_ptr(a);
40414         LDKBlindedFailure* b_conv = (LDKBlindedFailure*)untag_ptr(b);
40415         jboolean ret_conv = BlindedFailure_eq(a_conv, b_conv);
40416         return ret_conv;
40417 }
40418
40419 void  __attribute__((export_name("TS_FailureCode_free"))) TS_FailureCode_free(uint64_t this_ptr) {
40420         if (!ptr_is_owned(this_ptr)) return;
40421         void* this_ptr_ptr = untag_ptr(this_ptr);
40422         CHECK_ACCESS(this_ptr_ptr);
40423         LDKFailureCode this_ptr_conv = *(LDKFailureCode*)(this_ptr_ptr);
40424         FREE(untag_ptr(this_ptr));
40425         FailureCode_free(this_ptr_conv);
40426 }
40427
40428 static inline uint64_t FailureCode_clone_ptr(LDKFailureCode *NONNULL_PTR arg) {
40429         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
40430         *ret_copy = FailureCode_clone(arg);
40431         uint64_t ret_ref = tag_ptr(ret_copy, true);
40432         return ret_ref;
40433 }
40434 int64_t  __attribute__((export_name("TS_FailureCode_clone_ptr"))) TS_FailureCode_clone_ptr(uint64_t arg) {
40435         LDKFailureCode* arg_conv = (LDKFailureCode*)untag_ptr(arg);
40436         int64_t ret_conv = FailureCode_clone_ptr(arg_conv);
40437         return ret_conv;
40438 }
40439
40440 uint64_t  __attribute__((export_name("TS_FailureCode_clone"))) TS_FailureCode_clone(uint64_t orig) {
40441         LDKFailureCode* orig_conv = (LDKFailureCode*)untag_ptr(orig);
40442         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
40443         *ret_copy = FailureCode_clone(orig_conv);
40444         uint64_t ret_ref = tag_ptr(ret_copy, true);
40445         return ret_ref;
40446 }
40447
40448 uint64_t  __attribute__((export_name("TS_FailureCode_temporary_node_failure"))) TS_FailureCode_temporary_node_failure() {
40449         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
40450         *ret_copy = FailureCode_temporary_node_failure();
40451         uint64_t ret_ref = tag_ptr(ret_copy, true);
40452         return ret_ref;
40453 }
40454
40455 uint64_t  __attribute__((export_name("TS_FailureCode_required_node_feature_missing"))) TS_FailureCode_required_node_feature_missing() {
40456         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
40457         *ret_copy = FailureCode_required_node_feature_missing();
40458         uint64_t ret_ref = tag_ptr(ret_copy, true);
40459         return ret_ref;
40460 }
40461
40462 uint64_t  __attribute__((export_name("TS_FailureCode_incorrect_or_unknown_payment_details"))) TS_FailureCode_incorrect_or_unknown_payment_details() {
40463         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
40464         *ret_copy = FailureCode_incorrect_or_unknown_payment_details();
40465         uint64_t ret_ref = tag_ptr(ret_copy, true);
40466         return ret_ref;
40467 }
40468
40469 uint64_t  __attribute__((export_name("TS_FailureCode_invalid_onion_payload"))) TS_FailureCode_invalid_onion_payload(uint64_t a) {
40470         void* a_ptr = untag_ptr(a);
40471         CHECK_ACCESS(a_ptr);
40472         LDKCOption_C2Tuple_u64u16ZZ a_conv = *(LDKCOption_C2Tuple_u64u16ZZ*)(a_ptr);
40473         a_conv = COption_C2Tuple_u64u16ZZ_clone((LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(a));
40474         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
40475         *ret_copy = FailureCode_invalid_onion_payload(a_conv);
40476         uint64_t ret_ref = tag_ptr(ret_copy, true);
40477         return ret_ref;
40478 }
40479
40480 void  __attribute__((export_name("TS_ChannelManager_free"))) TS_ChannelManager_free(uint64_t this_obj) {
40481         LDKChannelManager this_obj_conv;
40482         this_obj_conv.inner = untag_ptr(this_obj);
40483         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40485         ChannelManager_free(this_obj_conv);
40486 }
40487
40488 void  __attribute__((export_name("TS_ChainParameters_free"))) TS_ChainParameters_free(uint64_t this_obj) {
40489         LDKChainParameters this_obj_conv;
40490         this_obj_conv.inner = untag_ptr(this_obj);
40491         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40493         ChainParameters_free(this_obj_conv);
40494 }
40495
40496 uint32_t  __attribute__((export_name("TS_ChainParameters_get_network"))) TS_ChainParameters_get_network(uint64_t this_ptr) {
40497         LDKChainParameters this_ptr_conv;
40498         this_ptr_conv.inner = untag_ptr(this_ptr);
40499         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40501         this_ptr_conv.is_owned = false;
40502         uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
40503         return ret_conv;
40504 }
40505
40506 void  __attribute__((export_name("TS_ChainParameters_set_network"))) TS_ChainParameters_set_network(uint64_t this_ptr, uint32_t val) {
40507         LDKChainParameters this_ptr_conv;
40508         this_ptr_conv.inner = untag_ptr(this_ptr);
40509         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40511         this_ptr_conv.is_owned = false;
40512         LDKNetwork val_conv = LDKNetwork_from_js(val);
40513         ChainParameters_set_network(&this_ptr_conv, val_conv);
40514 }
40515
40516 uint64_t  __attribute__((export_name("TS_ChainParameters_get_best_block"))) TS_ChainParameters_get_best_block(uint64_t this_ptr) {
40517         LDKChainParameters this_ptr_conv;
40518         this_ptr_conv.inner = untag_ptr(this_ptr);
40519         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40521         this_ptr_conv.is_owned = false;
40522         LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
40523         uint64_t ret_ref = 0;
40524         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40525         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40526         return ret_ref;
40527 }
40528
40529 void  __attribute__((export_name("TS_ChainParameters_set_best_block"))) TS_ChainParameters_set_best_block(uint64_t this_ptr, uint64_t val) {
40530         LDKChainParameters this_ptr_conv;
40531         this_ptr_conv.inner = untag_ptr(this_ptr);
40532         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40534         this_ptr_conv.is_owned = false;
40535         LDKBestBlock val_conv;
40536         val_conv.inner = untag_ptr(val);
40537         val_conv.is_owned = ptr_is_owned(val);
40538         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40539         val_conv = BestBlock_clone(&val_conv);
40540         ChainParameters_set_best_block(&this_ptr_conv, val_conv);
40541 }
40542
40543 uint64_t  __attribute__((export_name("TS_ChainParameters_new"))) TS_ChainParameters_new(uint32_t network_arg, uint64_t best_block_arg) {
40544         LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
40545         LDKBestBlock best_block_arg_conv;
40546         best_block_arg_conv.inner = untag_ptr(best_block_arg);
40547         best_block_arg_conv.is_owned = ptr_is_owned(best_block_arg);
40548         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
40549         best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
40550         LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
40551         uint64_t ret_ref = 0;
40552         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40553         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40554         return ret_ref;
40555 }
40556
40557 static inline uint64_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
40558         LDKChainParameters ret_var = ChainParameters_clone(arg);
40559         uint64_t ret_ref = 0;
40560         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40561         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40562         return ret_ref;
40563 }
40564 int64_t  __attribute__((export_name("TS_ChainParameters_clone_ptr"))) TS_ChainParameters_clone_ptr(uint64_t arg) {
40565         LDKChainParameters arg_conv;
40566         arg_conv.inner = untag_ptr(arg);
40567         arg_conv.is_owned = ptr_is_owned(arg);
40568         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40569         arg_conv.is_owned = false;
40570         int64_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
40571         return ret_conv;
40572 }
40573
40574 uint64_t  __attribute__((export_name("TS_ChainParameters_clone"))) TS_ChainParameters_clone(uint64_t orig) {
40575         LDKChainParameters orig_conv;
40576         orig_conv.inner = untag_ptr(orig);
40577         orig_conv.is_owned = ptr_is_owned(orig);
40578         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40579         orig_conv.is_owned = false;
40580         LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
40581         uint64_t ret_ref = 0;
40582         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40583         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40584         return ret_ref;
40585 }
40586
40587 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_free"))) TS_CounterpartyForwardingInfo_free(uint64_t this_obj) {
40588         LDKCounterpartyForwardingInfo this_obj_conv;
40589         this_obj_conv.inner = untag_ptr(this_obj);
40590         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40592         CounterpartyForwardingInfo_free(this_obj_conv);
40593 }
40594
40595 int32_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_base_msat"))) TS_CounterpartyForwardingInfo_get_fee_base_msat(uint64_t this_ptr) {
40596         LDKCounterpartyForwardingInfo this_ptr_conv;
40597         this_ptr_conv.inner = untag_ptr(this_ptr);
40598         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40600         this_ptr_conv.is_owned = false;
40601         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
40602         return ret_conv;
40603 }
40604
40605 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_base_msat"))) TS_CounterpartyForwardingInfo_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
40606         LDKCounterpartyForwardingInfo this_ptr_conv;
40607         this_ptr_conv.inner = untag_ptr(this_ptr);
40608         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40610         this_ptr_conv.is_owned = false;
40611         CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
40612 }
40613
40614 int32_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_get_fee_proportional_millionths(uint64_t this_ptr) {
40615         LDKCounterpartyForwardingInfo this_ptr_conv;
40616         this_ptr_conv.inner = untag_ptr(this_ptr);
40617         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40619         this_ptr_conv.is_owned = false;
40620         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
40621         return ret_conv;
40622 }
40623
40624 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
40625         LDKCounterpartyForwardingInfo this_ptr_conv;
40626         this_ptr_conv.inner = untag_ptr(this_ptr);
40627         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40629         this_ptr_conv.is_owned = false;
40630         CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
40631 }
40632
40633 int16_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
40634         LDKCounterpartyForwardingInfo this_ptr_conv;
40635         this_ptr_conv.inner = untag_ptr(this_ptr);
40636         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40638         this_ptr_conv.is_owned = false;
40639         int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
40640         return ret_conv;
40641 }
40642
40643 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
40644         LDKCounterpartyForwardingInfo this_ptr_conv;
40645         this_ptr_conv.inner = untag_ptr(this_ptr);
40646         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40648         this_ptr_conv.is_owned = false;
40649         CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
40650 }
40651
40652 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) {
40653         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
40654         uint64_t ret_ref = 0;
40655         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40656         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40657         return ret_ref;
40658 }
40659
40660 static inline uint64_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
40661         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
40662         uint64_t ret_ref = 0;
40663         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40664         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40665         return ret_ref;
40666 }
40667 int64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_clone_ptr"))) TS_CounterpartyForwardingInfo_clone_ptr(uint64_t arg) {
40668         LDKCounterpartyForwardingInfo arg_conv;
40669         arg_conv.inner = untag_ptr(arg);
40670         arg_conv.is_owned = ptr_is_owned(arg);
40671         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40672         arg_conv.is_owned = false;
40673         int64_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
40674         return ret_conv;
40675 }
40676
40677 uint64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_clone"))) TS_CounterpartyForwardingInfo_clone(uint64_t orig) {
40678         LDKCounterpartyForwardingInfo orig_conv;
40679         orig_conv.inner = untag_ptr(orig);
40680         orig_conv.is_owned = ptr_is_owned(orig);
40681         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40682         orig_conv.is_owned = false;
40683         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_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 void  __attribute__((export_name("TS_ChannelCounterparty_free"))) TS_ChannelCounterparty_free(uint64_t this_obj) {
40691         LDKChannelCounterparty this_obj_conv;
40692         this_obj_conv.inner = untag_ptr(this_obj);
40693         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40695         ChannelCounterparty_free(this_obj_conv);
40696 }
40697
40698 int8_tArray  __attribute__((export_name("TS_ChannelCounterparty_get_node_id"))) TS_ChannelCounterparty_get_node_id(uint64_t this_ptr) {
40699         LDKChannelCounterparty this_ptr_conv;
40700         this_ptr_conv.inner = untag_ptr(this_ptr);
40701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40703         this_ptr_conv.is_owned = false;
40704         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40705         memcpy(ret_arr->elems, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
40706         return ret_arr;
40707 }
40708
40709 void  __attribute__((export_name("TS_ChannelCounterparty_set_node_id"))) TS_ChannelCounterparty_set_node_id(uint64_t this_ptr, int8_tArray val) {
40710         LDKChannelCounterparty this_ptr_conv;
40711         this_ptr_conv.inner = untag_ptr(this_ptr);
40712         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40714         this_ptr_conv.is_owned = false;
40715         LDKPublicKey val_ref;
40716         CHECK(val->arr_len == 33);
40717         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
40718         ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
40719 }
40720
40721 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_features"))) TS_ChannelCounterparty_get_features(uint64_t this_ptr) {
40722         LDKChannelCounterparty this_ptr_conv;
40723         this_ptr_conv.inner = untag_ptr(this_ptr);
40724         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40726         this_ptr_conv.is_owned = false;
40727         LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
40728         uint64_t ret_ref = 0;
40729         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40730         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40731         return ret_ref;
40732 }
40733
40734 void  __attribute__((export_name("TS_ChannelCounterparty_set_features"))) TS_ChannelCounterparty_set_features(uint64_t this_ptr, uint64_t val) {
40735         LDKChannelCounterparty this_ptr_conv;
40736         this_ptr_conv.inner = untag_ptr(this_ptr);
40737         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40739         this_ptr_conv.is_owned = false;
40740         LDKInitFeatures val_conv;
40741         val_conv.inner = untag_ptr(val);
40742         val_conv.is_owned = ptr_is_owned(val);
40743         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40744         val_conv = InitFeatures_clone(&val_conv);
40745         ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
40746 }
40747
40748 int64_t  __attribute__((export_name("TS_ChannelCounterparty_get_unspendable_punishment_reserve"))) TS_ChannelCounterparty_get_unspendable_punishment_reserve(uint64_t this_ptr) {
40749         LDKChannelCounterparty this_ptr_conv;
40750         this_ptr_conv.inner = untag_ptr(this_ptr);
40751         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40753         this_ptr_conv.is_owned = false;
40754         int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
40755         return ret_conv;
40756 }
40757
40758 void  __attribute__((export_name("TS_ChannelCounterparty_set_unspendable_punishment_reserve"))) TS_ChannelCounterparty_set_unspendable_punishment_reserve(uint64_t this_ptr, int64_t val) {
40759         LDKChannelCounterparty this_ptr_conv;
40760         this_ptr_conv.inner = untag_ptr(this_ptr);
40761         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40763         this_ptr_conv.is_owned = false;
40764         ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
40765 }
40766
40767 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_forwarding_info"))) TS_ChannelCounterparty_get_forwarding_info(uint64_t this_ptr) {
40768         LDKChannelCounterparty this_ptr_conv;
40769         this_ptr_conv.inner = untag_ptr(this_ptr);
40770         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40772         this_ptr_conv.is_owned = false;
40773         LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
40774         uint64_t ret_ref = 0;
40775         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40776         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40777         return ret_ref;
40778 }
40779
40780 void  __attribute__((export_name("TS_ChannelCounterparty_set_forwarding_info"))) TS_ChannelCounterparty_set_forwarding_info(uint64_t this_ptr, uint64_t val) {
40781         LDKChannelCounterparty this_ptr_conv;
40782         this_ptr_conv.inner = untag_ptr(this_ptr);
40783         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40785         this_ptr_conv.is_owned = false;
40786         LDKCounterpartyForwardingInfo val_conv;
40787         val_conv.inner = untag_ptr(val);
40788         val_conv.is_owned = ptr_is_owned(val);
40789         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40790         val_conv = CounterpartyForwardingInfo_clone(&val_conv);
40791         ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
40792 }
40793
40794 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_minimum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_minimum_msat(uint64_t this_ptr) {
40795         LDKChannelCounterparty this_ptr_conv;
40796         this_ptr_conv.inner = untag_ptr(this_ptr);
40797         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40799         this_ptr_conv.is_owned = false;
40800         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
40801         *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
40802         uint64_t ret_ref = tag_ptr(ret_copy, true);
40803         return ret_ref;
40804 }
40805
40806 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) {
40807         LDKChannelCounterparty this_ptr_conv;
40808         this_ptr_conv.inner = untag_ptr(this_ptr);
40809         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40811         this_ptr_conv.is_owned = false;
40812         void* val_ptr = untag_ptr(val);
40813         CHECK_ACCESS(val_ptr);
40814         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
40815         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
40816         ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
40817 }
40818
40819 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_maximum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_maximum_msat(uint64_t this_ptr) {
40820         LDKChannelCounterparty this_ptr_conv;
40821         this_ptr_conv.inner = untag_ptr(this_ptr);
40822         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40824         this_ptr_conv.is_owned = false;
40825         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
40826         *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
40827         uint64_t ret_ref = tag_ptr(ret_copy, true);
40828         return ret_ref;
40829 }
40830
40831 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) {
40832         LDKChannelCounterparty this_ptr_conv;
40833         this_ptr_conv.inner = untag_ptr(this_ptr);
40834         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40836         this_ptr_conv.is_owned = false;
40837         void* val_ptr = untag_ptr(val);
40838         CHECK_ACCESS(val_ptr);
40839         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
40840         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
40841         ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
40842 }
40843
40844 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) {
40845         LDKPublicKey node_id_arg_ref;
40846         CHECK(node_id_arg->arr_len == 33);
40847         memcpy(node_id_arg_ref.compressed_form, node_id_arg->elems, 33); FREE(node_id_arg);
40848         LDKInitFeatures features_arg_conv;
40849         features_arg_conv.inner = untag_ptr(features_arg);
40850         features_arg_conv.is_owned = ptr_is_owned(features_arg);
40851         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
40852         features_arg_conv = InitFeatures_clone(&features_arg_conv);
40853         LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
40854         forwarding_info_arg_conv.inner = untag_ptr(forwarding_info_arg);
40855         forwarding_info_arg_conv.is_owned = ptr_is_owned(forwarding_info_arg);
40856         CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
40857         forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
40858         void* outbound_htlc_minimum_msat_arg_ptr = untag_ptr(outbound_htlc_minimum_msat_arg);
40859         CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
40860         LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
40861         outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_minimum_msat_arg));
40862         void* outbound_htlc_maximum_msat_arg_ptr = untag_ptr(outbound_htlc_maximum_msat_arg);
40863         CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
40864         LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
40865         outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_maximum_msat_arg));
40866         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);
40867         uint64_t ret_ref = 0;
40868         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40869         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40870         return ret_ref;
40871 }
40872
40873 static inline uint64_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
40874         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
40875         uint64_t ret_ref = 0;
40876         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40877         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40878         return ret_ref;
40879 }
40880 int64_t  __attribute__((export_name("TS_ChannelCounterparty_clone_ptr"))) TS_ChannelCounterparty_clone_ptr(uint64_t arg) {
40881         LDKChannelCounterparty arg_conv;
40882         arg_conv.inner = untag_ptr(arg);
40883         arg_conv.is_owned = ptr_is_owned(arg);
40884         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40885         arg_conv.is_owned = false;
40886         int64_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
40887         return ret_conv;
40888 }
40889
40890 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_clone"))) TS_ChannelCounterparty_clone(uint64_t orig) {
40891         LDKChannelCounterparty orig_conv;
40892         orig_conv.inner = untag_ptr(orig);
40893         orig_conv.is_owned = ptr_is_owned(orig);
40894         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40895         orig_conv.is_owned = false;
40896         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
40897         uint64_t ret_ref = 0;
40898         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40899         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40900         return ret_ref;
40901 }
40902
40903 void  __attribute__((export_name("TS_ChannelDetails_free"))) TS_ChannelDetails_free(uint64_t this_obj) {
40904         LDKChannelDetails this_obj_conv;
40905         this_obj_conv.inner = untag_ptr(this_obj);
40906         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40908         ChannelDetails_free(this_obj_conv);
40909 }
40910
40911 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_id"))) TS_ChannelDetails_get_channel_id(uint64_t this_ptr) {
40912         LDKChannelDetails this_ptr_conv;
40913         this_ptr_conv.inner = untag_ptr(this_ptr);
40914         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40916         this_ptr_conv.is_owned = false;
40917         LDKChannelId ret_var = ChannelDetails_get_channel_id(&this_ptr_conv);
40918         uint64_t ret_ref = 0;
40919         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40920         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40921         return ret_ref;
40922 }
40923
40924 void  __attribute__((export_name("TS_ChannelDetails_set_channel_id"))) TS_ChannelDetails_set_channel_id(uint64_t this_ptr, uint64_t val) {
40925         LDKChannelDetails this_ptr_conv;
40926         this_ptr_conv.inner = untag_ptr(this_ptr);
40927         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40929         this_ptr_conv.is_owned = false;
40930         LDKChannelId val_conv;
40931         val_conv.inner = untag_ptr(val);
40932         val_conv.is_owned = ptr_is_owned(val);
40933         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40934         val_conv = ChannelId_clone(&val_conv);
40935         ChannelDetails_set_channel_id(&this_ptr_conv, val_conv);
40936 }
40937
40938 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_counterparty"))) TS_ChannelDetails_get_counterparty(uint64_t this_ptr) {
40939         LDKChannelDetails this_ptr_conv;
40940         this_ptr_conv.inner = untag_ptr(this_ptr);
40941         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40943         this_ptr_conv.is_owned = false;
40944         LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
40945         uint64_t ret_ref = 0;
40946         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40947         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40948         return ret_ref;
40949 }
40950
40951 void  __attribute__((export_name("TS_ChannelDetails_set_counterparty"))) TS_ChannelDetails_set_counterparty(uint64_t this_ptr, uint64_t val) {
40952         LDKChannelDetails this_ptr_conv;
40953         this_ptr_conv.inner = untag_ptr(this_ptr);
40954         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40956         this_ptr_conv.is_owned = false;
40957         LDKChannelCounterparty val_conv;
40958         val_conv.inner = untag_ptr(val);
40959         val_conv.is_owned = ptr_is_owned(val);
40960         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40961         val_conv = ChannelCounterparty_clone(&val_conv);
40962         ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
40963 }
40964
40965 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_funding_txo"))) TS_ChannelDetails_get_funding_txo(uint64_t this_ptr) {
40966         LDKChannelDetails this_ptr_conv;
40967         this_ptr_conv.inner = untag_ptr(this_ptr);
40968         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40970         this_ptr_conv.is_owned = false;
40971         LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
40972         uint64_t ret_ref = 0;
40973         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40974         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40975         return ret_ref;
40976 }
40977
40978 void  __attribute__((export_name("TS_ChannelDetails_set_funding_txo"))) TS_ChannelDetails_set_funding_txo(uint64_t this_ptr, uint64_t val) {
40979         LDKChannelDetails this_ptr_conv;
40980         this_ptr_conv.inner = untag_ptr(this_ptr);
40981         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40983         this_ptr_conv.is_owned = false;
40984         LDKOutPoint val_conv;
40985         val_conv.inner = untag_ptr(val);
40986         val_conv.is_owned = ptr_is_owned(val);
40987         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40988         val_conv = OutPoint_clone(&val_conv);
40989         ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
40990 }
40991
40992 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_type"))) TS_ChannelDetails_get_channel_type(uint64_t this_ptr) {
40993         LDKChannelDetails this_ptr_conv;
40994         this_ptr_conv.inner = untag_ptr(this_ptr);
40995         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40997         this_ptr_conv.is_owned = false;
40998         LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
40999         uint64_t ret_ref = 0;
41000         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41001         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41002         return ret_ref;
41003 }
41004
41005 void  __attribute__((export_name("TS_ChannelDetails_set_channel_type"))) TS_ChannelDetails_set_channel_type(uint64_t this_ptr, uint64_t val) {
41006         LDKChannelDetails this_ptr_conv;
41007         this_ptr_conv.inner = untag_ptr(this_ptr);
41008         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41010         this_ptr_conv.is_owned = false;
41011         LDKChannelTypeFeatures val_conv;
41012         val_conv.inner = untag_ptr(val);
41013         val_conv.is_owned = ptr_is_owned(val);
41014         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41015         val_conv = ChannelTypeFeatures_clone(&val_conv);
41016         ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
41017 }
41018
41019 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_short_channel_id"))) TS_ChannelDetails_get_short_channel_id(uint64_t this_ptr) {
41020         LDKChannelDetails this_ptr_conv;
41021         this_ptr_conv.inner = untag_ptr(this_ptr);
41022         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41024         this_ptr_conv.is_owned = false;
41025         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
41026         *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
41027         uint64_t ret_ref = tag_ptr(ret_copy, true);
41028         return ret_ref;
41029 }
41030
41031 void  __attribute__((export_name("TS_ChannelDetails_set_short_channel_id"))) TS_ChannelDetails_set_short_channel_id(uint64_t this_ptr, uint64_t val) {
41032         LDKChannelDetails this_ptr_conv;
41033         this_ptr_conv.inner = untag_ptr(this_ptr);
41034         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41036         this_ptr_conv.is_owned = false;
41037         void* val_ptr = untag_ptr(val);
41038         CHECK_ACCESS(val_ptr);
41039         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
41040         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
41041         ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
41042 }
41043
41044 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_scid_alias"))) TS_ChannelDetails_get_outbound_scid_alias(uint64_t this_ptr) {
41045         LDKChannelDetails this_ptr_conv;
41046         this_ptr_conv.inner = untag_ptr(this_ptr);
41047         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41049         this_ptr_conv.is_owned = false;
41050         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
41051         *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
41052         uint64_t ret_ref = tag_ptr(ret_copy, true);
41053         return ret_ref;
41054 }
41055
41056 void  __attribute__((export_name("TS_ChannelDetails_set_outbound_scid_alias"))) TS_ChannelDetails_set_outbound_scid_alias(uint64_t this_ptr, uint64_t val) {
41057         LDKChannelDetails this_ptr_conv;
41058         this_ptr_conv.inner = untag_ptr(this_ptr);
41059         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41061         this_ptr_conv.is_owned = false;
41062         void* val_ptr = untag_ptr(val);
41063         CHECK_ACCESS(val_ptr);
41064         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
41065         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
41066         ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
41067 }
41068
41069 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_scid_alias"))) TS_ChannelDetails_get_inbound_scid_alias(uint64_t this_ptr) {
41070         LDKChannelDetails this_ptr_conv;
41071         this_ptr_conv.inner = untag_ptr(this_ptr);
41072         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41074         this_ptr_conv.is_owned = false;
41075         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
41076         *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
41077         uint64_t ret_ref = tag_ptr(ret_copy, true);
41078         return ret_ref;
41079 }
41080
41081 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_scid_alias"))) TS_ChannelDetails_set_inbound_scid_alias(uint64_t this_ptr, uint64_t val) {
41082         LDKChannelDetails this_ptr_conv;
41083         this_ptr_conv.inner = untag_ptr(this_ptr);
41084         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41086         this_ptr_conv.is_owned = false;
41087         void* val_ptr = untag_ptr(val);
41088         CHECK_ACCESS(val_ptr);
41089         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
41090         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
41091         ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
41092 }
41093
41094 int64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_value_satoshis"))) TS_ChannelDetails_get_channel_value_satoshis(uint64_t this_ptr) {
41095         LDKChannelDetails 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         int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
41101         return ret_conv;
41102 }
41103
41104 void  __attribute__((export_name("TS_ChannelDetails_set_channel_value_satoshis"))) TS_ChannelDetails_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
41105         LDKChannelDetails this_ptr_conv;
41106         this_ptr_conv.inner = untag_ptr(this_ptr);
41107         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41109         this_ptr_conv.is_owned = false;
41110         ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
41111 }
41112
41113 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_unspendable_punishment_reserve"))) TS_ChannelDetails_get_unspendable_punishment_reserve(uint64_t this_ptr) {
41114         LDKChannelDetails this_ptr_conv;
41115         this_ptr_conv.inner = untag_ptr(this_ptr);
41116         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41118         this_ptr_conv.is_owned = false;
41119         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
41120         *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
41121         uint64_t ret_ref = tag_ptr(ret_copy, true);
41122         return ret_ref;
41123 }
41124
41125 void  __attribute__((export_name("TS_ChannelDetails_set_unspendable_punishment_reserve"))) TS_ChannelDetails_set_unspendable_punishment_reserve(uint64_t this_ptr, uint64_t val) {
41126         LDKChannelDetails this_ptr_conv;
41127         this_ptr_conv.inner = untag_ptr(this_ptr);
41128         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41130         this_ptr_conv.is_owned = false;
41131         void* val_ptr = untag_ptr(val);
41132         CHECK_ACCESS(val_ptr);
41133         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
41134         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
41135         ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
41136 }
41137
41138 int8_tArray  __attribute__((export_name("TS_ChannelDetails_get_user_channel_id"))) TS_ChannelDetails_get_user_channel_id(uint64_t this_ptr) {
41139         LDKChannelDetails this_ptr_conv;
41140         this_ptr_conv.inner = untag_ptr(this_ptr);
41141         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41143         this_ptr_conv.is_owned = false;
41144         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
41145         memcpy(ret_arr->elems, ChannelDetails_get_user_channel_id(&this_ptr_conv).le_bytes, 16);
41146         return ret_arr;
41147 }
41148
41149 void  __attribute__((export_name("TS_ChannelDetails_set_user_channel_id"))) TS_ChannelDetails_set_user_channel_id(uint64_t this_ptr, int8_tArray val) {
41150         LDKChannelDetails this_ptr_conv;
41151         this_ptr_conv.inner = untag_ptr(this_ptr);
41152         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41154         this_ptr_conv.is_owned = false;
41155         LDKU128 val_ref;
41156         CHECK(val->arr_len == 16);
41157         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
41158         ChannelDetails_set_user_channel_id(&this_ptr_conv, val_ref);
41159 }
41160
41161 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) {
41162         LDKChannelDetails this_ptr_conv;
41163         this_ptr_conv.inner = untag_ptr(this_ptr);
41164         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41166         this_ptr_conv.is_owned = false;
41167         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
41168         *ret_copy = ChannelDetails_get_feerate_sat_per_1000_weight(&this_ptr_conv);
41169         uint64_t ret_ref = tag_ptr(ret_copy, true);
41170         return ret_ref;
41171 }
41172
41173 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) {
41174         LDKChannelDetails this_ptr_conv;
41175         this_ptr_conv.inner = untag_ptr(this_ptr);
41176         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41178         this_ptr_conv.is_owned = false;
41179         void* val_ptr = untag_ptr(val);
41180         CHECK_ACCESS(val_ptr);
41181         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
41182         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
41183         ChannelDetails_set_feerate_sat_per_1000_weight(&this_ptr_conv, val_conv);
41184 }
41185
41186 int64_t  __attribute__((export_name("TS_ChannelDetails_get_balance_msat"))) TS_ChannelDetails_get_balance_msat(uint64_t this_ptr) {
41187         LDKChannelDetails this_ptr_conv;
41188         this_ptr_conv.inner = untag_ptr(this_ptr);
41189         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41191         this_ptr_conv.is_owned = false;
41192         int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
41193         return ret_conv;
41194 }
41195
41196 void  __attribute__((export_name("TS_ChannelDetails_set_balance_msat"))) TS_ChannelDetails_set_balance_msat(uint64_t this_ptr, int64_t val) {
41197         LDKChannelDetails this_ptr_conv;
41198         this_ptr_conv.inner = untag_ptr(this_ptr);
41199         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41201         this_ptr_conv.is_owned = false;
41202         ChannelDetails_set_balance_msat(&this_ptr_conv, val);
41203 }
41204
41205 int64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_capacity_msat"))) TS_ChannelDetails_get_outbound_capacity_msat(uint64_t this_ptr) {
41206         LDKChannelDetails this_ptr_conv;
41207         this_ptr_conv.inner = untag_ptr(this_ptr);
41208         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41210         this_ptr_conv.is_owned = false;
41211         int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
41212         return ret_conv;
41213 }
41214
41215 void  __attribute__((export_name("TS_ChannelDetails_set_outbound_capacity_msat"))) TS_ChannelDetails_set_outbound_capacity_msat(uint64_t this_ptr, int64_t val) {
41216         LDKChannelDetails this_ptr_conv;
41217         this_ptr_conv.inner = untag_ptr(this_ptr);
41218         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41220         this_ptr_conv.is_owned = false;
41221         ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
41222 }
41223
41224 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) {
41225         LDKChannelDetails this_ptr_conv;
41226         this_ptr_conv.inner = untag_ptr(this_ptr);
41227         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41229         this_ptr_conv.is_owned = false;
41230         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
41231         return ret_conv;
41232 }
41233
41234 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) {
41235         LDKChannelDetails this_ptr_conv;
41236         this_ptr_conv.inner = untag_ptr(this_ptr);
41237         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41239         this_ptr_conv.is_owned = false;
41240         ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
41241 }
41242
41243 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) {
41244         LDKChannelDetails this_ptr_conv;
41245         this_ptr_conv.inner = untag_ptr(this_ptr);
41246         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41248         this_ptr_conv.is_owned = false;
41249         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_minimum_msat(&this_ptr_conv);
41250         return ret_conv;
41251 }
41252
41253 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) {
41254         LDKChannelDetails this_ptr_conv;
41255         this_ptr_conv.inner = untag_ptr(this_ptr);
41256         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41258         this_ptr_conv.is_owned = false;
41259         ChannelDetails_set_next_outbound_htlc_minimum_msat(&this_ptr_conv, val);
41260 }
41261
41262 int64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_capacity_msat"))) TS_ChannelDetails_get_inbound_capacity_msat(uint64_t this_ptr) {
41263         LDKChannelDetails this_ptr_conv;
41264         this_ptr_conv.inner = untag_ptr(this_ptr);
41265         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41267         this_ptr_conv.is_owned = false;
41268         int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
41269         return ret_conv;
41270 }
41271
41272 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_capacity_msat"))) TS_ChannelDetails_set_inbound_capacity_msat(uint64_t this_ptr, int64_t val) {
41273         LDKChannelDetails this_ptr_conv;
41274         this_ptr_conv.inner = untag_ptr(this_ptr);
41275         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41277         this_ptr_conv.is_owned = false;
41278         ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
41279 }
41280
41281 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_confirmations_required"))) TS_ChannelDetails_get_confirmations_required(uint64_t this_ptr) {
41282         LDKChannelDetails this_ptr_conv;
41283         this_ptr_conv.inner = untag_ptr(this_ptr);
41284         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41286         this_ptr_conv.is_owned = false;
41287         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
41288         *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
41289         uint64_t ret_ref = tag_ptr(ret_copy, true);
41290         return ret_ref;
41291 }
41292
41293 void  __attribute__((export_name("TS_ChannelDetails_set_confirmations_required"))) TS_ChannelDetails_set_confirmations_required(uint64_t this_ptr, uint64_t val) {
41294         LDKChannelDetails this_ptr_conv;
41295         this_ptr_conv.inner = untag_ptr(this_ptr);
41296         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41298         this_ptr_conv.is_owned = false;
41299         void* val_ptr = untag_ptr(val);
41300         CHECK_ACCESS(val_ptr);
41301         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
41302         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
41303         ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
41304 }
41305
41306 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_confirmations"))) TS_ChannelDetails_get_confirmations(uint64_t this_ptr) {
41307         LDKChannelDetails this_ptr_conv;
41308         this_ptr_conv.inner = untag_ptr(this_ptr);
41309         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41311         this_ptr_conv.is_owned = false;
41312         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
41313         *ret_copy = ChannelDetails_get_confirmations(&this_ptr_conv);
41314         uint64_t ret_ref = tag_ptr(ret_copy, true);
41315         return ret_ref;
41316 }
41317
41318 void  __attribute__((export_name("TS_ChannelDetails_set_confirmations"))) TS_ChannelDetails_set_confirmations(uint64_t this_ptr, uint64_t val) {
41319         LDKChannelDetails this_ptr_conv;
41320         this_ptr_conv.inner = untag_ptr(this_ptr);
41321         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41323         this_ptr_conv.is_owned = false;
41324         void* val_ptr = untag_ptr(val);
41325         CHECK_ACCESS(val_ptr);
41326         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
41327         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
41328         ChannelDetails_set_confirmations(&this_ptr_conv, val_conv);
41329 }
41330
41331 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_force_close_spend_delay"))) TS_ChannelDetails_get_force_close_spend_delay(uint64_t this_ptr) {
41332         LDKChannelDetails this_ptr_conv;
41333         this_ptr_conv.inner = untag_ptr(this_ptr);
41334         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41336         this_ptr_conv.is_owned = false;
41337         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
41338         *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
41339         uint64_t ret_ref = tag_ptr(ret_copy, true);
41340         return ret_ref;
41341 }
41342
41343 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) {
41344         LDKChannelDetails this_ptr_conv;
41345         this_ptr_conv.inner = untag_ptr(this_ptr);
41346         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41348         this_ptr_conv.is_owned = false;
41349         void* val_ptr = untag_ptr(val);
41350         CHECK_ACCESS(val_ptr);
41351         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
41352         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
41353         ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
41354 }
41355
41356 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_outbound"))) TS_ChannelDetails_get_is_outbound(uint64_t this_ptr) {
41357         LDKChannelDetails this_ptr_conv;
41358         this_ptr_conv.inner = untag_ptr(this_ptr);
41359         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41361         this_ptr_conv.is_owned = false;
41362         jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
41363         return ret_conv;
41364 }
41365
41366 void  __attribute__((export_name("TS_ChannelDetails_set_is_outbound"))) TS_ChannelDetails_set_is_outbound(uint64_t this_ptr, jboolean val) {
41367         LDKChannelDetails this_ptr_conv;
41368         this_ptr_conv.inner = untag_ptr(this_ptr);
41369         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41371         this_ptr_conv.is_owned = false;
41372         ChannelDetails_set_is_outbound(&this_ptr_conv, val);
41373 }
41374
41375 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_channel_ready"))) TS_ChannelDetails_get_is_channel_ready(uint64_t this_ptr) {
41376         LDKChannelDetails this_ptr_conv;
41377         this_ptr_conv.inner = untag_ptr(this_ptr);
41378         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41380         this_ptr_conv.is_owned = false;
41381         jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
41382         return ret_conv;
41383 }
41384
41385 void  __attribute__((export_name("TS_ChannelDetails_set_is_channel_ready"))) TS_ChannelDetails_set_is_channel_ready(uint64_t this_ptr, jboolean val) {
41386         LDKChannelDetails this_ptr_conv;
41387         this_ptr_conv.inner = untag_ptr(this_ptr);
41388         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41390         this_ptr_conv.is_owned = false;
41391         ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
41392 }
41393
41394 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_shutdown_state"))) TS_ChannelDetails_get_channel_shutdown_state(uint64_t this_ptr) {
41395         LDKChannelDetails this_ptr_conv;
41396         this_ptr_conv.inner = untag_ptr(this_ptr);
41397         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41399         this_ptr_conv.is_owned = false;
41400         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
41401         *ret_copy = ChannelDetails_get_channel_shutdown_state(&this_ptr_conv);
41402         uint64_t ret_ref = tag_ptr(ret_copy, true);
41403         return ret_ref;
41404 }
41405
41406 void  __attribute__((export_name("TS_ChannelDetails_set_channel_shutdown_state"))) TS_ChannelDetails_set_channel_shutdown_state(uint64_t this_ptr, uint64_t val) {
41407         LDKChannelDetails this_ptr_conv;
41408         this_ptr_conv.inner = untag_ptr(this_ptr);
41409         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41411         this_ptr_conv.is_owned = false;
41412         void* val_ptr = untag_ptr(val);
41413         CHECK_ACCESS(val_ptr);
41414         LDKCOption_ChannelShutdownStateZ val_conv = *(LDKCOption_ChannelShutdownStateZ*)(val_ptr);
41415         val_conv = COption_ChannelShutdownStateZ_clone((LDKCOption_ChannelShutdownStateZ*)untag_ptr(val));
41416         ChannelDetails_set_channel_shutdown_state(&this_ptr_conv, val_conv);
41417 }
41418
41419 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_usable"))) TS_ChannelDetails_get_is_usable(uint64_t this_ptr) {
41420         LDKChannelDetails this_ptr_conv;
41421         this_ptr_conv.inner = untag_ptr(this_ptr);
41422         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41424         this_ptr_conv.is_owned = false;
41425         jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
41426         return ret_conv;
41427 }
41428
41429 void  __attribute__((export_name("TS_ChannelDetails_set_is_usable"))) TS_ChannelDetails_set_is_usable(uint64_t this_ptr, jboolean val) {
41430         LDKChannelDetails this_ptr_conv;
41431         this_ptr_conv.inner = untag_ptr(this_ptr);
41432         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41434         this_ptr_conv.is_owned = false;
41435         ChannelDetails_set_is_usable(&this_ptr_conv, val);
41436 }
41437
41438 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_public"))) TS_ChannelDetails_get_is_public(uint64_t this_ptr) {
41439         LDKChannelDetails this_ptr_conv;
41440         this_ptr_conv.inner = untag_ptr(this_ptr);
41441         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41443         this_ptr_conv.is_owned = false;
41444         jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
41445         return ret_conv;
41446 }
41447
41448 void  __attribute__((export_name("TS_ChannelDetails_set_is_public"))) TS_ChannelDetails_set_is_public(uint64_t this_ptr, jboolean val) {
41449         LDKChannelDetails this_ptr_conv;
41450         this_ptr_conv.inner = untag_ptr(this_ptr);
41451         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41453         this_ptr_conv.is_owned = false;
41454         ChannelDetails_set_is_public(&this_ptr_conv, val);
41455 }
41456
41457 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_minimum_msat"))) TS_ChannelDetails_get_inbound_htlc_minimum_msat(uint64_t this_ptr) {
41458         LDKChannelDetails this_ptr_conv;
41459         this_ptr_conv.inner = untag_ptr(this_ptr);
41460         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41462         this_ptr_conv.is_owned = false;
41463         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
41464         *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&this_ptr_conv);
41465         uint64_t ret_ref = tag_ptr(ret_copy, true);
41466         return ret_ref;
41467 }
41468
41469 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) {
41470         LDKChannelDetails this_ptr_conv;
41471         this_ptr_conv.inner = untag_ptr(this_ptr);
41472         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41474         this_ptr_conv.is_owned = false;
41475         void* val_ptr = untag_ptr(val);
41476         CHECK_ACCESS(val_ptr);
41477         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
41478         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
41479         ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
41480 }
41481
41482 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_maximum_msat"))) TS_ChannelDetails_get_inbound_htlc_maximum_msat(uint64_t this_ptr) {
41483         LDKChannelDetails this_ptr_conv;
41484         this_ptr_conv.inner = untag_ptr(this_ptr);
41485         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41487         this_ptr_conv.is_owned = false;
41488         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
41489         *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
41490         uint64_t ret_ref = tag_ptr(ret_copy, true);
41491         return ret_ref;
41492 }
41493
41494 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) {
41495         LDKChannelDetails this_ptr_conv;
41496         this_ptr_conv.inner = untag_ptr(this_ptr);
41497         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41499         this_ptr_conv.is_owned = false;
41500         void* val_ptr = untag_ptr(val);
41501         CHECK_ACCESS(val_ptr);
41502         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
41503         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
41504         ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
41505 }
41506
41507 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_config"))) TS_ChannelDetails_get_config(uint64_t this_ptr) {
41508         LDKChannelDetails this_ptr_conv;
41509         this_ptr_conv.inner = untag_ptr(this_ptr);
41510         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41512         this_ptr_conv.is_owned = false;
41513         LDKChannelConfig ret_var = ChannelDetails_get_config(&this_ptr_conv);
41514         uint64_t ret_ref = 0;
41515         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41516         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41517         return ret_ref;
41518 }
41519
41520 void  __attribute__((export_name("TS_ChannelDetails_set_config"))) TS_ChannelDetails_set_config(uint64_t this_ptr, uint64_t val) {
41521         LDKChannelDetails this_ptr_conv;
41522         this_ptr_conv.inner = untag_ptr(this_ptr);
41523         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41525         this_ptr_conv.is_owned = false;
41526         LDKChannelConfig val_conv;
41527         val_conv.inner = untag_ptr(val);
41528         val_conv.is_owned = ptr_is_owned(val);
41529         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41530         val_conv = ChannelConfig_clone(&val_conv);
41531         ChannelDetails_set_config(&this_ptr_conv, val_conv);
41532 }
41533
41534 static inline uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
41535         LDKChannelDetails ret_var = ChannelDetails_clone(arg);
41536         uint64_t ret_ref = 0;
41537         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41538         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41539         return ret_ref;
41540 }
41541 int64_t  __attribute__((export_name("TS_ChannelDetails_clone_ptr"))) TS_ChannelDetails_clone_ptr(uint64_t arg) {
41542         LDKChannelDetails arg_conv;
41543         arg_conv.inner = untag_ptr(arg);
41544         arg_conv.is_owned = ptr_is_owned(arg);
41545         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41546         arg_conv.is_owned = false;
41547         int64_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
41548         return ret_conv;
41549 }
41550
41551 uint64_t  __attribute__((export_name("TS_ChannelDetails_clone"))) TS_ChannelDetails_clone(uint64_t orig) {
41552         LDKChannelDetails orig_conv;
41553         orig_conv.inner = untag_ptr(orig);
41554         orig_conv.is_owned = ptr_is_owned(orig);
41555         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41556         orig_conv.is_owned = false;
41557         LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
41558         uint64_t ret_ref = 0;
41559         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41560         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41561         return ret_ref;
41562 }
41563
41564 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_payment_scid"))) TS_ChannelDetails_get_inbound_payment_scid(uint64_t this_arg) {
41565         LDKChannelDetails this_arg_conv;
41566         this_arg_conv.inner = untag_ptr(this_arg);
41567         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41569         this_arg_conv.is_owned = false;
41570         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
41571         *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
41572         uint64_t ret_ref = tag_ptr(ret_copy, true);
41573         return ret_ref;
41574 }
41575
41576 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_payment_scid"))) TS_ChannelDetails_get_outbound_payment_scid(uint64_t this_arg) {
41577         LDKChannelDetails this_arg_conv;
41578         this_arg_conv.inner = untag_ptr(this_arg);
41579         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41581         this_arg_conv.is_owned = false;
41582         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
41583         *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
41584         uint64_t ret_ref = tag_ptr(ret_copy, true);
41585         return ret_ref;
41586 }
41587
41588 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_clone"))) TS_ChannelShutdownState_clone(uint64_t orig) {
41589         LDKChannelShutdownState* orig_conv = (LDKChannelShutdownState*)untag_ptr(orig);
41590         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_clone(orig_conv));
41591         return ret_conv;
41592 }
41593
41594 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_not_shutting_down"))) TS_ChannelShutdownState_not_shutting_down() {
41595         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_not_shutting_down());
41596         return ret_conv;
41597 }
41598
41599 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_shutdown_initiated"))) TS_ChannelShutdownState_shutdown_initiated() {
41600         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_shutdown_initiated());
41601         return ret_conv;
41602 }
41603
41604 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_resolving_htlcs"))) TS_ChannelShutdownState_resolving_htlcs() {
41605         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_resolving_htlcs());
41606         return ret_conv;
41607 }
41608
41609 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_negotiating_closing_fee"))) TS_ChannelShutdownState_negotiating_closing_fee() {
41610         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_negotiating_closing_fee());
41611         return ret_conv;
41612 }
41613
41614 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_shutdown_complete"))) TS_ChannelShutdownState_shutdown_complete() {
41615         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_shutdown_complete());
41616         return ret_conv;
41617 }
41618
41619 jboolean  __attribute__((export_name("TS_ChannelShutdownState_eq"))) TS_ChannelShutdownState_eq(uint64_t a, uint64_t b) {
41620         LDKChannelShutdownState* a_conv = (LDKChannelShutdownState*)untag_ptr(a);
41621         LDKChannelShutdownState* b_conv = (LDKChannelShutdownState*)untag_ptr(b);
41622         jboolean ret_conv = ChannelShutdownState_eq(a_conv, b_conv);
41623         return ret_conv;
41624 }
41625
41626 void  __attribute__((export_name("TS_RecentPaymentDetails_free"))) TS_RecentPaymentDetails_free(uint64_t this_ptr) {
41627         if (!ptr_is_owned(this_ptr)) return;
41628         void* this_ptr_ptr = untag_ptr(this_ptr);
41629         CHECK_ACCESS(this_ptr_ptr);
41630         LDKRecentPaymentDetails this_ptr_conv = *(LDKRecentPaymentDetails*)(this_ptr_ptr);
41631         FREE(untag_ptr(this_ptr));
41632         RecentPaymentDetails_free(this_ptr_conv);
41633 }
41634
41635 static inline uint64_t RecentPaymentDetails_clone_ptr(LDKRecentPaymentDetails *NONNULL_PTR arg) {
41636         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
41637         *ret_copy = RecentPaymentDetails_clone(arg);
41638         uint64_t ret_ref = tag_ptr(ret_copy, true);
41639         return ret_ref;
41640 }
41641 int64_t  __attribute__((export_name("TS_RecentPaymentDetails_clone_ptr"))) TS_RecentPaymentDetails_clone_ptr(uint64_t arg) {
41642         LDKRecentPaymentDetails* arg_conv = (LDKRecentPaymentDetails*)untag_ptr(arg);
41643         int64_t ret_conv = RecentPaymentDetails_clone_ptr(arg_conv);
41644         return ret_conv;
41645 }
41646
41647 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_clone"))) TS_RecentPaymentDetails_clone(uint64_t orig) {
41648         LDKRecentPaymentDetails* orig_conv = (LDKRecentPaymentDetails*)untag_ptr(orig);
41649         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
41650         *ret_copy = RecentPaymentDetails_clone(orig_conv);
41651         uint64_t ret_ref = tag_ptr(ret_copy, true);
41652         return ret_ref;
41653 }
41654
41655 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_awaiting_invoice"))) TS_RecentPaymentDetails_awaiting_invoice(int8_tArray payment_id) {
41656         LDKThirtyTwoBytes payment_id_ref;
41657         CHECK(payment_id->arr_len == 32);
41658         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
41659         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
41660         *ret_copy = RecentPaymentDetails_awaiting_invoice(payment_id_ref);
41661         uint64_t ret_ref = tag_ptr(ret_copy, true);
41662         return ret_ref;
41663 }
41664
41665 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_pending"))) TS_RecentPaymentDetails_pending(int8_tArray payment_id, int8_tArray payment_hash, int64_t total_msat) {
41666         LDKThirtyTwoBytes payment_id_ref;
41667         CHECK(payment_id->arr_len == 32);
41668         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
41669         LDKThirtyTwoBytes payment_hash_ref;
41670         CHECK(payment_hash->arr_len == 32);
41671         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
41672         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
41673         *ret_copy = RecentPaymentDetails_pending(payment_id_ref, payment_hash_ref, total_msat);
41674         uint64_t ret_ref = tag_ptr(ret_copy, true);
41675         return ret_ref;
41676 }
41677
41678 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_fulfilled"))) TS_RecentPaymentDetails_fulfilled(int8_tArray payment_id, uint64_t payment_hash) {
41679         LDKThirtyTwoBytes payment_id_ref;
41680         CHECK(payment_id->arr_len == 32);
41681         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
41682         void* payment_hash_ptr = untag_ptr(payment_hash);
41683         CHECK_ACCESS(payment_hash_ptr);
41684         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
41685         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
41686         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
41687         *ret_copy = RecentPaymentDetails_fulfilled(payment_id_ref, payment_hash_conv);
41688         uint64_t ret_ref = tag_ptr(ret_copy, true);
41689         return ret_ref;
41690 }
41691
41692 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_abandoned"))) TS_RecentPaymentDetails_abandoned(int8_tArray payment_id, int8_tArray payment_hash) {
41693         LDKThirtyTwoBytes payment_id_ref;
41694         CHECK(payment_id->arr_len == 32);
41695         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
41696         LDKThirtyTwoBytes payment_hash_ref;
41697         CHECK(payment_hash->arr_len == 32);
41698         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
41699         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
41700         *ret_copy = RecentPaymentDetails_abandoned(payment_id_ref, payment_hash_ref);
41701         uint64_t ret_ref = tag_ptr(ret_copy, true);
41702         return ret_ref;
41703 }
41704
41705 void  __attribute__((export_name("TS_PhantomRouteHints_free"))) TS_PhantomRouteHints_free(uint64_t this_obj) {
41706         LDKPhantomRouteHints this_obj_conv;
41707         this_obj_conv.inner = untag_ptr(this_obj);
41708         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41710         PhantomRouteHints_free(this_obj_conv);
41711 }
41712
41713 uint64_tArray  __attribute__((export_name("TS_PhantomRouteHints_get_channels"))) TS_PhantomRouteHints_get_channels(uint64_t this_ptr) {
41714         LDKPhantomRouteHints this_ptr_conv;
41715         this_ptr_conv.inner = untag_ptr(this_ptr);
41716         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41718         this_ptr_conv.is_owned = false;
41719         LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
41720         uint64_tArray ret_arr = NULL;
41721         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
41722         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
41723         for (size_t q = 0; q < ret_var.datalen; q++) {
41724                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
41725                 uint64_t ret_conv_16_ref = 0;
41726                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
41727                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
41728                 ret_arr_ptr[q] = ret_conv_16_ref;
41729         }
41730         
41731         FREE(ret_var.data);
41732         return ret_arr;
41733 }
41734
41735 void  __attribute__((export_name("TS_PhantomRouteHints_set_channels"))) TS_PhantomRouteHints_set_channels(uint64_t this_ptr, uint64_tArray val) {
41736         LDKPhantomRouteHints this_ptr_conv;
41737         this_ptr_conv.inner = untag_ptr(this_ptr);
41738         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41740         this_ptr_conv.is_owned = false;
41741         LDKCVec_ChannelDetailsZ val_constr;
41742         val_constr.datalen = val->arr_len;
41743         if (val_constr.datalen > 0)
41744                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
41745         else
41746                 val_constr.data = NULL;
41747         uint64_t* val_vals = val->elems;
41748         for (size_t q = 0; q < val_constr.datalen; q++) {
41749                 uint64_t val_conv_16 = val_vals[q];
41750                 LDKChannelDetails val_conv_16_conv;
41751                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
41752                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
41753                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
41754                 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
41755                 val_constr.data[q] = val_conv_16_conv;
41756         }
41757         FREE(val);
41758         PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
41759 }
41760
41761 int64_t  __attribute__((export_name("TS_PhantomRouteHints_get_phantom_scid"))) TS_PhantomRouteHints_get_phantom_scid(uint64_t this_ptr) {
41762         LDKPhantomRouteHints this_ptr_conv;
41763         this_ptr_conv.inner = untag_ptr(this_ptr);
41764         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41766         this_ptr_conv.is_owned = false;
41767         int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
41768         return ret_conv;
41769 }
41770
41771 void  __attribute__((export_name("TS_PhantomRouteHints_set_phantom_scid"))) TS_PhantomRouteHints_set_phantom_scid(uint64_t this_ptr, int64_t val) {
41772         LDKPhantomRouteHints this_ptr_conv;
41773         this_ptr_conv.inner = untag_ptr(this_ptr);
41774         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41776         this_ptr_conv.is_owned = false;
41777         PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
41778 }
41779
41780 int8_tArray  __attribute__((export_name("TS_PhantomRouteHints_get_real_node_pubkey"))) TS_PhantomRouteHints_get_real_node_pubkey(uint64_t this_ptr) {
41781         LDKPhantomRouteHints this_ptr_conv;
41782         this_ptr_conv.inner = untag_ptr(this_ptr);
41783         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41785         this_ptr_conv.is_owned = false;
41786         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
41787         memcpy(ret_arr->elems, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form, 33);
41788         return ret_arr;
41789 }
41790
41791 void  __attribute__((export_name("TS_PhantomRouteHints_set_real_node_pubkey"))) TS_PhantomRouteHints_set_real_node_pubkey(uint64_t this_ptr, int8_tArray val) {
41792         LDKPhantomRouteHints this_ptr_conv;
41793         this_ptr_conv.inner = untag_ptr(this_ptr);
41794         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41796         this_ptr_conv.is_owned = false;
41797         LDKPublicKey val_ref;
41798         CHECK(val->arr_len == 33);
41799         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
41800         PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
41801 }
41802
41803 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) {
41804         LDKCVec_ChannelDetailsZ channels_arg_constr;
41805         channels_arg_constr.datalen = channels_arg->arr_len;
41806         if (channels_arg_constr.datalen > 0)
41807                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
41808         else
41809                 channels_arg_constr.data = NULL;
41810         uint64_t* channels_arg_vals = channels_arg->elems;
41811         for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
41812                 uint64_t channels_arg_conv_16 = channels_arg_vals[q];
41813                 LDKChannelDetails channels_arg_conv_16_conv;
41814                 channels_arg_conv_16_conv.inner = untag_ptr(channels_arg_conv_16);
41815                 channels_arg_conv_16_conv.is_owned = ptr_is_owned(channels_arg_conv_16);
41816                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
41817                 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
41818                 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
41819         }
41820         FREE(channels_arg);
41821         LDKPublicKey real_node_pubkey_arg_ref;
41822         CHECK(real_node_pubkey_arg->arr_len == 33);
41823         memcpy(real_node_pubkey_arg_ref.compressed_form, real_node_pubkey_arg->elems, 33); FREE(real_node_pubkey_arg);
41824         LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
41825         uint64_t ret_ref = 0;
41826         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41827         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41828         return ret_ref;
41829 }
41830
41831 static inline uint64_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
41832         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
41833         uint64_t ret_ref = 0;
41834         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41835         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41836         return ret_ref;
41837 }
41838 int64_t  __attribute__((export_name("TS_PhantomRouteHints_clone_ptr"))) TS_PhantomRouteHints_clone_ptr(uint64_t arg) {
41839         LDKPhantomRouteHints arg_conv;
41840         arg_conv.inner = untag_ptr(arg);
41841         arg_conv.is_owned = ptr_is_owned(arg);
41842         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41843         arg_conv.is_owned = false;
41844         int64_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
41845         return ret_conv;
41846 }
41847
41848 uint64_t  __attribute__((export_name("TS_PhantomRouteHints_clone"))) TS_PhantomRouteHints_clone(uint64_t orig) {
41849         LDKPhantomRouteHints orig_conv;
41850         orig_conv.inner = untag_ptr(orig);
41851         orig_conv.is_owned = ptr_is_owned(orig);
41852         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41853         orig_conv.is_owned = false;
41854         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
41855         uint64_t ret_ref = 0;
41856         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41857         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41858         return ret_ref;
41859 }
41860
41861 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) {
41862         void* fee_est_ptr = untag_ptr(fee_est);
41863         CHECK_ACCESS(fee_est_ptr);
41864         LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
41865         if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
41866                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41867                 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
41868         }
41869         void* chain_monitor_ptr = untag_ptr(chain_monitor);
41870         CHECK_ACCESS(chain_monitor_ptr);
41871         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
41872         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
41873                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41874                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
41875         }
41876         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
41877         CHECK_ACCESS(tx_broadcaster_ptr);
41878         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
41879         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
41880                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41881                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
41882         }
41883         void* router_ptr = untag_ptr(router);
41884         CHECK_ACCESS(router_ptr);
41885         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
41886         if (router_conv.free == LDKRouter_JCalls_free) {
41887                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41888                 LDKRouter_JCalls_cloned(&router_conv);
41889         }
41890         void* logger_ptr = untag_ptr(logger);
41891         CHECK_ACCESS(logger_ptr);
41892         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
41893         if (logger_conv.free == LDKLogger_JCalls_free) {
41894                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41895                 LDKLogger_JCalls_cloned(&logger_conv);
41896         }
41897         void* entropy_source_ptr = untag_ptr(entropy_source);
41898         CHECK_ACCESS(entropy_source_ptr);
41899         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
41900         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
41901                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41902                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
41903         }
41904         void* node_signer_ptr = untag_ptr(node_signer);
41905         CHECK_ACCESS(node_signer_ptr);
41906         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
41907         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
41908                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41909                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
41910         }
41911         void* signer_provider_ptr = untag_ptr(signer_provider);
41912         CHECK_ACCESS(signer_provider_ptr);
41913         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
41914         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
41915                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41916                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
41917         }
41918         LDKUserConfig config_conv;
41919         config_conv.inner = untag_ptr(config);
41920         config_conv.is_owned = ptr_is_owned(config);
41921         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
41922         config_conv = UserConfig_clone(&config_conv);
41923         LDKChainParameters params_conv;
41924         params_conv.inner = untag_ptr(params);
41925         params_conv.is_owned = ptr_is_owned(params);
41926         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
41927         params_conv = ChainParameters_clone(&params_conv);
41928         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);
41929         uint64_t ret_ref = 0;
41930         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41931         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41932         return ret_ref;
41933 }
41934
41935 uint64_t  __attribute__((export_name("TS_ChannelManager_get_current_default_configuration"))) TS_ChannelManager_get_current_default_configuration(uint64_t this_arg) {
41936         LDKChannelManager this_arg_conv;
41937         this_arg_conv.inner = untag_ptr(this_arg);
41938         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41940         this_arg_conv.is_owned = false;
41941         LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
41942         uint64_t ret_ref = 0;
41943         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41944         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41945         return ret_ref;
41946 }
41947
41948 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) {
41949         LDKChannelManager this_arg_conv;
41950         this_arg_conv.inner = untag_ptr(this_arg);
41951         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41953         this_arg_conv.is_owned = false;
41954         LDKPublicKey their_network_key_ref;
41955         CHECK(their_network_key->arr_len == 33);
41956         memcpy(their_network_key_ref.compressed_form, their_network_key->elems, 33); FREE(their_network_key);
41957         LDKU128 user_channel_id_ref;
41958         CHECK(user_channel_id->arr_len == 16);
41959         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
41960         LDKChannelId temporary_channel_id_conv;
41961         temporary_channel_id_conv.inner = untag_ptr(temporary_channel_id);
41962         temporary_channel_id_conv.is_owned = ptr_is_owned(temporary_channel_id);
41963         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_conv);
41964         temporary_channel_id_conv = ChannelId_clone(&temporary_channel_id_conv);
41965         LDKUserConfig override_config_conv;
41966         override_config_conv.inner = untag_ptr(override_config);
41967         override_config_conv.is_owned = ptr_is_owned(override_config);
41968         CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
41969         override_config_conv = UserConfig_clone(&override_config_conv);
41970         LDKCResult_ChannelIdAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdAPIErrorZ), "LDKCResult_ChannelIdAPIErrorZ");
41971         *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);
41972         return tag_ptr(ret_conv, true);
41973 }
41974
41975 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_channels"))) TS_ChannelManager_list_channels(uint64_t this_arg) {
41976         LDKChannelManager this_arg_conv;
41977         this_arg_conv.inner = untag_ptr(this_arg);
41978         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41980         this_arg_conv.is_owned = false;
41981         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
41982         uint64_tArray ret_arr = NULL;
41983         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
41984         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
41985         for (size_t q = 0; q < ret_var.datalen; q++) {
41986                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
41987                 uint64_t ret_conv_16_ref = 0;
41988                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
41989                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
41990                 ret_arr_ptr[q] = ret_conv_16_ref;
41991         }
41992         
41993         FREE(ret_var.data);
41994         return ret_arr;
41995 }
41996
41997 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_usable_channels"))) TS_ChannelManager_list_usable_channels(uint64_t this_arg) {
41998         LDKChannelManager this_arg_conv;
41999         this_arg_conv.inner = untag_ptr(this_arg);
42000         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42002         this_arg_conv.is_owned = false;
42003         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
42004         uint64_tArray ret_arr = NULL;
42005         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
42006         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
42007         for (size_t q = 0; q < ret_var.datalen; q++) {
42008                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
42009                 uint64_t ret_conv_16_ref = 0;
42010                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
42011                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
42012                 ret_arr_ptr[q] = ret_conv_16_ref;
42013         }
42014         
42015         FREE(ret_var.data);
42016         return ret_arr;
42017 }
42018
42019 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) {
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         LDKPublicKey counterparty_node_id_ref;
42026         CHECK(counterparty_node_id->arr_len == 33);
42027         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
42028         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels_with_counterparty(&this_arg_conv, counterparty_node_id_ref);
42029         uint64_tArray ret_arr = NULL;
42030         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
42031         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
42032         for (size_t q = 0; q < ret_var.datalen; q++) {
42033                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
42034                 uint64_t ret_conv_16_ref = 0;
42035                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
42036                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
42037                 ret_arr_ptr[q] = ret_conv_16_ref;
42038         }
42039         
42040         FREE(ret_var.data);
42041         return ret_arr;
42042 }
42043
42044 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_recent_payments"))) TS_ChannelManager_list_recent_payments(uint64_t this_arg) {
42045         LDKChannelManager this_arg_conv;
42046         this_arg_conv.inner = untag_ptr(this_arg);
42047         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42049         this_arg_conv.is_owned = false;
42050         LDKCVec_RecentPaymentDetailsZ ret_var = ChannelManager_list_recent_payments(&this_arg_conv);
42051         uint64_tArray ret_arr = NULL;
42052         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
42053         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
42054         for (size_t w = 0; w < ret_var.datalen; w++) {
42055                 LDKRecentPaymentDetails *ret_conv_22_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
42056                 *ret_conv_22_copy = ret_var.data[w];
42057                 uint64_t ret_conv_22_ref = tag_ptr(ret_conv_22_copy, true);
42058                 ret_arr_ptr[w] = ret_conv_22_ref;
42059         }
42060         
42061         FREE(ret_var.data);
42062         return ret_arr;
42063 }
42064
42065 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) {
42066         LDKChannelManager this_arg_conv;
42067         this_arg_conv.inner = untag_ptr(this_arg);
42068         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42070         this_arg_conv.is_owned = false;
42071         LDKChannelId channel_id_conv;
42072         channel_id_conv.inner = untag_ptr(channel_id);
42073         channel_id_conv.is_owned = ptr_is_owned(channel_id);
42074         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
42075         channel_id_conv.is_owned = false;
42076         LDKPublicKey counterparty_node_id_ref;
42077         CHECK(counterparty_node_id->arr_len == 33);
42078         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
42079         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
42080         *ret_conv = ChannelManager_close_channel(&this_arg_conv, &channel_id_conv, counterparty_node_id_ref);
42081         return tag_ptr(ret_conv, true);
42082 }
42083
42084 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) {
42085         LDKChannelManager this_arg_conv;
42086         this_arg_conv.inner = untag_ptr(this_arg);
42087         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42089         this_arg_conv.is_owned = false;
42090         LDKChannelId channel_id_conv;
42091         channel_id_conv.inner = untag_ptr(channel_id);
42092         channel_id_conv.is_owned = ptr_is_owned(channel_id);
42093         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
42094         channel_id_conv.is_owned = false;
42095         LDKPublicKey counterparty_node_id_ref;
42096         CHECK(counterparty_node_id->arr_len == 33);
42097         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
42098         void* target_feerate_sats_per_1000_weight_ptr = untag_ptr(target_feerate_sats_per_1000_weight);
42099         CHECK_ACCESS(target_feerate_sats_per_1000_weight_ptr);
42100         LDKCOption_u32Z target_feerate_sats_per_1000_weight_conv = *(LDKCOption_u32Z*)(target_feerate_sats_per_1000_weight_ptr);
42101         target_feerate_sats_per_1000_weight_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(target_feerate_sats_per_1000_weight));
42102         LDKShutdownScript shutdown_script_conv;
42103         shutdown_script_conv.inner = untag_ptr(shutdown_script);
42104         shutdown_script_conv.is_owned = ptr_is_owned(shutdown_script);
42105         CHECK_INNER_FIELD_ACCESS_OR_NULL(shutdown_script_conv);
42106         shutdown_script_conv = ShutdownScript_clone(&shutdown_script_conv);
42107         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
42108         *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);
42109         return tag_ptr(ret_conv, true);
42110 }
42111
42112 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) {
42113         LDKChannelManager this_arg_conv;
42114         this_arg_conv.inner = untag_ptr(this_arg);
42115         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42117         this_arg_conv.is_owned = false;
42118         LDKChannelId channel_id_conv;
42119         channel_id_conv.inner = untag_ptr(channel_id);
42120         channel_id_conv.is_owned = ptr_is_owned(channel_id);
42121         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
42122         channel_id_conv.is_owned = false;
42123         LDKPublicKey counterparty_node_id_ref;
42124         CHECK(counterparty_node_id->arr_len == 33);
42125         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
42126         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
42127         *ret_conv = ChannelManager_force_close_broadcasting_latest_txn(&this_arg_conv, &channel_id_conv, counterparty_node_id_ref);
42128         return tag_ptr(ret_conv, true);
42129 }
42130
42131 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) {
42132         LDKChannelManager this_arg_conv;
42133         this_arg_conv.inner = untag_ptr(this_arg);
42134         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42136         this_arg_conv.is_owned = false;
42137         LDKChannelId channel_id_conv;
42138         channel_id_conv.inner = untag_ptr(channel_id);
42139         channel_id_conv.is_owned = ptr_is_owned(channel_id);
42140         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
42141         channel_id_conv.is_owned = false;
42142         LDKPublicKey counterparty_node_id_ref;
42143         CHECK(counterparty_node_id->arr_len == 33);
42144         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
42145         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
42146         *ret_conv = ChannelManager_force_close_without_broadcasting_txn(&this_arg_conv, &channel_id_conv, counterparty_node_id_ref);
42147         return tag_ptr(ret_conv, true);
42148 }
42149
42150 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) {
42151         LDKChannelManager this_arg_conv;
42152         this_arg_conv.inner = untag_ptr(this_arg);
42153         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42155         this_arg_conv.is_owned = false;
42156         ChannelManager_force_close_all_channels_broadcasting_latest_txn(&this_arg_conv);
42157 }
42158
42159 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) {
42160         LDKChannelManager this_arg_conv;
42161         this_arg_conv.inner = untag_ptr(this_arg);
42162         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42164         this_arg_conv.is_owned = false;
42165         ChannelManager_force_close_all_channels_without_broadcasting_txn(&this_arg_conv);
42166 }
42167
42168 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) {
42169         LDKChannelManager this_arg_conv;
42170         this_arg_conv.inner = untag_ptr(this_arg);
42171         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42173         this_arg_conv.is_owned = false;
42174         LDKRoute route_conv;
42175         route_conv.inner = untag_ptr(route);
42176         route_conv.is_owned = ptr_is_owned(route);
42177         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
42178         route_conv.is_owned = false;
42179         LDKThirtyTwoBytes payment_hash_ref;
42180         CHECK(payment_hash->arr_len == 32);
42181         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
42182         LDKRecipientOnionFields recipient_onion_conv;
42183         recipient_onion_conv.inner = untag_ptr(recipient_onion);
42184         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
42185         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
42186         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
42187         LDKThirtyTwoBytes payment_id_ref;
42188         CHECK(payment_id->arr_len == 32);
42189         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
42190         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
42191         *ret_conv = ChannelManager_send_payment_with_route(&this_arg_conv, &route_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref);
42192         return tag_ptr(ret_conv, true);
42193 }
42194
42195 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) {
42196         LDKChannelManager this_arg_conv;
42197         this_arg_conv.inner = untag_ptr(this_arg);
42198         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42200         this_arg_conv.is_owned = false;
42201         LDKThirtyTwoBytes payment_hash_ref;
42202         CHECK(payment_hash->arr_len == 32);
42203         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
42204         LDKRecipientOnionFields recipient_onion_conv;
42205         recipient_onion_conv.inner = untag_ptr(recipient_onion);
42206         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
42207         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
42208         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
42209         LDKThirtyTwoBytes payment_id_ref;
42210         CHECK(payment_id->arr_len == 32);
42211         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
42212         LDKRouteParameters route_params_conv;
42213         route_params_conv.inner = untag_ptr(route_params);
42214         route_params_conv.is_owned = ptr_is_owned(route_params);
42215         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
42216         route_params_conv = RouteParameters_clone(&route_params_conv);
42217         void* retry_strategy_ptr = untag_ptr(retry_strategy);
42218         CHECK_ACCESS(retry_strategy_ptr);
42219         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
42220         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
42221         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
42222         *ret_conv = ChannelManager_send_payment(&this_arg_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref, route_params_conv, retry_strategy_conv);
42223         return tag_ptr(ret_conv, true);
42224 }
42225
42226 void  __attribute__((export_name("TS_ChannelManager_abandon_payment"))) TS_ChannelManager_abandon_payment(uint64_t this_arg, int8_tArray payment_id) {
42227         LDKChannelManager this_arg_conv;
42228         this_arg_conv.inner = untag_ptr(this_arg);
42229         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42231         this_arg_conv.is_owned = false;
42232         LDKThirtyTwoBytes payment_id_ref;
42233         CHECK(payment_id->arr_len == 32);
42234         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
42235         ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
42236 }
42237
42238 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) {
42239         LDKChannelManager this_arg_conv;
42240         this_arg_conv.inner = untag_ptr(this_arg);
42241         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42243         this_arg_conv.is_owned = false;
42244         LDKRoute route_conv;
42245         route_conv.inner = untag_ptr(route);
42246         route_conv.is_owned = ptr_is_owned(route);
42247         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
42248         route_conv.is_owned = false;
42249         void* payment_preimage_ptr = untag_ptr(payment_preimage);
42250         CHECK_ACCESS(payment_preimage_ptr);
42251         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
42252         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
42253         LDKRecipientOnionFields recipient_onion_conv;
42254         recipient_onion_conv.inner = untag_ptr(recipient_onion);
42255         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
42256         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
42257         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
42258         LDKThirtyTwoBytes payment_id_ref;
42259         CHECK(payment_id->arr_len == 32);
42260         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
42261         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
42262         *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_conv, recipient_onion_conv, payment_id_ref);
42263         return tag_ptr(ret_conv, true);
42264 }
42265
42266 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) {
42267         LDKChannelManager this_arg_conv;
42268         this_arg_conv.inner = untag_ptr(this_arg);
42269         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42271         this_arg_conv.is_owned = false;
42272         void* payment_preimage_ptr = untag_ptr(payment_preimage);
42273         CHECK_ACCESS(payment_preimage_ptr);
42274         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
42275         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
42276         LDKRecipientOnionFields recipient_onion_conv;
42277         recipient_onion_conv.inner = untag_ptr(recipient_onion);
42278         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
42279         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
42280         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
42281         LDKThirtyTwoBytes payment_id_ref;
42282         CHECK(payment_id->arr_len == 32);
42283         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
42284         LDKRouteParameters route_params_conv;
42285         route_params_conv.inner = untag_ptr(route_params);
42286         route_params_conv.is_owned = ptr_is_owned(route_params);
42287         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
42288         route_params_conv = RouteParameters_clone(&route_params_conv);
42289         void* retry_strategy_ptr = untag_ptr(retry_strategy);
42290         CHECK_ACCESS(retry_strategy_ptr);
42291         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
42292         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
42293         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
42294         *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);
42295         return tag_ptr(ret_conv, true);
42296 }
42297
42298 uint64_t  __attribute__((export_name("TS_ChannelManager_send_probe"))) TS_ChannelManager_send_probe(uint64_t this_arg, uint64_t path) {
42299         LDKChannelManager this_arg_conv;
42300         this_arg_conv.inner = untag_ptr(this_arg);
42301         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42303         this_arg_conv.is_owned = false;
42304         LDKPath path_conv;
42305         path_conv.inner = untag_ptr(path);
42306         path_conv.is_owned = ptr_is_owned(path);
42307         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
42308         path_conv = Path_clone(&path_conv);
42309         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
42310         *ret_conv = ChannelManager_send_probe(&this_arg_conv, path_conv);
42311         return tag_ptr(ret_conv, true);
42312 }
42313
42314 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) {
42315         LDKChannelManager this_arg_conv;
42316         this_arg_conv.inner = untag_ptr(this_arg);
42317         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42319         this_arg_conv.is_owned = false;
42320         LDKPublicKey node_id_ref;
42321         CHECK(node_id->arr_len == 33);
42322         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
42323         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
42324         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
42325         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
42326         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
42327         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
42328         *ret_conv = ChannelManager_send_spontaneous_preflight_probes(&this_arg_conv, node_id_ref, amount_msat, final_cltv_expiry_delta, liquidity_limit_multiplier_conv);
42329         return tag_ptr(ret_conv, true);
42330 }
42331
42332 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) {
42333         LDKChannelManager this_arg_conv;
42334         this_arg_conv.inner = untag_ptr(this_arg);
42335         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42337         this_arg_conv.is_owned = false;
42338         LDKRouteParameters route_params_conv;
42339         route_params_conv.inner = untag_ptr(route_params);
42340         route_params_conv.is_owned = ptr_is_owned(route_params);
42341         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
42342         route_params_conv = RouteParameters_clone(&route_params_conv);
42343         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
42344         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
42345         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
42346         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
42347         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
42348         *ret_conv = ChannelManager_send_preflight_probes(&this_arg_conv, route_params_conv, liquidity_limit_multiplier_conv);
42349         return tag_ptr(ret_conv, true);
42350 }
42351
42352 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) {
42353         LDKChannelManager this_arg_conv;
42354         this_arg_conv.inner = untag_ptr(this_arg);
42355         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42357         this_arg_conv.is_owned = false;
42358         LDKChannelId temporary_channel_id_conv;
42359         temporary_channel_id_conv.inner = untag_ptr(temporary_channel_id);
42360         temporary_channel_id_conv.is_owned = ptr_is_owned(temporary_channel_id);
42361         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_conv);
42362         temporary_channel_id_conv.is_owned = false;
42363         LDKPublicKey counterparty_node_id_ref;
42364         CHECK(counterparty_node_id->arr_len == 33);
42365         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
42366         LDKTransaction funding_transaction_ref;
42367         funding_transaction_ref.datalen = funding_transaction->arr_len;
42368         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
42369         memcpy(funding_transaction_ref.data, funding_transaction->elems, funding_transaction_ref.datalen); FREE(funding_transaction);
42370         funding_transaction_ref.data_is_owned = true;
42371         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
42372         *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, &temporary_channel_id_conv, counterparty_node_id_ref, funding_transaction_ref);
42373         return tag_ptr(ret_conv, true);
42374 }
42375
42376 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) {
42377         LDKChannelManager this_arg_conv;
42378         this_arg_conv.inner = untag_ptr(this_arg);
42379         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42381         this_arg_conv.is_owned = false;
42382         LDKCVec_C2Tuple_ChannelIdPublicKeyZZ temporary_channels_constr;
42383         temporary_channels_constr.datalen = temporary_channels->arr_len;
42384         if (temporary_channels_constr.datalen > 0)
42385                 temporary_channels_constr.data = MALLOC(temporary_channels_constr.datalen * sizeof(LDKC2Tuple_ChannelIdPublicKeyZ), "LDKCVec_C2Tuple_ChannelIdPublicKeyZZ Elements");
42386         else
42387                 temporary_channels_constr.data = NULL;
42388         uint64_t* temporary_channels_vals = temporary_channels->elems;
42389         for (size_t e = 0; e < temporary_channels_constr.datalen; e++) {
42390                 uint64_t temporary_channels_conv_30 = temporary_channels_vals[e];
42391                 void* temporary_channels_conv_30_ptr = untag_ptr(temporary_channels_conv_30);
42392                 CHECK_ACCESS(temporary_channels_conv_30_ptr);
42393                 LDKC2Tuple_ChannelIdPublicKeyZ temporary_channels_conv_30_conv = *(LDKC2Tuple_ChannelIdPublicKeyZ*)(temporary_channels_conv_30_ptr);
42394                 temporary_channels_conv_30_conv = C2Tuple_ChannelIdPublicKeyZ_clone((LDKC2Tuple_ChannelIdPublicKeyZ*)untag_ptr(temporary_channels_conv_30));
42395                 temporary_channels_constr.data[e] = temporary_channels_conv_30_conv;
42396         }
42397         FREE(temporary_channels);
42398         LDKTransaction funding_transaction_ref;
42399         funding_transaction_ref.datalen = funding_transaction->arr_len;
42400         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
42401         memcpy(funding_transaction_ref.data, funding_transaction->elems, funding_transaction_ref.datalen); FREE(funding_transaction);
42402         funding_transaction_ref.data_is_owned = true;
42403         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
42404         *ret_conv = ChannelManager_batch_funding_transaction_generated(&this_arg_conv, temporary_channels_constr, funding_transaction_ref);
42405         return tag_ptr(ret_conv, true);
42406 }
42407
42408 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) {
42409         LDKChannelManager this_arg_conv;
42410         this_arg_conv.inner = untag_ptr(this_arg);
42411         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42413         this_arg_conv.is_owned = false;
42414         LDKPublicKey counterparty_node_id_ref;
42415         CHECK(counterparty_node_id->arr_len == 33);
42416         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
42417         LDKCVec_ChannelIdZ channel_ids_constr;
42418         channel_ids_constr.datalen = channel_ids->arr_len;
42419         if (channel_ids_constr.datalen > 0)
42420                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKChannelId), "LDKCVec_ChannelIdZ Elements");
42421         else
42422                 channel_ids_constr.data = NULL;
42423         uint64_t* channel_ids_vals = channel_ids->elems;
42424         for (size_t l = 0; l < channel_ids_constr.datalen; l++) {
42425                 uint64_t channel_ids_conv_11 = channel_ids_vals[l];
42426                 LDKChannelId channel_ids_conv_11_conv;
42427                 channel_ids_conv_11_conv.inner = untag_ptr(channel_ids_conv_11);
42428                 channel_ids_conv_11_conv.is_owned = ptr_is_owned(channel_ids_conv_11);
42429                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_ids_conv_11_conv);
42430                 channel_ids_conv_11_conv = ChannelId_clone(&channel_ids_conv_11_conv);
42431                 channel_ids_constr.data[l] = channel_ids_conv_11_conv;
42432         }
42433         FREE(channel_ids);
42434         LDKChannelConfigUpdate config_update_conv;
42435         config_update_conv.inner = untag_ptr(config_update);
42436         config_update_conv.is_owned = ptr_is_owned(config_update);
42437         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_update_conv);
42438         config_update_conv.is_owned = false;
42439         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
42440         *ret_conv = ChannelManager_update_partial_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_update_conv);
42441         return tag_ptr(ret_conv, true);
42442 }
42443
42444 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) {
42445         LDKChannelManager this_arg_conv;
42446         this_arg_conv.inner = untag_ptr(this_arg);
42447         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42449         this_arg_conv.is_owned = false;
42450         LDKPublicKey counterparty_node_id_ref;
42451         CHECK(counterparty_node_id->arr_len == 33);
42452         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
42453         LDKCVec_ChannelIdZ channel_ids_constr;
42454         channel_ids_constr.datalen = channel_ids->arr_len;
42455         if (channel_ids_constr.datalen > 0)
42456                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKChannelId), "LDKCVec_ChannelIdZ Elements");
42457         else
42458                 channel_ids_constr.data = NULL;
42459         uint64_t* channel_ids_vals = channel_ids->elems;
42460         for (size_t l = 0; l < channel_ids_constr.datalen; l++) {
42461                 uint64_t channel_ids_conv_11 = channel_ids_vals[l];
42462                 LDKChannelId channel_ids_conv_11_conv;
42463                 channel_ids_conv_11_conv.inner = untag_ptr(channel_ids_conv_11);
42464                 channel_ids_conv_11_conv.is_owned = ptr_is_owned(channel_ids_conv_11);
42465                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_ids_conv_11_conv);
42466                 channel_ids_conv_11_conv = ChannelId_clone(&channel_ids_conv_11_conv);
42467                 channel_ids_constr.data[l] = channel_ids_conv_11_conv;
42468         }
42469         FREE(channel_ids);
42470         LDKChannelConfig config_conv;
42471         config_conv.inner = untag_ptr(config);
42472         config_conv.is_owned = ptr_is_owned(config);
42473         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
42474         config_conv.is_owned = false;
42475         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
42476         *ret_conv = ChannelManager_update_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_conv);
42477         return tag_ptr(ret_conv, true);
42478 }
42479
42480 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) {
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         LDKThirtyTwoBytes intercept_id_ref;
42487         CHECK(intercept_id->arr_len == 32);
42488         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
42489         LDKChannelId next_hop_channel_id_conv;
42490         next_hop_channel_id_conv.inner = untag_ptr(next_hop_channel_id);
42491         next_hop_channel_id_conv.is_owned = ptr_is_owned(next_hop_channel_id);
42492         CHECK_INNER_FIELD_ACCESS_OR_NULL(next_hop_channel_id_conv);
42493         next_hop_channel_id_conv.is_owned = false;
42494         LDKPublicKey next_node_id_ref;
42495         CHECK(next_node_id->arr_len == 33);
42496         memcpy(next_node_id_ref.compressed_form, next_node_id->elems, 33); FREE(next_node_id);
42497         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
42498         *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);
42499         return tag_ptr(ret_conv, true);
42500 }
42501
42502 uint64_t  __attribute__((export_name("TS_ChannelManager_fail_intercepted_htlc"))) TS_ChannelManager_fail_intercepted_htlc(uint64_t this_arg, int8_tArray intercept_id) {
42503         LDKChannelManager this_arg_conv;
42504         this_arg_conv.inner = untag_ptr(this_arg);
42505         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42507         this_arg_conv.is_owned = false;
42508         LDKThirtyTwoBytes intercept_id_ref;
42509         CHECK(intercept_id->arr_len == 32);
42510         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
42511         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
42512         *ret_conv = ChannelManager_fail_intercepted_htlc(&this_arg_conv, intercept_id_ref);
42513         return tag_ptr(ret_conv, true);
42514 }
42515
42516 void  __attribute__((export_name("TS_ChannelManager_process_pending_htlc_forwards"))) TS_ChannelManager_process_pending_htlc_forwards(uint64_t this_arg) {
42517         LDKChannelManager this_arg_conv;
42518         this_arg_conv.inner = untag_ptr(this_arg);
42519         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42521         this_arg_conv.is_owned = false;
42522         ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
42523 }
42524
42525 void  __attribute__((export_name("TS_ChannelManager_timer_tick_occurred"))) TS_ChannelManager_timer_tick_occurred(uint64_t this_arg) {
42526         LDKChannelManager this_arg_conv;
42527         this_arg_conv.inner = untag_ptr(this_arg);
42528         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42530         this_arg_conv.is_owned = false;
42531         ChannelManager_timer_tick_occurred(&this_arg_conv);
42532 }
42533
42534 void  __attribute__((export_name("TS_ChannelManager_fail_htlc_backwards"))) TS_ChannelManager_fail_htlc_backwards(uint64_t this_arg, int8_tArray payment_hash) {
42535         LDKChannelManager this_arg_conv;
42536         this_arg_conv.inner = untag_ptr(this_arg);
42537         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42539         this_arg_conv.is_owned = false;
42540         uint8_t payment_hash_arr[32];
42541         CHECK(payment_hash->arr_len == 32);
42542         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
42543         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
42544         ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
42545 }
42546
42547 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) {
42548         LDKChannelManager this_arg_conv;
42549         this_arg_conv.inner = untag_ptr(this_arg);
42550         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42552         this_arg_conv.is_owned = false;
42553         uint8_t payment_hash_arr[32];
42554         CHECK(payment_hash->arr_len == 32);
42555         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
42556         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
42557         void* failure_code_ptr = untag_ptr(failure_code);
42558         CHECK_ACCESS(failure_code_ptr);
42559         LDKFailureCode failure_code_conv = *(LDKFailureCode*)(failure_code_ptr);
42560         failure_code_conv = FailureCode_clone((LDKFailureCode*)untag_ptr(failure_code));
42561         ChannelManager_fail_htlc_backwards_with_reason(&this_arg_conv, payment_hash_ref, failure_code_conv);
42562 }
42563
42564 void  __attribute__((export_name("TS_ChannelManager_claim_funds"))) TS_ChannelManager_claim_funds(uint64_t this_arg, int8_tArray payment_preimage) {
42565         LDKChannelManager this_arg_conv;
42566         this_arg_conv.inner = untag_ptr(this_arg);
42567         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42569         this_arg_conv.is_owned = false;
42570         LDKThirtyTwoBytes payment_preimage_ref;
42571         CHECK(payment_preimage->arr_len == 32);
42572         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
42573         ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
42574 }
42575
42576 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) {
42577         LDKChannelManager this_arg_conv;
42578         this_arg_conv.inner = untag_ptr(this_arg);
42579         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42581         this_arg_conv.is_owned = false;
42582         LDKThirtyTwoBytes payment_preimage_ref;
42583         CHECK(payment_preimage->arr_len == 32);
42584         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
42585         ChannelManager_claim_funds_with_known_custom_tlvs(&this_arg_conv, payment_preimage_ref);
42586 }
42587
42588 int8_tArray  __attribute__((export_name("TS_ChannelManager_get_our_node_id"))) TS_ChannelManager_get_our_node_id(uint64_t this_arg) {
42589         LDKChannelManager this_arg_conv;
42590         this_arg_conv.inner = untag_ptr(this_arg);
42591         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42593         this_arg_conv.is_owned = false;
42594         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42595         memcpy(ret_arr->elems, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
42596         return ret_arr;
42597 }
42598
42599 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) {
42600         LDKChannelManager this_arg_conv;
42601         this_arg_conv.inner = untag_ptr(this_arg);
42602         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42604         this_arg_conv.is_owned = false;
42605         LDKChannelId temporary_channel_id_conv;
42606         temporary_channel_id_conv.inner = untag_ptr(temporary_channel_id);
42607         temporary_channel_id_conv.is_owned = ptr_is_owned(temporary_channel_id);
42608         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_conv);
42609         temporary_channel_id_conv.is_owned = false;
42610         LDKPublicKey counterparty_node_id_ref;
42611         CHECK(counterparty_node_id->arr_len == 33);
42612         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
42613         LDKU128 user_channel_id_ref;
42614         CHECK(user_channel_id->arr_len == 16);
42615         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
42616         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
42617         *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, &temporary_channel_id_conv, counterparty_node_id_ref, user_channel_id_ref);
42618         return tag_ptr(ret_conv, true);
42619 }
42620
42621 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) {
42622         LDKChannelManager this_arg_conv;
42623         this_arg_conv.inner = untag_ptr(this_arg);
42624         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42626         this_arg_conv.is_owned = false;
42627         LDKChannelId temporary_channel_id_conv;
42628         temporary_channel_id_conv.inner = untag_ptr(temporary_channel_id);
42629         temporary_channel_id_conv.is_owned = ptr_is_owned(temporary_channel_id);
42630         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_conv);
42631         temporary_channel_id_conv.is_owned = false;
42632         LDKPublicKey counterparty_node_id_ref;
42633         CHECK(counterparty_node_id->arr_len == 33);
42634         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
42635         LDKU128 user_channel_id_ref;
42636         CHECK(user_channel_id->arr_len == 16);
42637         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
42638         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
42639         *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);
42640         return tag_ptr(ret_conv, true);
42641 }
42642
42643 uint64_t  __attribute__((export_name("TS_ChannelManager_create_offer_builder"))) TS_ChannelManager_create_offer_builder(uint64_t this_arg) {
42644         LDKChannelManager this_arg_conv;
42645         this_arg_conv.inner = untag_ptr(this_arg);
42646         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42648         this_arg_conv.is_owned = false;
42649         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ");
42650         *ret_conv = ChannelManager_create_offer_builder(&this_arg_conv);
42651         return tag_ptr(ret_conv, true);
42652 }
42653
42654 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) {
42655         LDKChannelManager this_arg_conv;
42656         this_arg_conv.inner = untag_ptr(this_arg);
42657         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42659         this_arg_conv.is_owned = false;
42660         LDKThirtyTwoBytes payment_id_ref;
42661         CHECK(payment_id->arr_len == 32);
42662         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
42663         void* retry_strategy_ptr = untag_ptr(retry_strategy);
42664         CHECK_ACCESS(retry_strategy_ptr);
42665         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
42666         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
42667         void* max_total_routing_fee_msat_ptr = untag_ptr(max_total_routing_fee_msat);
42668         CHECK_ACCESS(max_total_routing_fee_msat_ptr);
42669         LDKCOption_u64Z max_total_routing_fee_msat_conv = *(LDKCOption_u64Z*)(max_total_routing_fee_msat_ptr);
42670         max_total_routing_fee_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(max_total_routing_fee_msat));
42671         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
42672         *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);
42673         return tag_ptr(ret_conv, true);
42674 }
42675
42676 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) {
42677         LDKChannelManager this_arg_conv;
42678         this_arg_conv.inner = untag_ptr(this_arg);
42679         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42681         this_arg_conv.is_owned = false;
42682         LDKOffer offer_conv;
42683         offer_conv.inner = untag_ptr(offer);
42684         offer_conv.is_owned = ptr_is_owned(offer);
42685         CHECK_INNER_FIELD_ACCESS_OR_NULL(offer_conv);
42686         offer_conv.is_owned = false;
42687         void* quantity_ptr = untag_ptr(quantity);
42688         CHECK_ACCESS(quantity_ptr);
42689         LDKCOption_u64Z quantity_conv = *(LDKCOption_u64Z*)(quantity_ptr);
42690         quantity_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(quantity));
42691         void* amount_msats_ptr = untag_ptr(amount_msats);
42692         CHECK_ACCESS(amount_msats_ptr);
42693         LDKCOption_u64Z amount_msats_conv = *(LDKCOption_u64Z*)(amount_msats_ptr);
42694         amount_msats_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amount_msats));
42695         void* payer_note_ptr = untag_ptr(payer_note);
42696         CHECK_ACCESS(payer_note_ptr);
42697         LDKCOption_StrZ payer_note_conv = *(LDKCOption_StrZ*)(payer_note_ptr);
42698         payer_note_conv = COption_StrZ_clone((LDKCOption_StrZ*)untag_ptr(payer_note));
42699         LDKThirtyTwoBytes payment_id_ref;
42700         CHECK(payment_id->arr_len == 32);
42701         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
42702         void* retry_strategy_ptr = untag_ptr(retry_strategy);
42703         CHECK_ACCESS(retry_strategy_ptr);
42704         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
42705         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
42706         void* max_total_routing_fee_msat_ptr = untag_ptr(max_total_routing_fee_msat);
42707         CHECK_ACCESS(max_total_routing_fee_msat_ptr);
42708         LDKCOption_u64Z max_total_routing_fee_msat_conv = *(LDKCOption_u64Z*)(max_total_routing_fee_msat_ptr);
42709         max_total_routing_fee_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(max_total_routing_fee_msat));
42710         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
42711         *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);
42712         return tag_ptr(ret_conv, true);
42713 }
42714
42715 uint64_t  __attribute__((export_name("TS_ChannelManager_request_refund_payment"))) TS_ChannelManager_request_refund_payment(uint64_t this_arg, uint64_t refund) {
42716         LDKChannelManager this_arg_conv;
42717         this_arg_conv.inner = untag_ptr(this_arg);
42718         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42720         this_arg_conv.is_owned = false;
42721         LDKRefund refund_conv;
42722         refund_conv.inner = untag_ptr(refund);
42723         refund_conv.is_owned = ptr_is_owned(refund);
42724         CHECK_INNER_FIELD_ACCESS_OR_NULL(refund_conv);
42725         refund_conv.is_owned = false;
42726         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ");
42727         *ret_conv = ChannelManager_request_refund_payment(&this_arg_conv, &refund_conv);
42728         return tag_ptr(ret_conv, true);
42729 }
42730
42731 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) {
42732         LDKChannelManager this_arg_conv;
42733         this_arg_conv.inner = untag_ptr(this_arg);
42734         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42736         this_arg_conv.is_owned = false;
42737         void* min_value_msat_ptr = untag_ptr(min_value_msat);
42738         CHECK_ACCESS(min_value_msat_ptr);
42739         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
42740         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
42741         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
42742         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
42743         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
42744         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
42745         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
42746         *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv);
42747         return tag_ptr(ret_conv, true);
42748 }
42749
42750 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) {
42751         LDKChannelManager this_arg_conv;
42752         this_arg_conv.inner = untag_ptr(this_arg);
42753         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42755         this_arg_conv.is_owned = false;
42756         LDKThirtyTwoBytes payment_hash_ref;
42757         CHECK(payment_hash->arr_len == 32);
42758         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
42759         void* min_value_msat_ptr = untag_ptr(min_value_msat);
42760         CHECK_ACCESS(min_value_msat_ptr);
42761         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
42762         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
42763         void* min_final_cltv_expiry_ptr = untag_ptr(min_final_cltv_expiry);
42764         CHECK_ACCESS(min_final_cltv_expiry_ptr);
42765         LDKCOption_u16Z min_final_cltv_expiry_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_ptr);
42766         min_final_cltv_expiry_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry));
42767         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
42768         *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);
42769         return tag_ptr(ret_conv, true);
42770 }
42771
42772 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) {
42773         LDKChannelManager this_arg_conv;
42774         this_arg_conv.inner = untag_ptr(this_arg);
42775         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42777         this_arg_conv.is_owned = false;
42778         LDKThirtyTwoBytes payment_hash_ref;
42779         CHECK(payment_hash->arr_len == 32);
42780         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
42781         LDKThirtyTwoBytes payment_secret_ref;
42782         CHECK(payment_secret->arr_len == 32);
42783         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
42784         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
42785         *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
42786         return tag_ptr(ret_conv, true);
42787 }
42788
42789 int64_t  __attribute__((export_name("TS_ChannelManager_get_phantom_scid"))) TS_ChannelManager_get_phantom_scid(uint64_t this_arg) {
42790         LDKChannelManager this_arg_conv;
42791         this_arg_conv.inner = untag_ptr(this_arg);
42792         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42794         this_arg_conv.is_owned = false;
42795         int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
42796         return ret_conv;
42797 }
42798
42799 uint64_t  __attribute__((export_name("TS_ChannelManager_get_phantom_route_hints"))) TS_ChannelManager_get_phantom_route_hints(uint64_t this_arg) {
42800         LDKChannelManager this_arg_conv;
42801         this_arg_conv.inner = untag_ptr(this_arg);
42802         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42804         this_arg_conv.is_owned = false;
42805         LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
42806         uint64_t ret_ref = 0;
42807         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42808         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42809         return ret_ref;
42810 }
42811
42812 int64_t  __attribute__((export_name("TS_ChannelManager_get_intercept_scid"))) TS_ChannelManager_get_intercept_scid(uint64_t this_arg) {
42813         LDKChannelManager this_arg_conv;
42814         this_arg_conv.inner = untag_ptr(this_arg);
42815         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42817         this_arg_conv.is_owned = false;
42818         int64_t ret_conv = ChannelManager_get_intercept_scid(&this_arg_conv);
42819         return ret_conv;
42820 }
42821
42822 uint64_t  __attribute__((export_name("TS_ChannelManager_compute_inflight_htlcs"))) TS_ChannelManager_compute_inflight_htlcs(uint64_t this_arg) {
42823         LDKChannelManager this_arg_conv;
42824         this_arg_conv.inner = untag_ptr(this_arg);
42825         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42827         this_arg_conv.is_owned = false;
42828         LDKInFlightHtlcs ret_var = ChannelManager_compute_inflight_htlcs(&this_arg_conv);
42829         uint64_t ret_ref = 0;
42830         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42831         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42832         return ret_ref;
42833 }
42834
42835 uint64_t  __attribute__((export_name("TS_ChannelManager_as_MessageSendEventsProvider"))) TS_ChannelManager_as_MessageSendEventsProvider(uint64_t this_arg) {
42836         LDKChannelManager this_arg_conv;
42837         this_arg_conv.inner = untag_ptr(this_arg);
42838         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42840         this_arg_conv.is_owned = false;
42841         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
42842         *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
42843         return tag_ptr(ret_ret, true);
42844 }
42845
42846 uint64_t  __attribute__((export_name("TS_ChannelManager_as_EventsProvider"))) TS_ChannelManager_as_EventsProvider(uint64_t this_arg) {
42847         LDKChannelManager this_arg_conv;
42848         this_arg_conv.inner = untag_ptr(this_arg);
42849         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42851         this_arg_conv.is_owned = false;
42852         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
42853         *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
42854         return tag_ptr(ret_ret, true);
42855 }
42856
42857 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Listen"))) TS_ChannelManager_as_Listen(uint64_t this_arg) {
42858         LDKChannelManager this_arg_conv;
42859         this_arg_conv.inner = untag_ptr(this_arg);
42860         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42862         this_arg_conv.is_owned = false;
42863         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
42864         *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
42865         return tag_ptr(ret_ret, true);
42866 }
42867
42868 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Confirm"))) TS_ChannelManager_as_Confirm(uint64_t this_arg) {
42869         LDKChannelManager this_arg_conv;
42870         this_arg_conv.inner = untag_ptr(this_arg);
42871         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42873         this_arg_conv.is_owned = false;
42874         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
42875         *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
42876         return tag_ptr(ret_ret, true);
42877 }
42878
42879 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) {
42880         LDKChannelManager this_arg_conv;
42881         this_arg_conv.inner = untag_ptr(this_arg);
42882         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42884         this_arg_conv.is_owned = false;
42885         LDKFuture ret_var = ChannelManager_get_event_or_persistence_needed_future(&this_arg_conv);
42886         uint64_t ret_ref = 0;
42887         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42888         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42889         return ret_ref;
42890 }
42891
42892 jboolean  __attribute__((export_name("TS_ChannelManager_get_and_clear_needs_persistence"))) TS_ChannelManager_get_and_clear_needs_persistence(uint64_t this_arg) {
42893         LDKChannelManager this_arg_conv;
42894         this_arg_conv.inner = untag_ptr(this_arg);
42895         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42897         this_arg_conv.is_owned = false;
42898         jboolean ret_conv = ChannelManager_get_and_clear_needs_persistence(&this_arg_conv);
42899         return ret_conv;
42900 }
42901
42902 uint64_t  __attribute__((export_name("TS_ChannelManager_current_best_block"))) TS_ChannelManager_current_best_block(uint64_t this_arg) {
42903         LDKChannelManager this_arg_conv;
42904         this_arg_conv.inner = untag_ptr(this_arg);
42905         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42907         this_arg_conv.is_owned = false;
42908         LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
42909         uint64_t ret_ref = 0;
42910         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42911         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42912         return ret_ref;
42913 }
42914
42915 uint64_t  __attribute__((export_name("TS_ChannelManager_node_features"))) TS_ChannelManager_node_features(uint64_t this_arg) {
42916         LDKChannelManager this_arg_conv;
42917         this_arg_conv.inner = untag_ptr(this_arg);
42918         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42920         this_arg_conv.is_owned = false;
42921         LDKNodeFeatures ret_var = ChannelManager_node_features(&this_arg_conv);
42922         uint64_t ret_ref = 0;
42923         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42924         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42925         return ret_ref;
42926 }
42927
42928 uint64_t  __attribute__((export_name("TS_ChannelManager_channel_features"))) TS_ChannelManager_channel_features(uint64_t this_arg) {
42929         LDKChannelManager this_arg_conv;
42930         this_arg_conv.inner = untag_ptr(this_arg);
42931         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42933         this_arg_conv.is_owned = false;
42934         LDKChannelFeatures ret_var = ChannelManager_channel_features(&this_arg_conv);
42935         uint64_t ret_ref = 0;
42936         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42937         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42938         return ret_ref;
42939 }
42940
42941 uint64_t  __attribute__((export_name("TS_ChannelManager_channel_type_features"))) TS_ChannelManager_channel_type_features(uint64_t this_arg) {
42942         LDKChannelManager this_arg_conv;
42943         this_arg_conv.inner = untag_ptr(this_arg);
42944         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42946         this_arg_conv.is_owned = false;
42947         LDKChannelTypeFeatures ret_var = ChannelManager_channel_type_features(&this_arg_conv);
42948         uint64_t ret_ref = 0;
42949         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42950         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42951         return ret_ref;
42952 }
42953
42954 uint64_t  __attribute__((export_name("TS_ChannelManager_init_features"))) TS_ChannelManager_init_features(uint64_t this_arg) {
42955         LDKChannelManager this_arg_conv;
42956         this_arg_conv.inner = untag_ptr(this_arg);
42957         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42959         this_arg_conv.is_owned = false;
42960         LDKInitFeatures ret_var = ChannelManager_init_features(&this_arg_conv);
42961         uint64_t ret_ref = 0;
42962         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42963         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42964         return ret_ref;
42965 }
42966
42967 uint64_t  __attribute__((export_name("TS_ChannelManager_as_ChannelMessageHandler"))) TS_ChannelManager_as_ChannelMessageHandler(uint64_t this_arg) {
42968         LDKChannelManager this_arg_conv;
42969         this_arg_conv.inner = untag_ptr(this_arg);
42970         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42972         this_arg_conv.is_owned = false;
42973         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
42974         *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
42975         return tag_ptr(ret_ret, true);
42976 }
42977
42978 uint64_t  __attribute__((export_name("TS_ChannelManager_as_OffersMessageHandler"))) TS_ChannelManager_as_OffersMessageHandler(uint64_t this_arg) {
42979         LDKChannelManager this_arg_conv;
42980         this_arg_conv.inner = untag_ptr(this_arg);
42981         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42983         this_arg_conv.is_owned = false;
42984         LDKOffersMessageHandler* ret_ret = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
42985         *ret_ret = ChannelManager_as_OffersMessageHandler(&this_arg_conv);
42986         return tag_ptr(ret_ret, true);
42987 }
42988
42989 uint64_t  __attribute__((export_name("TS_ChannelManager_as_NodeIdLookUp"))) TS_ChannelManager_as_NodeIdLookUp(uint64_t this_arg) {
42990         LDKChannelManager this_arg_conv;
42991         this_arg_conv.inner = untag_ptr(this_arg);
42992         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42994         this_arg_conv.is_owned = false;
42995         LDKNodeIdLookUp* ret_ret = MALLOC(sizeof(LDKNodeIdLookUp), "LDKNodeIdLookUp");
42996         *ret_ret = ChannelManager_as_NodeIdLookUp(&this_arg_conv);
42997         return tag_ptr(ret_ret, true);
42998 }
42999
43000 uint64_t  __attribute__((export_name("TS_provided_init_features"))) TS_provided_init_features(uint64_t config) {
43001         LDKUserConfig config_conv;
43002         config_conv.inner = untag_ptr(config);
43003         config_conv.is_owned = ptr_is_owned(config);
43004         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
43005         config_conv.is_owned = false;
43006         LDKInitFeatures ret_var = provided_init_features(&config_conv);
43007         uint64_t ret_ref = 0;
43008         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43009         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43010         return ret_ref;
43011 }
43012
43013 int8_tArray  __attribute__((export_name("TS_CounterpartyForwardingInfo_write"))) TS_CounterpartyForwardingInfo_write(uint64_t obj) {
43014         LDKCounterpartyForwardingInfo obj_conv;
43015         obj_conv.inner = untag_ptr(obj);
43016         obj_conv.is_owned = ptr_is_owned(obj);
43017         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43018         obj_conv.is_owned = false;
43019         LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
43020         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43021         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43022         CVec_u8Z_free(ret_var);
43023         return ret_arr;
43024 }
43025
43026 uint64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_read"))) TS_CounterpartyForwardingInfo_read(int8_tArray ser) {
43027         LDKu8slice ser_ref;
43028         ser_ref.datalen = ser->arr_len;
43029         ser_ref.data = ser->elems;
43030         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
43031         *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
43032         FREE(ser);
43033         return tag_ptr(ret_conv, true);
43034 }
43035
43036 int8_tArray  __attribute__((export_name("TS_ChannelCounterparty_write"))) TS_ChannelCounterparty_write(uint64_t obj) {
43037         LDKChannelCounterparty obj_conv;
43038         obj_conv.inner = untag_ptr(obj);
43039         obj_conv.is_owned = ptr_is_owned(obj);
43040         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43041         obj_conv.is_owned = false;
43042         LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
43043         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43044         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43045         CVec_u8Z_free(ret_var);
43046         return ret_arr;
43047 }
43048
43049 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_read"))) TS_ChannelCounterparty_read(int8_tArray ser) {
43050         LDKu8slice ser_ref;
43051         ser_ref.datalen = ser->arr_len;
43052         ser_ref.data = ser->elems;
43053         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
43054         *ret_conv = ChannelCounterparty_read(ser_ref);
43055         FREE(ser);
43056         return tag_ptr(ret_conv, true);
43057 }
43058
43059 int8_tArray  __attribute__((export_name("TS_ChannelDetails_write"))) TS_ChannelDetails_write(uint64_t obj) {
43060         LDKChannelDetails obj_conv;
43061         obj_conv.inner = untag_ptr(obj);
43062         obj_conv.is_owned = ptr_is_owned(obj);
43063         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43064         obj_conv.is_owned = false;
43065         LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
43066         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43067         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43068         CVec_u8Z_free(ret_var);
43069         return ret_arr;
43070 }
43071
43072 uint64_t  __attribute__((export_name("TS_ChannelDetails_read"))) TS_ChannelDetails_read(int8_tArray ser) {
43073         LDKu8slice ser_ref;
43074         ser_ref.datalen = ser->arr_len;
43075         ser_ref.data = ser->elems;
43076         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
43077         *ret_conv = ChannelDetails_read(ser_ref);
43078         FREE(ser);
43079         return tag_ptr(ret_conv, true);
43080 }
43081
43082 int8_tArray  __attribute__((export_name("TS_PhantomRouteHints_write"))) TS_PhantomRouteHints_write(uint64_t obj) {
43083         LDKPhantomRouteHints obj_conv;
43084         obj_conv.inner = untag_ptr(obj);
43085         obj_conv.is_owned = ptr_is_owned(obj);
43086         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43087         obj_conv.is_owned = false;
43088         LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
43089         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43090         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43091         CVec_u8Z_free(ret_var);
43092         return ret_arr;
43093 }
43094
43095 uint64_t  __attribute__((export_name("TS_PhantomRouteHints_read"))) TS_PhantomRouteHints_read(int8_tArray ser) {
43096         LDKu8slice ser_ref;
43097         ser_ref.datalen = ser->arr_len;
43098         ser_ref.data = ser->elems;
43099         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
43100         *ret_conv = PhantomRouteHints_read(ser_ref);
43101         FREE(ser);
43102         return tag_ptr(ret_conv, true);
43103 }
43104
43105 int8_tArray  __attribute__((export_name("TS_BlindedForward_write"))) TS_BlindedForward_write(uint64_t obj) {
43106         LDKBlindedForward obj_conv;
43107         obj_conv.inner = untag_ptr(obj);
43108         obj_conv.is_owned = ptr_is_owned(obj);
43109         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43110         obj_conv.is_owned = false;
43111         LDKCVec_u8Z ret_var = BlindedForward_write(&obj_conv);
43112         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43113         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43114         CVec_u8Z_free(ret_var);
43115         return ret_arr;
43116 }
43117
43118 uint64_t  __attribute__((export_name("TS_BlindedForward_read"))) TS_BlindedForward_read(int8_tArray ser) {
43119         LDKu8slice ser_ref;
43120         ser_ref.datalen = ser->arr_len;
43121         ser_ref.data = ser->elems;
43122         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
43123         *ret_conv = BlindedForward_read(ser_ref);
43124         FREE(ser);
43125         return tag_ptr(ret_conv, true);
43126 }
43127
43128 int8_tArray  __attribute__((export_name("TS_PendingHTLCRouting_write"))) TS_PendingHTLCRouting_write(uint64_t obj) {
43129         LDKPendingHTLCRouting* obj_conv = (LDKPendingHTLCRouting*)untag_ptr(obj);
43130         LDKCVec_u8Z ret_var = PendingHTLCRouting_write(obj_conv);
43131         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43132         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43133         CVec_u8Z_free(ret_var);
43134         return ret_arr;
43135 }
43136
43137 uint64_t  __attribute__((export_name("TS_PendingHTLCRouting_read"))) TS_PendingHTLCRouting_read(int8_tArray ser) {
43138         LDKu8slice ser_ref;
43139         ser_ref.datalen = ser->arr_len;
43140         ser_ref.data = ser->elems;
43141         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
43142         *ret_conv = PendingHTLCRouting_read(ser_ref);
43143         FREE(ser);
43144         return tag_ptr(ret_conv, true);
43145 }
43146
43147 int8_tArray  __attribute__((export_name("TS_PendingHTLCInfo_write"))) TS_PendingHTLCInfo_write(uint64_t obj) {
43148         LDKPendingHTLCInfo 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 = PendingHTLCInfo_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_PendingHTLCInfo_read"))) TS_PendingHTLCInfo_read(int8_tArray ser) {
43161         LDKu8slice ser_ref;
43162         ser_ref.datalen = ser->arr_len;
43163         ser_ref.data = ser->elems;
43164         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
43165         *ret_conv = PendingHTLCInfo_read(ser_ref);
43166         FREE(ser);
43167         return tag_ptr(ret_conv, true);
43168 }
43169
43170 int8_tArray  __attribute__((export_name("TS_BlindedFailure_write"))) TS_BlindedFailure_write(uint64_t obj) {
43171         LDKBlindedFailure* obj_conv = (LDKBlindedFailure*)untag_ptr(obj);
43172         LDKCVec_u8Z ret_var = BlindedFailure_write(obj_conv);
43173         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43174         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43175         CVec_u8Z_free(ret_var);
43176         return ret_arr;
43177 }
43178
43179 uint64_t  __attribute__((export_name("TS_BlindedFailure_read"))) TS_BlindedFailure_read(int8_tArray ser) {
43180         LDKu8slice ser_ref;
43181         ser_ref.datalen = ser->arr_len;
43182         ser_ref.data = ser->elems;
43183         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
43184         *ret_conv = BlindedFailure_read(ser_ref);
43185         FREE(ser);
43186         return tag_ptr(ret_conv, true);
43187 }
43188
43189 int8_tArray  __attribute__((export_name("TS_ChannelManager_write"))) TS_ChannelManager_write(uint64_t obj) {
43190         LDKChannelManager obj_conv;
43191         obj_conv.inner = untag_ptr(obj);
43192         obj_conv.is_owned = ptr_is_owned(obj);
43193         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43194         obj_conv.is_owned = false;
43195         LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
43196         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43197         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43198         CVec_u8Z_free(ret_var);
43199         return ret_arr;
43200 }
43201
43202 int8_tArray  __attribute__((export_name("TS_ChannelShutdownState_write"))) TS_ChannelShutdownState_write(uint64_t obj) {
43203         LDKChannelShutdownState* obj_conv = (LDKChannelShutdownState*)untag_ptr(obj);
43204         LDKCVec_u8Z ret_var = ChannelShutdownState_write(obj_conv);
43205         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43206         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43207         CVec_u8Z_free(ret_var);
43208         return ret_arr;
43209 }
43210
43211 uint64_t  __attribute__((export_name("TS_ChannelShutdownState_read"))) TS_ChannelShutdownState_read(int8_tArray ser) {
43212         LDKu8slice ser_ref;
43213         ser_ref.datalen = ser->arr_len;
43214         ser_ref.data = ser->elems;
43215         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
43216         *ret_conv = ChannelShutdownState_read(ser_ref);
43217         FREE(ser);
43218         return tag_ptr(ret_conv, true);
43219 }
43220
43221 void  __attribute__((export_name("TS_ChannelManagerReadArgs_free"))) TS_ChannelManagerReadArgs_free(uint64_t this_obj) {
43222         LDKChannelManagerReadArgs this_obj_conv;
43223         this_obj_conv.inner = untag_ptr(this_obj);
43224         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43226         ChannelManagerReadArgs_free(this_obj_conv);
43227 }
43228
43229 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_entropy_source"))) TS_ChannelManagerReadArgs_get_entropy_source(uint64_t this_ptr) {
43230         LDKChannelManagerReadArgs this_ptr_conv;
43231         this_ptr_conv.inner = untag_ptr(this_ptr);
43232         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43234         this_ptr_conv.is_owned = false;
43235         // WARNING: This object doesn't live past this scope, needs clone!
43236         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_entropy_source(&this_ptr_conv), false);
43237         return ret_ret;
43238 }
43239
43240 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_entropy_source"))) TS_ChannelManagerReadArgs_set_entropy_source(uint64_t this_ptr, uint64_t val) {
43241         LDKChannelManagerReadArgs this_ptr_conv;
43242         this_ptr_conv.inner = untag_ptr(this_ptr);
43243         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43245         this_ptr_conv.is_owned = false;
43246         void* val_ptr = untag_ptr(val);
43247         CHECK_ACCESS(val_ptr);
43248         LDKEntropySource val_conv = *(LDKEntropySource*)(val_ptr);
43249         if (val_conv.free == LDKEntropySource_JCalls_free) {
43250                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43251                 LDKEntropySource_JCalls_cloned(&val_conv);
43252         }
43253         ChannelManagerReadArgs_set_entropy_source(&this_ptr_conv, val_conv);
43254 }
43255
43256 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_node_signer"))) TS_ChannelManagerReadArgs_get_node_signer(uint64_t this_ptr) {
43257         LDKChannelManagerReadArgs this_ptr_conv;
43258         this_ptr_conv.inner = untag_ptr(this_ptr);
43259         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43261         this_ptr_conv.is_owned = false;
43262         // WARNING: This object doesn't live past this scope, needs clone!
43263         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_node_signer(&this_ptr_conv), false);
43264         return ret_ret;
43265 }
43266
43267 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_node_signer"))) TS_ChannelManagerReadArgs_set_node_signer(uint64_t this_ptr, uint64_t val) {
43268         LDKChannelManagerReadArgs this_ptr_conv;
43269         this_ptr_conv.inner = untag_ptr(this_ptr);
43270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43272         this_ptr_conv.is_owned = false;
43273         void* val_ptr = untag_ptr(val);
43274         CHECK_ACCESS(val_ptr);
43275         LDKNodeSigner val_conv = *(LDKNodeSigner*)(val_ptr);
43276         if (val_conv.free == LDKNodeSigner_JCalls_free) {
43277                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43278                 LDKNodeSigner_JCalls_cloned(&val_conv);
43279         }
43280         ChannelManagerReadArgs_set_node_signer(&this_ptr_conv, val_conv);
43281 }
43282
43283 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_signer_provider"))) TS_ChannelManagerReadArgs_get_signer_provider(uint64_t this_ptr) {
43284         LDKChannelManagerReadArgs this_ptr_conv;
43285         this_ptr_conv.inner = untag_ptr(this_ptr);
43286         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43288         this_ptr_conv.is_owned = false;
43289         // WARNING: This object doesn't live past this scope, needs clone!
43290         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_signer_provider(&this_ptr_conv), false);
43291         return ret_ret;
43292 }
43293
43294 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_signer_provider"))) TS_ChannelManagerReadArgs_set_signer_provider(uint64_t this_ptr, uint64_t val) {
43295         LDKChannelManagerReadArgs this_ptr_conv;
43296         this_ptr_conv.inner = untag_ptr(this_ptr);
43297         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43299         this_ptr_conv.is_owned = false;
43300         void* val_ptr = untag_ptr(val);
43301         CHECK_ACCESS(val_ptr);
43302         LDKSignerProvider val_conv = *(LDKSignerProvider*)(val_ptr);
43303         if (val_conv.free == LDKSignerProvider_JCalls_free) {
43304                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43305                 LDKSignerProvider_JCalls_cloned(&val_conv);
43306         }
43307         ChannelManagerReadArgs_set_signer_provider(&this_ptr_conv, val_conv);
43308 }
43309
43310 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_fee_estimator"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint64_t this_ptr) {
43311         LDKChannelManagerReadArgs this_ptr_conv;
43312         this_ptr_conv.inner = untag_ptr(this_ptr);
43313         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43315         this_ptr_conv.is_owned = false;
43316         // WARNING: This object doesn't live past this scope, needs clone!
43317         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv), false);
43318         return ret_ret;
43319 }
43320
43321 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_fee_estimator"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint64_t this_ptr, uint64_t val) {
43322         LDKChannelManagerReadArgs this_ptr_conv;
43323         this_ptr_conv.inner = untag_ptr(this_ptr);
43324         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43326         this_ptr_conv.is_owned = false;
43327         void* val_ptr = untag_ptr(val);
43328         CHECK_ACCESS(val_ptr);
43329         LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
43330         if (val_conv.free == LDKFeeEstimator_JCalls_free) {
43331                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43332                 LDKFeeEstimator_JCalls_cloned(&val_conv);
43333         }
43334         ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
43335 }
43336
43337 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_chain_monitor"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint64_t this_ptr) {
43338         LDKChannelManagerReadArgs this_ptr_conv;
43339         this_ptr_conv.inner = untag_ptr(this_ptr);
43340         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43342         this_ptr_conv.is_owned = false;
43343         // WARNING: This object doesn't live past this scope, needs clone!
43344         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv), false);
43345         return ret_ret;
43346 }
43347
43348 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_chain_monitor"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint64_t this_ptr, uint64_t val) {
43349         LDKChannelManagerReadArgs this_ptr_conv;
43350         this_ptr_conv.inner = untag_ptr(this_ptr);
43351         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43353         this_ptr_conv.is_owned = false;
43354         void* val_ptr = untag_ptr(val);
43355         CHECK_ACCESS(val_ptr);
43356         LDKWatch val_conv = *(LDKWatch*)(val_ptr);
43357         if (val_conv.free == LDKWatch_JCalls_free) {
43358                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43359                 LDKWatch_JCalls_cloned(&val_conv);
43360         }
43361         ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
43362 }
43363
43364 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_tx_broadcaster"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint64_t this_ptr) {
43365         LDKChannelManagerReadArgs this_ptr_conv;
43366         this_ptr_conv.inner = untag_ptr(this_ptr);
43367         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43369         this_ptr_conv.is_owned = false;
43370         // WARNING: This object doesn't live past this scope, needs clone!
43371         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv), false);
43372         return ret_ret;
43373 }
43374
43375 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_tx_broadcaster"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint64_t this_ptr, uint64_t val) {
43376         LDKChannelManagerReadArgs this_ptr_conv;
43377         this_ptr_conv.inner = untag_ptr(this_ptr);
43378         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43380         this_ptr_conv.is_owned = false;
43381         void* val_ptr = untag_ptr(val);
43382         CHECK_ACCESS(val_ptr);
43383         LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
43384         if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
43385                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43386                 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
43387         }
43388         ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
43389 }
43390
43391 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_router"))) TS_ChannelManagerReadArgs_get_router(uint64_t this_ptr) {
43392         LDKChannelManagerReadArgs this_ptr_conv;
43393         this_ptr_conv.inner = untag_ptr(this_ptr);
43394         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43396         this_ptr_conv.is_owned = false;
43397         // WARNING: This object doesn't live past this scope, needs clone!
43398         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_router(&this_ptr_conv), false);
43399         return ret_ret;
43400 }
43401
43402 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_router"))) TS_ChannelManagerReadArgs_set_router(uint64_t this_ptr, uint64_t val) {
43403         LDKChannelManagerReadArgs this_ptr_conv;
43404         this_ptr_conv.inner = untag_ptr(this_ptr);
43405         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43407         this_ptr_conv.is_owned = false;
43408         void* val_ptr = untag_ptr(val);
43409         CHECK_ACCESS(val_ptr);
43410         LDKRouter val_conv = *(LDKRouter*)(val_ptr);
43411         if (val_conv.free == LDKRouter_JCalls_free) {
43412                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43413                 LDKRouter_JCalls_cloned(&val_conv);
43414         }
43415         ChannelManagerReadArgs_set_router(&this_ptr_conv, val_conv);
43416 }
43417
43418 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_logger"))) TS_ChannelManagerReadArgs_get_logger(uint64_t this_ptr) {
43419         LDKChannelManagerReadArgs this_ptr_conv;
43420         this_ptr_conv.inner = untag_ptr(this_ptr);
43421         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43423         this_ptr_conv.is_owned = false;
43424         // WARNING: This object doesn't live past this scope, needs clone!
43425         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_logger(&this_ptr_conv), false);
43426         return ret_ret;
43427 }
43428
43429 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_logger"))) TS_ChannelManagerReadArgs_set_logger(uint64_t this_ptr, uint64_t val) {
43430         LDKChannelManagerReadArgs this_ptr_conv;
43431         this_ptr_conv.inner = untag_ptr(this_ptr);
43432         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43434         this_ptr_conv.is_owned = false;
43435         void* val_ptr = untag_ptr(val);
43436         CHECK_ACCESS(val_ptr);
43437         LDKLogger val_conv = *(LDKLogger*)(val_ptr);
43438         if (val_conv.free == LDKLogger_JCalls_free) {
43439                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43440                 LDKLogger_JCalls_cloned(&val_conv);
43441         }
43442         ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
43443 }
43444
43445 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_default_config"))) TS_ChannelManagerReadArgs_get_default_config(uint64_t this_ptr) {
43446         LDKChannelManagerReadArgs this_ptr_conv;
43447         this_ptr_conv.inner = untag_ptr(this_ptr);
43448         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43450         this_ptr_conv.is_owned = false;
43451         LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
43452         uint64_t ret_ref = 0;
43453         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43454         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43455         return ret_ref;
43456 }
43457
43458 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_default_config"))) TS_ChannelManagerReadArgs_set_default_config(uint64_t this_ptr, uint64_t val) {
43459         LDKChannelManagerReadArgs this_ptr_conv;
43460         this_ptr_conv.inner = untag_ptr(this_ptr);
43461         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43463         this_ptr_conv.is_owned = false;
43464         LDKUserConfig val_conv;
43465         val_conv.inner = untag_ptr(val);
43466         val_conv.is_owned = ptr_is_owned(val);
43467         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43468         val_conv = UserConfig_clone(&val_conv);
43469         ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
43470 }
43471
43472 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) {
43473         void* entropy_source_ptr = untag_ptr(entropy_source);
43474         CHECK_ACCESS(entropy_source_ptr);
43475         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
43476         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
43477                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43478                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
43479         }
43480         void* node_signer_ptr = untag_ptr(node_signer);
43481         CHECK_ACCESS(node_signer_ptr);
43482         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
43483         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
43484                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43485                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
43486         }
43487         void* signer_provider_ptr = untag_ptr(signer_provider);
43488         CHECK_ACCESS(signer_provider_ptr);
43489         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
43490         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
43491                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43492                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
43493         }
43494         void* fee_estimator_ptr = untag_ptr(fee_estimator);
43495         CHECK_ACCESS(fee_estimator_ptr);
43496         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
43497         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
43498                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43499                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
43500         }
43501         void* chain_monitor_ptr = untag_ptr(chain_monitor);
43502         CHECK_ACCESS(chain_monitor_ptr);
43503         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
43504         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
43505                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43506                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
43507         }
43508         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
43509         CHECK_ACCESS(tx_broadcaster_ptr);
43510         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
43511         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
43512                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43513                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
43514         }
43515         void* router_ptr = untag_ptr(router);
43516         CHECK_ACCESS(router_ptr);
43517         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
43518         if (router_conv.free == LDKRouter_JCalls_free) {
43519                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43520                 LDKRouter_JCalls_cloned(&router_conv);
43521         }
43522         void* logger_ptr = untag_ptr(logger);
43523         CHECK_ACCESS(logger_ptr);
43524         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
43525         if (logger_conv.free == LDKLogger_JCalls_free) {
43526                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43527                 LDKLogger_JCalls_cloned(&logger_conv);
43528         }
43529         LDKUserConfig default_config_conv;
43530         default_config_conv.inner = untag_ptr(default_config);
43531         default_config_conv.is_owned = ptr_is_owned(default_config);
43532         CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
43533         default_config_conv = UserConfig_clone(&default_config_conv);
43534         LDKCVec_ChannelMonitorZ channel_monitors_constr;
43535         channel_monitors_constr.datalen = channel_monitors->arr_len;
43536         if (channel_monitors_constr.datalen > 0)
43537                 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
43538         else
43539                 channel_monitors_constr.data = NULL;
43540         uint64_t* channel_monitors_vals = channel_monitors->elems;
43541         for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
43542                 uint64_t channel_monitors_conv_16 = channel_monitors_vals[q];
43543                 LDKChannelMonitor channel_monitors_conv_16_conv;
43544                 channel_monitors_conv_16_conv.inner = untag_ptr(channel_monitors_conv_16);
43545                 channel_monitors_conv_16_conv.is_owned = ptr_is_owned(channel_monitors_conv_16);
43546                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
43547                 channel_monitors_conv_16_conv.is_owned = false;
43548                 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
43549         }
43550         FREE(channel_monitors);
43551         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);
43552         uint64_t ret_ref = 0;
43553         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43554         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43555         return ret_ref;
43556 }
43557
43558 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_read"))) TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_read(int8_tArray ser, uint64_t arg) {
43559         LDKu8slice ser_ref;
43560         ser_ref.datalen = ser->arr_len;
43561         ser_ref.data = ser->elems;
43562         LDKChannelManagerReadArgs arg_conv;
43563         arg_conv.inner = untag_ptr(arg);
43564         arg_conv.is_owned = ptr_is_owned(arg);
43565         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43566         // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
43567         
43568         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
43569         *ret_conv = C2Tuple_ThirtyTwoBytesChannelManagerZ_read(ser_ref, arg_conv);
43570         FREE(ser);
43571         return tag_ptr(ret_conv, true);
43572 }
43573
43574 void  __attribute__((export_name("TS_DelayedPaymentBasepoint_free"))) TS_DelayedPaymentBasepoint_free(uint64_t this_obj) {
43575         LDKDelayedPaymentBasepoint this_obj_conv;
43576         this_obj_conv.inner = untag_ptr(this_obj);
43577         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43579         DelayedPaymentBasepoint_free(this_obj_conv);
43580 }
43581
43582 int8_tArray  __attribute__((export_name("TS_DelayedPaymentBasepoint_get_a"))) TS_DelayedPaymentBasepoint_get_a(uint64_t this_ptr) {
43583         LDKDelayedPaymentBasepoint this_ptr_conv;
43584         this_ptr_conv.inner = untag_ptr(this_ptr);
43585         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43587         this_ptr_conv.is_owned = false;
43588         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43589         memcpy(ret_arr->elems, DelayedPaymentBasepoint_get_a(&this_ptr_conv).compressed_form, 33);
43590         return ret_arr;
43591 }
43592
43593 void  __attribute__((export_name("TS_DelayedPaymentBasepoint_set_a"))) TS_DelayedPaymentBasepoint_set_a(uint64_t this_ptr, int8_tArray val) {
43594         LDKDelayedPaymentBasepoint this_ptr_conv;
43595         this_ptr_conv.inner = untag_ptr(this_ptr);
43596         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43598         this_ptr_conv.is_owned = false;
43599         LDKPublicKey val_ref;
43600         CHECK(val->arr_len == 33);
43601         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43602         DelayedPaymentBasepoint_set_a(&this_ptr_conv, val_ref);
43603 }
43604
43605 uint64_t  __attribute__((export_name("TS_DelayedPaymentBasepoint_new"))) TS_DelayedPaymentBasepoint_new(int8_tArray a_arg) {
43606         LDKPublicKey a_arg_ref;
43607         CHECK(a_arg->arr_len == 33);
43608         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
43609         LDKDelayedPaymentBasepoint ret_var = DelayedPaymentBasepoint_new(a_arg_ref);
43610         uint64_t ret_ref = 0;
43611         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43612         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43613         return ret_ref;
43614 }
43615
43616 jboolean  __attribute__((export_name("TS_DelayedPaymentBasepoint_eq"))) TS_DelayedPaymentBasepoint_eq(uint64_t a, uint64_t b) {
43617         LDKDelayedPaymentBasepoint a_conv;
43618         a_conv.inner = untag_ptr(a);
43619         a_conv.is_owned = ptr_is_owned(a);
43620         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43621         a_conv.is_owned = false;
43622         LDKDelayedPaymentBasepoint b_conv;
43623         b_conv.inner = untag_ptr(b);
43624         b_conv.is_owned = ptr_is_owned(b);
43625         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43626         b_conv.is_owned = false;
43627         jboolean ret_conv = DelayedPaymentBasepoint_eq(&a_conv, &b_conv);
43628         return ret_conv;
43629 }
43630
43631 static inline uint64_t DelayedPaymentBasepoint_clone_ptr(LDKDelayedPaymentBasepoint *NONNULL_PTR arg) {
43632         LDKDelayedPaymentBasepoint ret_var = DelayedPaymentBasepoint_clone(arg);
43633         uint64_t ret_ref = 0;
43634         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43635         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43636         return ret_ref;
43637 }
43638 int64_t  __attribute__((export_name("TS_DelayedPaymentBasepoint_clone_ptr"))) TS_DelayedPaymentBasepoint_clone_ptr(uint64_t arg) {
43639         LDKDelayedPaymentBasepoint arg_conv;
43640         arg_conv.inner = untag_ptr(arg);
43641         arg_conv.is_owned = ptr_is_owned(arg);
43642         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43643         arg_conv.is_owned = false;
43644         int64_t ret_conv = DelayedPaymentBasepoint_clone_ptr(&arg_conv);
43645         return ret_conv;
43646 }
43647
43648 uint64_t  __attribute__((export_name("TS_DelayedPaymentBasepoint_clone"))) TS_DelayedPaymentBasepoint_clone(uint64_t orig) {
43649         LDKDelayedPaymentBasepoint orig_conv;
43650         orig_conv.inner = untag_ptr(orig);
43651         orig_conv.is_owned = ptr_is_owned(orig);
43652         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43653         orig_conv.is_owned = false;
43654         LDKDelayedPaymentBasepoint ret_var = DelayedPaymentBasepoint_clone(&orig_conv);
43655         uint64_t ret_ref = 0;
43656         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43657         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43658         return ret_ref;
43659 }
43660
43661 int64_t  __attribute__((export_name("TS_DelayedPaymentBasepoint_hash"))) TS_DelayedPaymentBasepoint_hash(uint64_t o) {
43662         LDKDelayedPaymentBasepoint o_conv;
43663         o_conv.inner = untag_ptr(o);
43664         o_conv.is_owned = ptr_is_owned(o);
43665         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43666         o_conv.is_owned = false;
43667         int64_t ret_conv = DelayedPaymentBasepoint_hash(&o_conv);
43668         return ret_conv;
43669 }
43670
43671 int8_tArray  __attribute__((export_name("TS_DelayedPaymentBasepoint_to_public_key"))) TS_DelayedPaymentBasepoint_to_public_key(uint64_t this_arg) {
43672         LDKDelayedPaymentBasepoint this_arg_conv;
43673         this_arg_conv.inner = untag_ptr(this_arg);
43674         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43676         this_arg_conv.is_owned = false;
43677         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43678         memcpy(ret_arr->elems, DelayedPaymentBasepoint_to_public_key(&this_arg_conv).compressed_form, 33);
43679         return ret_arr;
43680 }
43681
43682 int8_tArray  __attribute__((export_name("TS_DelayedPaymentBasepoint_derive_add_tweak"))) TS_DelayedPaymentBasepoint_derive_add_tweak(uint64_t this_arg, int8_tArray per_commitment_point) {
43683         LDKDelayedPaymentBasepoint this_arg_conv;
43684         this_arg_conv.inner = untag_ptr(this_arg);
43685         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43687         this_arg_conv.is_owned = false;
43688         LDKPublicKey per_commitment_point_ref;
43689         CHECK(per_commitment_point->arr_len == 33);
43690         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
43691         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43692         memcpy(ret_arr->elems, DelayedPaymentBasepoint_derive_add_tweak(&this_arg_conv, per_commitment_point_ref).data, 32);
43693         return ret_arr;
43694 }
43695
43696 int8_tArray  __attribute__((export_name("TS_DelayedPaymentBasepoint_write"))) TS_DelayedPaymentBasepoint_write(uint64_t obj) {
43697         LDKDelayedPaymentBasepoint obj_conv;
43698         obj_conv.inner = untag_ptr(obj);
43699         obj_conv.is_owned = ptr_is_owned(obj);
43700         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43701         obj_conv.is_owned = false;
43702         LDKCVec_u8Z ret_var = DelayedPaymentBasepoint_write(&obj_conv);
43703         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43704         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43705         CVec_u8Z_free(ret_var);
43706         return ret_arr;
43707 }
43708
43709 uint64_t  __attribute__((export_name("TS_DelayedPaymentBasepoint_read"))) TS_DelayedPaymentBasepoint_read(int8_tArray ser) {
43710         LDKu8slice ser_ref;
43711         ser_ref.datalen = ser->arr_len;
43712         ser_ref.data = ser->elems;
43713         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
43714         *ret_conv = DelayedPaymentBasepoint_read(ser_ref);
43715         FREE(ser);
43716         return tag_ptr(ret_conv, true);
43717 }
43718
43719 void  __attribute__((export_name("TS_DelayedPaymentKey_free"))) TS_DelayedPaymentKey_free(uint64_t this_obj) {
43720         LDKDelayedPaymentKey this_obj_conv;
43721         this_obj_conv.inner = untag_ptr(this_obj);
43722         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43724         DelayedPaymentKey_free(this_obj_conv);
43725 }
43726
43727 int8_tArray  __attribute__((export_name("TS_DelayedPaymentKey_get_a"))) TS_DelayedPaymentKey_get_a(uint64_t this_ptr) {
43728         LDKDelayedPaymentKey this_ptr_conv;
43729         this_ptr_conv.inner = untag_ptr(this_ptr);
43730         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43732         this_ptr_conv.is_owned = false;
43733         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43734         memcpy(ret_arr->elems, DelayedPaymentKey_get_a(&this_ptr_conv).compressed_form, 33);
43735         return ret_arr;
43736 }
43737
43738 void  __attribute__((export_name("TS_DelayedPaymentKey_set_a"))) TS_DelayedPaymentKey_set_a(uint64_t this_ptr, int8_tArray val) {
43739         LDKDelayedPaymentKey this_ptr_conv;
43740         this_ptr_conv.inner = untag_ptr(this_ptr);
43741         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43743         this_ptr_conv.is_owned = false;
43744         LDKPublicKey val_ref;
43745         CHECK(val->arr_len == 33);
43746         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43747         DelayedPaymentKey_set_a(&this_ptr_conv, val_ref);
43748 }
43749
43750 uint64_t  __attribute__((export_name("TS_DelayedPaymentKey_new"))) TS_DelayedPaymentKey_new(int8_tArray a_arg) {
43751         LDKPublicKey a_arg_ref;
43752         CHECK(a_arg->arr_len == 33);
43753         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
43754         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_new(a_arg_ref);
43755         uint64_t ret_ref = 0;
43756         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43757         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43758         return ret_ref;
43759 }
43760
43761 jboolean  __attribute__((export_name("TS_DelayedPaymentKey_eq"))) TS_DelayedPaymentKey_eq(uint64_t a, uint64_t b) {
43762         LDKDelayedPaymentKey a_conv;
43763         a_conv.inner = untag_ptr(a);
43764         a_conv.is_owned = ptr_is_owned(a);
43765         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43766         a_conv.is_owned = false;
43767         LDKDelayedPaymentKey b_conv;
43768         b_conv.inner = untag_ptr(b);
43769         b_conv.is_owned = ptr_is_owned(b);
43770         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43771         b_conv.is_owned = false;
43772         jboolean ret_conv = DelayedPaymentKey_eq(&a_conv, &b_conv);
43773         return ret_conv;
43774 }
43775
43776 static inline uint64_t DelayedPaymentKey_clone_ptr(LDKDelayedPaymentKey *NONNULL_PTR arg) {
43777         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_clone(arg);
43778         uint64_t ret_ref = 0;
43779         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43780         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43781         return ret_ref;
43782 }
43783 int64_t  __attribute__((export_name("TS_DelayedPaymentKey_clone_ptr"))) TS_DelayedPaymentKey_clone_ptr(uint64_t arg) {
43784         LDKDelayedPaymentKey arg_conv;
43785         arg_conv.inner = untag_ptr(arg);
43786         arg_conv.is_owned = ptr_is_owned(arg);
43787         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43788         arg_conv.is_owned = false;
43789         int64_t ret_conv = DelayedPaymentKey_clone_ptr(&arg_conv);
43790         return ret_conv;
43791 }
43792
43793 uint64_t  __attribute__((export_name("TS_DelayedPaymentKey_clone"))) TS_DelayedPaymentKey_clone(uint64_t orig) {
43794         LDKDelayedPaymentKey orig_conv;
43795         orig_conv.inner = untag_ptr(orig);
43796         orig_conv.is_owned = ptr_is_owned(orig);
43797         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43798         orig_conv.is_owned = false;
43799         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_clone(&orig_conv);
43800         uint64_t ret_ref = 0;
43801         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43802         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43803         return ret_ref;
43804 }
43805
43806 uint64_t  __attribute__((export_name("TS_DelayedPaymentKey_from_basepoint"))) TS_DelayedPaymentKey_from_basepoint(uint64_t countersignatory_basepoint, int8_tArray per_commitment_point) {
43807         LDKDelayedPaymentBasepoint countersignatory_basepoint_conv;
43808         countersignatory_basepoint_conv.inner = untag_ptr(countersignatory_basepoint);
43809         countersignatory_basepoint_conv.is_owned = ptr_is_owned(countersignatory_basepoint);
43810         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_basepoint_conv);
43811         countersignatory_basepoint_conv.is_owned = false;
43812         LDKPublicKey per_commitment_point_ref;
43813         CHECK(per_commitment_point->arr_len == 33);
43814         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
43815         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_from_basepoint(&countersignatory_basepoint_conv, per_commitment_point_ref);
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
43822 uint64_t  __attribute__((export_name("TS_DelayedPaymentKey_from_secret_key"))) TS_DelayedPaymentKey_from_secret_key(int8_tArray sk) {
43823         uint8_t sk_arr[32];
43824         CHECK(sk->arr_len == 32);
43825         memcpy(sk_arr, sk->elems, 32); FREE(sk);
43826         uint8_t (*sk_ref)[32] = &sk_arr;
43827         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_from_secret_key(sk_ref);
43828         uint64_t ret_ref = 0;
43829         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43830         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43831         return ret_ref;
43832 }
43833
43834 int8_tArray  __attribute__((export_name("TS_DelayedPaymentKey_to_public_key"))) TS_DelayedPaymentKey_to_public_key(uint64_t this_arg) {
43835         LDKDelayedPaymentKey this_arg_conv;
43836         this_arg_conv.inner = untag_ptr(this_arg);
43837         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43839         this_arg_conv.is_owned = false;
43840         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43841         memcpy(ret_arr->elems, DelayedPaymentKey_to_public_key(&this_arg_conv).compressed_form, 33);
43842         return ret_arr;
43843 }
43844
43845 int8_tArray  __attribute__((export_name("TS_DelayedPaymentKey_write"))) TS_DelayedPaymentKey_write(uint64_t obj) {
43846         LDKDelayedPaymentKey obj_conv;
43847         obj_conv.inner = untag_ptr(obj);
43848         obj_conv.is_owned = ptr_is_owned(obj);
43849         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43850         obj_conv.is_owned = false;
43851         LDKCVec_u8Z ret_var = DelayedPaymentKey_write(&obj_conv);
43852         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43853         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43854         CVec_u8Z_free(ret_var);
43855         return ret_arr;
43856 }
43857
43858 uint64_t  __attribute__((export_name("TS_DelayedPaymentKey_read"))) TS_DelayedPaymentKey_read(int8_tArray ser) {
43859         LDKu8slice ser_ref;
43860         ser_ref.datalen = ser->arr_len;
43861         ser_ref.data = ser->elems;
43862         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
43863         *ret_conv = DelayedPaymentKey_read(ser_ref);
43864         FREE(ser);
43865         return tag_ptr(ret_conv, true);
43866 }
43867
43868 void  __attribute__((export_name("TS_HtlcBasepoint_free"))) TS_HtlcBasepoint_free(uint64_t this_obj) {
43869         LDKHtlcBasepoint this_obj_conv;
43870         this_obj_conv.inner = untag_ptr(this_obj);
43871         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43873         HtlcBasepoint_free(this_obj_conv);
43874 }
43875
43876 int8_tArray  __attribute__((export_name("TS_HtlcBasepoint_get_a"))) TS_HtlcBasepoint_get_a(uint64_t this_ptr) {
43877         LDKHtlcBasepoint this_ptr_conv;
43878         this_ptr_conv.inner = untag_ptr(this_ptr);
43879         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43881         this_ptr_conv.is_owned = false;
43882         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43883         memcpy(ret_arr->elems, HtlcBasepoint_get_a(&this_ptr_conv).compressed_form, 33);
43884         return ret_arr;
43885 }
43886
43887 void  __attribute__((export_name("TS_HtlcBasepoint_set_a"))) TS_HtlcBasepoint_set_a(uint64_t this_ptr, int8_tArray val) {
43888         LDKHtlcBasepoint this_ptr_conv;
43889         this_ptr_conv.inner = untag_ptr(this_ptr);
43890         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43892         this_ptr_conv.is_owned = false;
43893         LDKPublicKey val_ref;
43894         CHECK(val->arr_len == 33);
43895         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43896         HtlcBasepoint_set_a(&this_ptr_conv, val_ref);
43897 }
43898
43899 uint64_t  __attribute__((export_name("TS_HtlcBasepoint_new"))) TS_HtlcBasepoint_new(int8_tArray a_arg) {
43900         LDKPublicKey a_arg_ref;
43901         CHECK(a_arg->arr_len == 33);
43902         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
43903         LDKHtlcBasepoint ret_var = HtlcBasepoint_new(a_arg_ref);
43904         uint64_t ret_ref = 0;
43905         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43906         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43907         return ret_ref;
43908 }
43909
43910 jboolean  __attribute__((export_name("TS_HtlcBasepoint_eq"))) TS_HtlcBasepoint_eq(uint64_t a, uint64_t b) {
43911         LDKHtlcBasepoint a_conv;
43912         a_conv.inner = untag_ptr(a);
43913         a_conv.is_owned = ptr_is_owned(a);
43914         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43915         a_conv.is_owned = false;
43916         LDKHtlcBasepoint b_conv;
43917         b_conv.inner = untag_ptr(b);
43918         b_conv.is_owned = ptr_is_owned(b);
43919         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43920         b_conv.is_owned = false;
43921         jboolean ret_conv = HtlcBasepoint_eq(&a_conv, &b_conv);
43922         return ret_conv;
43923 }
43924
43925 static inline uint64_t HtlcBasepoint_clone_ptr(LDKHtlcBasepoint *NONNULL_PTR arg) {
43926         LDKHtlcBasepoint ret_var = HtlcBasepoint_clone(arg);
43927         uint64_t ret_ref = 0;
43928         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43929         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43930         return ret_ref;
43931 }
43932 int64_t  __attribute__((export_name("TS_HtlcBasepoint_clone_ptr"))) TS_HtlcBasepoint_clone_ptr(uint64_t arg) {
43933         LDKHtlcBasepoint arg_conv;
43934         arg_conv.inner = untag_ptr(arg);
43935         arg_conv.is_owned = ptr_is_owned(arg);
43936         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43937         arg_conv.is_owned = false;
43938         int64_t ret_conv = HtlcBasepoint_clone_ptr(&arg_conv);
43939         return ret_conv;
43940 }
43941
43942 uint64_t  __attribute__((export_name("TS_HtlcBasepoint_clone"))) TS_HtlcBasepoint_clone(uint64_t orig) {
43943         LDKHtlcBasepoint orig_conv;
43944         orig_conv.inner = untag_ptr(orig);
43945         orig_conv.is_owned = ptr_is_owned(orig);
43946         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43947         orig_conv.is_owned = false;
43948         LDKHtlcBasepoint ret_var = HtlcBasepoint_clone(&orig_conv);
43949         uint64_t ret_ref = 0;
43950         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43951         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43952         return ret_ref;
43953 }
43954
43955 int64_t  __attribute__((export_name("TS_HtlcBasepoint_hash"))) TS_HtlcBasepoint_hash(uint64_t o) {
43956         LDKHtlcBasepoint o_conv;
43957         o_conv.inner = untag_ptr(o);
43958         o_conv.is_owned = ptr_is_owned(o);
43959         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43960         o_conv.is_owned = false;
43961         int64_t ret_conv = HtlcBasepoint_hash(&o_conv);
43962         return ret_conv;
43963 }
43964
43965 int8_tArray  __attribute__((export_name("TS_HtlcBasepoint_to_public_key"))) TS_HtlcBasepoint_to_public_key(uint64_t this_arg) {
43966         LDKHtlcBasepoint this_arg_conv;
43967         this_arg_conv.inner = untag_ptr(this_arg);
43968         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43970         this_arg_conv.is_owned = false;
43971         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43972         memcpy(ret_arr->elems, HtlcBasepoint_to_public_key(&this_arg_conv).compressed_form, 33);
43973         return ret_arr;
43974 }
43975
43976 int8_tArray  __attribute__((export_name("TS_HtlcBasepoint_derive_add_tweak"))) TS_HtlcBasepoint_derive_add_tweak(uint64_t this_arg, int8_tArray per_commitment_point) {
43977         LDKHtlcBasepoint this_arg_conv;
43978         this_arg_conv.inner = untag_ptr(this_arg);
43979         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43981         this_arg_conv.is_owned = false;
43982         LDKPublicKey per_commitment_point_ref;
43983         CHECK(per_commitment_point->arr_len == 33);
43984         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
43985         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43986         memcpy(ret_arr->elems, HtlcBasepoint_derive_add_tweak(&this_arg_conv, per_commitment_point_ref).data, 32);
43987         return ret_arr;
43988 }
43989
43990 int8_tArray  __attribute__((export_name("TS_HtlcBasepoint_write"))) TS_HtlcBasepoint_write(uint64_t obj) {
43991         LDKHtlcBasepoint obj_conv;
43992         obj_conv.inner = untag_ptr(obj);
43993         obj_conv.is_owned = ptr_is_owned(obj);
43994         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43995         obj_conv.is_owned = false;
43996         LDKCVec_u8Z ret_var = HtlcBasepoint_write(&obj_conv);
43997         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43998         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43999         CVec_u8Z_free(ret_var);
44000         return ret_arr;
44001 }
44002
44003 uint64_t  __attribute__((export_name("TS_HtlcBasepoint_read"))) TS_HtlcBasepoint_read(int8_tArray ser) {
44004         LDKu8slice ser_ref;
44005         ser_ref.datalen = ser->arr_len;
44006         ser_ref.data = ser->elems;
44007         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
44008         *ret_conv = HtlcBasepoint_read(ser_ref);
44009         FREE(ser);
44010         return tag_ptr(ret_conv, true);
44011 }
44012
44013 void  __attribute__((export_name("TS_HtlcKey_free"))) TS_HtlcKey_free(uint64_t this_obj) {
44014         LDKHtlcKey this_obj_conv;
44015         this_obj_conv.inner = untag_ptr(this_obj);
44016         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44018         HtlcKey_free(this_obj_conv);
44019 }
44020
44021 int8_tArray  __attribute__((export_name("TS_HtlcKey_get_a"))) TS_HtlcKey_get_a(uint64_t this_ptr) {
44022         LDKHtlcKey this_ptr_conv;
44023         this_ptr_conv.inner = untag_ptr(this_ptr);
44024         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44026         this_ptr_conv.is_owned = false;
44027         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44028         memcpy(ret_arr->elems, HtlcKey_get_a(&this_ptr_conv).compressed_form, 33);
44029         return ret_arr;
44030 }
44031
44032 void  __attribute__((export_name("TS_HtlcKey_set_a"))) TS_HtlcKey_set_a(uint64_t this_ptr, int8_tArray val) {
44033         LDKHtlcKey this_ptr_conv;
44034         this_ptr_conv.inner = untag_ptr(this_ptr);
44035         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44037         this_ptr_conv.is_owned = false;
44038         LDKPublicKey val_ref;
44039         CHECK(val->arr_len == 33);
44040         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
44041         HtlcKey_set_a(&this_ptr_conv, val_ref);
44042 }
44043
44044 uint64_t  __attribute__((export_name("TS_HtlcKey_new"))) TS_HtlcKey_new(int8_tArray a_arg) {
44045         LDKPublicKey a_arg_ref;
44046         CHECK(a_arg->arr_len == 33);
44047         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
44048         LDKHtlcKey ret_var = HtlcKey_new(a_arg_ref);
44049         uint64_t ret_ref = 0;
44050         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44051         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44052         return ret_ref;
44053 }
44054
44055 jboolean  __attribute__((export_name("TS_HtlcKey_eq"))) TS_HtlcKey_eq(uint64_t a, uint64_t b) {
44056         LDKHtlcKey a_conv;
44057         a_conv.inner = untag_ptr(a);
44058         a_conv.is_owned = ptr_is_owned(a);
44059         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44060         a_conv.is_owned = false;
44061         LDKHtlcKey b_conv;
44062         b_conv.inner = untag_ptr(b);
44063         b_conv.is_owned = ptr_is_owned(b);
44064         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44065         b_conv.is_owned = false;
44066         jboolean ret_conv = HtlcKey_eq(&a_conv, &b_conv);
44067         return ret_conv;
44068 }
44069
44070 static inline uint64_t HtlcKey_clone_ptr(LDKHtlcKey *NONNULL_PTR arg) {
44071         LDKHtlcKey ret_var = HtlcKey_clone(arg);
44072         uint64_t ret_ref = 0;
44073         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44074         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44075         return ret_ref;
44076 }
44077 int64_t  __attribute__((export_name("TS_HtlcKey_clone_ptr"))) TS_HtlcKey_clone_ptr(uint64_t arg) {
44078         LDKHtlcKey arg_conv;
44079         arg_conv.inner = untag_ptr(arg);
44080         arg_conv.is_owned = ptr_is_owned(arg);
44081         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44082         arg_conv.is_owned = false;
44083         int64_t ret_conv = HtlcKey_clone_ptr(&arg_conv);
44084         return ret_conv;
44085 }
44086
44087 uint64_t  __attribute__((export_name("TS_HtlcKey_clone"))) TS_HtlcKey_clone(uint64_t orig) {
44088         LDKHtlcKey orig_conv;
44089         orig_conv.inner = untag_ptr(orig);
44090         orig_conv.is_owned = ptr_is_owned(orig);
44091         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44092         orig_conv.is_owned = false;
44093         LDKHtlcKey ret_var = HtlcKey_clone(&orig_conv);
44094         uint64_t ret_ref = 0;
44095         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44096         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44097         return ret_ref;
44098 }
44099
44100 uint64_t  __attribute__((export_name("TS_HtlcKey_from_basepoint"))) TS_HtlcKey_from_basepoint(uint64_t countersignatory_basepoint, int8_tArray per_commitment_point) {
44101         LDKHtlcBasepoint countersignatory_basepoint_conv;
44102         countersignatory_basepoint_conv.inner = untag_ptr(countersignatory_basepoint);
44103         countersignatory_basepoint_conv.is_owned = ptr_is_owned(countersignatory_basepoint);
44104         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_basepoint_conv);
44105         countersignatory_basepoint_conv.is_owned = false;
44106         LDKPublicKey per_commitment_point_ref;
44107         CHECK(per_commitment_point->arr_len == 33);
44108         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
44109         LDKHtlcKey ret_var = HtlcKey_from_basepoint(&countersignatory_basepoint_conv, per_commitment_point_ref);
44110         uint64_t ret_ref = 0;
44111         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44112         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44113         return ret_ref;
44114 }
44115
44116 uint64_t  __attribute__((export_name("TS_HtlcKey_from_secret_key"))) TS_HtlcKey_from_secret_key(int8_tArray sk) {
44117         uint8_t sk_arr[32];
44118         CHECK(sk->arr_len == 32);
44119         memcpy(sk_arr, sk->elems, 32); FREE(sk);
44120         uint8_t (*sk_ref)[32] = &sk_arr;
44121         LDKHtlcKey ret_var = HtlcKey_from_secret_key(sk_ref);
44122         uint64_t ret_ref = 0;
44123         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44124         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44125         return ret_ref;
44126 }
44127
44128 int8_tArray  __attribute__((export_name("TS_HtlcKey_to_public_key"))) TS_HtlcKey_to_public_key(uint64_t this_arg) {
44129         LDKHtlcKey this_arg_conv;
44130         this_arg_conv.inner = untag_ptr(this_arg);
44131         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44133         this_arg_conv.is_owned = false;
44134         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44135         memcpy(ret_arr->elems, HtlcKey_to_public_key(&this_arg_conv).compressed_form, 33);
44136         return ret_arr;
44137 }
44138
44139 int8_tArray  __attribute__((export_name("TS_HtlcKey_write"))) TS_HtlcKey_write(uint64_t obj) {
44140         LDKHtlcKey obj_conv;
44141         obj_conv.inner = untag_ptr(obj);
44142         obj_conv.is_owned = ptr_is_owned(obj);
44143         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44144         obj_conv.is_owned = false;
44145         LDKCVec_u8Z ret_var = HtlcKey_write(&obj_conv);
44146         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44147         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44148         CVec_u8Z_free(ret_var);
44149         return ret_arr;
44150 }
44151
44152 uint64_t  __attribute__((export_name("TS_HtlcKey_read"))) TS_HtlcKey_read(int8_tArray ser) {
44153         LDKu8slice ser_ref;
44154         ser_ref.datalen = ser->arr_len;
44155         ser_ref.data = ser->elems;
44156         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
44157         *ret_conv = HtlcKey_read(ser_ref);
44158         FREE(ser);
44159         return tag_ptr(ret_conv, true);
44160 }
44161
44162 int8_tArray  __attribute__((export_name("TS_add_public_key_tweak"))) TS_add_public_key_tweak(int8_tArray base_point, int8_tArray tweak) {
44163         LDKPublicKey base_point_ref;
44164         CHECK(base_point->arr_len == 33);
44165         memcpy(base_point_ref.compressed_form, base_point->elems, 33); FREE(base_point);
44166         uint8_t tweak_arr[32];
44167         CHECK(tweak->arr_len == 32);
44168         memcpy(tweak_arr, tweak->elems, 32); FREE(tweak);
44169         uint8_t (*tweak_ref)[32] = &tweak_arr;
44170         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44171         memcpy(ret_arr->elems, add_public_key_tweak(base_point_ref, tweak_ref).compressed_form, 33);
44172         return ret_arr;
44173 }
44174
44175 void  __attribute__((export_name("TS_RevocationBasepoint_free"))) TS_RevocationBasepoint_free(uint64_t this_obj) {
44176         LDKRevocationBasepoint this_obj_conv;
44177         this_obj_conv.inner = untag_ptr(this_obj);
44178         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44180         RevocationBasepoint_free(this_obj_conv);
44181 }
44182
44183 int8_tArray  __attribute__((export_name("TS_RevocationBasepoint_get_a"))) TS_RevocationBasepoint_get_a(uint64_t this_ptr) {
44184         LDKRevocationBasepoint this_ptr_conv;
44185         this_ptr_conv.inner = untag_ptr(this_ptr);
44186         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44188         this_ptr_conv.is_owned = false;
44189         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44190         memcpy(ret_arr->elems, RevocationBasepoint_get_a(&this_ptr_conv).compressed_form, 33);
44191         return ret_arr;
44192 }
44193
44194 void  __attribute__((export_name("TS_RevocationBasepoint_set_a"))) TS_RevocationBasepoint_set_a(uint64_t this_ptr, int8_tArray val) {
44195         LDKRevocationBasepoint this_ptr_conv;
44196         this_ptr_conv.inner = untag_ptr(this_ptr);
44197         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44199         this_ptr_conv.is_owned = false;
44200         LDKPublicKey val_ref;
44201         CHECK(val->arr_len == 33);
44202         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
44203         RevocationBasepoint_set_a(&this_ptr_conv, val_ref);
44204 }
44205
44206 uint64_t  __attribute__((export_name("TS_RevocationBasepoint_new"))) TS_RevocationBasepoint_new(int8_tArray a_arg) {
44207         LDKPublicKey a_arg_ref;
44208         CHECK(a_arg->arr_len == 33);
44209         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
44210         LDKRevocationBasepoint ret_var = RevocationBasepoint_new(a_arg_ref);
44211         uint64_t ret_ref = 0;
44212         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44213         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44214         return ret_ref;
44215 }
44216
44217 jboolean  __attribute__((export_name("TS_RevocationBasepoint_eq"))) TS_RevocationBasepoint_eq(uint64_t a, uint64_t b) {
44218         LDKRevocationBasepoint a_conv;
44219         a_conv.inner = untag_ptr(a);
44220         a_conv.is_owned = ptr_is_owned(a);
44221         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44222         a_conv.is_owned = false;
44223         LDKRevocationBasepoint b_conv;
44224         b_conv.inner = untag_ptr(b);
44225         b_conv.is_owned = ptr_is_owned(b);
44226         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44227         b_conv.is_owned = false;
44228         jboolean ret_conv = RevocationBasepoint_eq(&a_conv, &b_conv);
44229         return ret_conv;
44230 }
44231
44232 static inline uint64_t RevocationBasepoint_clone_ptr(LDKRevocationBasepoint *NONNULL_PTR arg) {
44233         LDKRevocationBasepoint ret_var = RevocationBasepoint_clone(arg);
44234         uint64_t ret_ref = 0;
44235         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44236         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44237         return ret_ref;
44238 }
44239 int64_t  __attribute__((export_name("TS_RevocationBasepoint_clone_ptr"))) TS_RevocationBasepoint_clone_ptr(uint64_t arg) {
44240         LDKRevocationBasepoint arg_conv;
44241         arg_conv.inner = untag_ptr(arg);
44242         arg_conv.is_owned = ptr_is_owned(arg);
44243         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44244         arg_conv.is_owned = false;
44245         int64_t ret_conv = RevocationBasepoint_clone_ptr(&arg_conv);
44246         return ret_conv;
44247 }
44248
44249 uint64_t  __attribute__((export_name("TS_RevocationBasepoint_clone"))) TS_RevocationBasepoint_clone(uint64_t orig) {
44250         LDKRevocationBasepoint orig_conv;
44251         orig_conv.inner = untag_ptr(orig);
44252         orig_conv.is_owned = ptr_is_owned(orig);
44253         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44254         orig_conv.is_owned = false;
44255         LDKRevocationBasepoint ret_var = RevocationBasepoint_clone(&orig_conv);
44256         uint64_t ret_ref = 0;
44257         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44258         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44259         return ret_ref;
44260 }
44261
44262 int64_t  __attribute__((export_name("TS_RevocationBasepoint_hash"))) TS_RevocationBasepoint_hash(uint64_t o) {
44263         LDKRevocationBasepoint o_conv;
44264         o_conv.inner = untag_ptr(o);
44265         o_conv.is_owned = ptr_is_owned(o);
44266         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44267         o_conv.is_owned = false;
44268         int64_t ret_conv = RevocationBasepoint_hash(&o_conv);
44269         return ret_conv;
44270 }
44271
44272 int8_tArray  __attribute__((export_name("TS_RevocationBasepoint_to_public_key"))) TS_RevocationBasepoint_to_public_key(uint64_t this_arg) {
44273         LDKRevocationBasepoint this_arg_conv;
44274         this_arg_conv.inner = untag_ptr(this_arg);
44275         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44277         this_arg_conv.is_owned = false;
44278         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44279         memcpy(ret_arr->elems, RevocationBasepoint_to_public_key(&this_arg_conv).compressed_form, 33);
44280         return ret_arr;
44281 }
44282
44283 int8_tArray  __attribute__((export_name("TS_RevocationBasepoint_write"))) TS_RevocationBasepoint_write(uint64_t obj) {
44284         LDKRevocationBasepoint obj_conv;
44285         obj_conv.inner = untag_ptr(obj);
44286         obj_conv.is_owned = ptr_is_owned(obj);
44287         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44288         obj_conv.is_owned = false;
44289         LDKCVec_u8Z ret_var = RevocationBasepoint_write(&obj_conv);
44290         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44291         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44292         CVec_u8Z_free(ret_var);
44293         return ret_arr;
44294 }
44295
44296 uint64_t  __attribute__((export_name("TS_RevocationBasepoint_read"))) TS_RevocationBasepoint_read(int8_tArray ser) {
44297         LDKu8slice ser_ref;
44298         ser_ref.datalen = ser->arr_len;
44299         ser_ref.data = ser->elems;
44300         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
44301         *ret_conv = RevocationBasepoint_read(ser_ref);
44302         FREE(ser);
44303         return tag_ptr(ret_conv, true);
44304 }
44305
44306 void  __attribute__((export_name("TS_RevocationKey_free"))) TS_RevocationKey_free(uint64_t this_obj) {
44307         LDKRevocationKey this_obj_conv;
44308         this_obj_conv.inner = untag_ptr(this_obj);
44309         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44311         RevocationKey_free(this_obj_conv);
44312 }
44313
44314 int8_tArray  __attribute__((export_name("TS_RevocationKey_get_a"))) TS_RevocationKey_get_a(uint64_t this_ptr) {
44315         LDKRevocationKey this_ptr_conv;
44316         this_ptr_conv.inner = untag_ptr(this_ptr);
44317         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44319         this_ptr_conv.is_owned = false;
44320         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44321         memcpy(ret_arr->elems, RevocationKey_get_a(&this_ptr_conv).compressed_form, 33);
44322         return ret_arr;
44323 }
44324
44325 void  __attribute__((export_name("TS_RevocationKey_set_a"))) TS_RevocationKey_set_a(uint64_t this_ptr, int8_tArray val) {
44326         LDKRevocationKey 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         LDKPublicKey val_ref;
44332         CHECK(val->arr_len == 33);
44333         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
44334         RevocationKey_set_a(&this_ptr_conv, val_ref);
44335 }
44336
44337 uint64_t  __attribute__((export_name("TS_RevocationKey_new"))) TS_RevocationKey_new(int8_tArray a_arg) {
44338         LDKPublicKey a_arg_ref;
44339         CHECK(a_arg->arr_len == 33);
44340         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
44341         LDKRevocationKey ret_var = RevocationKey_new(a_arg_ref);
44342         uint64_t ret_ref = 0;
44343         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44344         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44345         return ret_ref;
44346 }
44347
44348 jboolean  __attribute__((export_name("TS_RevocationKey_eq"))) TS_RevocationKey_eq(uint64_t a, uint64_t b) {
44349         LDKRevocationKey a_conv;
44350         a_conv.inner = untag_ptr(a);
44351         a_conv.is_owned = ptr_is_owned(a);
44352         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44353         a_conv.is_owned = false;
44354         LDKRevocationKey b_conv;
44355         b_conv.inner = untag_ptr(b);
44356         b_conv.is_owned = ptr_is_owned(b);
44357         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44358         b_conv.is_owned = false;
44359         jboolean ret_conv = RevocationKey_eq(&a_conv, &b_conv);
44360         return ret_conv;
44361 }
44362
44363 static inline uint64_t RevocationKey_clone_ptr(LDKRevocationKey *NONNULL_PTR arg) {
44364         LDKRevocationKey ret_var = RevocationKey_clone(arg);
44365         uint64_t ret_ref = 0;
44366         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44367         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44368         return ret_ref;
44369 }
44370 int64_t  __attribute__((export_name("TS_RevocationKey_clone_ptr"))) TS_RevocationKey_clone_ptr(uint64_t arg) {
44371         LDKRevocationKey arg_conv;
44372         arg_conv.inner = untag_ptr(arg);
44373         arg_conv.is_owned = ptr_is_owned(arg);
44374         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44375         arg_conv.is_owned = false;
44376         int64_t ret_conv = RevocationKey_clone_ptr(&arg_conv);
44377         return ret_conv;
44378 }
44379
44380 uint64_t  __attribute__((export_name("TS_RevocationKey_clone"))) TS_RevocationKey_clone(uint64_t orig) {
44381         LDKRevocationKey orig_conv;
44382         orig_conv.inner = untag_ptr(orig);
44383         orig_conv.is_owned = ptr_is_owned(orig);
44384         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44385         orig_conv.is_owned = false;
44386         LDKRevocationKey ret_var = RevocationKey_clone(&orig_conv);
44387         uint64_t ret_ref = 0;
44388         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44389         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44390         return ret_ref;
44391 }
44392
44393 int64_t  __attribute__((export_name("TS_RevocationKey_hash"))) TS_RevocationKey_hash(uint64_t o) {
44394         LDKRevocationKey o_conv;
44395         o_conv.inner = untag_ptr(o);
44396         o_conv.is_owned = ptr_is_owned(o);
44397         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44398         o_conv.is_owned = false;
44399         int64_t ret_conv = RevocationKey_hash(&o_conv);
44400         return ret_conv;
44401 }
44402
44403 uint64_t  __attribute__((export_name("TS_RevocationKey_from_basepoint"))) TS_RevocationKey_from_basepoint(uint64_t countersignatory_basepoint, int8_tArray per_commitment_point) {
44404         LDKRevocationBasepoint countersignatory_basepoint_conv;
44405         countersignatory_basepoint_conv.inner = untag_ptr(countersignatory_basepoint);
44406         countersignatory_basepoint_conv.is_owned = ptr_is_owned(countersignatory_basepoint);
44407         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_basepoint_conv);
44408         countersignatory_basepoint_conv.is_owned = false;
44409         LDKPublicKey per_commitment_point_ref;
44410         CHECK(per_commitment_point->arr_len == 33);
44411         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
44412         LDKRevocationKey ret_var = RevocationKey_from_basepoint(&countersignatory_basepoint_conv, per_commitment_point_ref);
44413         uint64_t ret_ref = 0;
44414         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44415         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44416         return ret_ref;
44417 }
44418
44419 int8_tArray  __attribute__((export_name("TS_RevocationKey_to_public_key"))) TS_RevocationKey_to_public_key(uint64_t this_arg) {
44420         LDKRevocationKey this_arg_conv;
44421         this_arg_conv.inner = untag_ptr(this_arg);
44422         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44424         this_arg_conv.is_owned = false;
44425         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44426         memcpy(ret_arr->elems, RevocationKey_to_public_key(&this_arg_conv).compressed_form, 33);
44427         return ret_arr;
44428 }
44429
44430 int8_tArray  __attribute__((export_name("TS_RevocationKey_write"))) TS_RevocationKey_write(uint64_t obj) {
44431         LDKRevocationKey obj_conv;
44432         obj_conv.inner = untag_ptr(obj);
44433         obj_conv.is_owned = ptr_is_owned(obj);
44434         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44435         obj_conv.is_owned = false;
44436         LDKCVec_u8Z ret_var = RevocationKey_write(&obj_conv);
44437         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44438         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44439         CVec_u8Z_free(ret_var);
44440         return ret_arr;
44441 }
44442
44443 uint64_t  __attribute__((export_name("TS_RevocationKey_read"))) TS_RevocationKey_read(int8_tArray ser) {
44444         LDKu8slice ser_ref;
44445         ser_ref.datalen = ser->arr_len;
44446         ser_ref.data = ser->elems;
44447         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
44448         *ret_conv = RevocationKey_read(ser_ref);
44449         FREE(ser);
44450         return tag_ptr(ret_conv, true);
44451 }
44452
44453 void  __attribute__((export_name("TS_ExpandedKey_free"))) TS_ExpandedKey_free(uint64_t this_obj) {
44454         LDKExpandedKey this_obj_conv;
44455         this_obj_conv.inner = untag_ptr(this_obj);
44456         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44458         ExpandedKey_free(this_obj_conv);
44459 }
44460
44461 uint64_t  __attribute__((export_name("TS_ExpandedKey_new"))) TS_ExpandedKey_new(int8_tArray key_material) {
44462         uint8_t key_material_arr[32];
44463         CHECK(key_material->arr_len == 32);
44464         memcpy(key_material_arr, key_material->elems, 32); FREE(key_material);
44465         uint8_t (*key_material_ref)[32] = &key_material_arr;
44466         LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
44467         uint64_t ret_ref = 0;
44468         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44469         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44470         return ret_ref;
44471 }
44472
44473 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) {
44474         LDKExpandedKey keys_conv;
44475         keys_conv.inner = untag_ptr(keys);
44476         keys_conv.is_owned = ptr_is_owned(keys);
44477         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
44478         keys_conv.is_owned = false;
44479         void* min_value_msat_ptr = untag_ptr(min_value_msat);
44480         CHECK_ACCESS(min_value_msat_ptr);
44481         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
44482         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
44483         void* entropy_source_ptr = untag_ptr(entropy_source);
44484         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
44485         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
44486         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
44487         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
44488         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
44489         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
44490         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
44491         *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, entropy_source_conv, current_time, min_final_cltv_expiry_delta_conv);
44492         return tag_ptr(ret_conv, true);
44493 }
44494
44495 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) {
44496         LDKExpandedKey keys_conv;
44497         keys_conv.inner = untag_ptr(keys);
44498         keys_conv.is_owned = ptr_is_owned(keys);
44499         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
44500         keys_conv.is_owned = false;
44501         void* min_value_msat_ptr = untag_ptr(min_value_msat);
44502         CHECK_ACCESS(min_value_msat_ptr);
44503         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
44504         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
44505         LDKThirtyTwoBytes payment_hash_ref;
44506         CHECK(payment_hash->arr_len == 32);
44507         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
44508         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
44509         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
44510         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
44511         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
44512         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
44513         *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);
44514         return tag_ptr(ret_conv, true);
44515 }
44516
44517 void  __attribute__((export_name("TS_DecodeError_free"))) TS_DecodeError_free(uint64_t this_ptr) {
44518         if (!ptr_is_owned(this_ptr)) return;
44519         void* this_ptr_ptr = untag_ptr(this_ptr);
44520         CHECK_ACCESS(this_ptr_ptr);
44521         LDKDecodeError this_ptr_conv = *(LDKDecodeError*)(this_ptr_ptr);
44522         FREE(untag_ptr(this_ptr));
44523         DecodeError_free(this_ptr_conv);
44524 }
44525
44526 static inline uint64_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
44527         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
44528         *ret_copy = DecodeError_clone(arg);
44529         uint64_t ret_ref = tag_ptr(ret_copy, true);
44530         return ret_ref;
44531 }
44532 int64_t  __attribute__((export_name("TS_DecodeError_clone_ptr"))) TS_DecodeError_clone_ptr(uint64_t arg) {
44533         LDKDecodeError* arg_conv = (LDKDecodeError*)untag_ptr(arg);
44534         int64_t ret_conv = DecodeError_clone_ptr(arg_conv);
44535         return ret_conv;
44536 }
44537
44538 uint64_t  __attribute__((export_name("TS_DecodeError_clone"))) TS_DecodeError_clone(uint64_t orig) {
44539         LDKDecodeError* orig_conv = (LDKDecodeError*)untag_ptr(orig);
44540         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
44541         *ret_copy = DecodeError_clone(orig_conv);
44542         uint64_t ret_ref = tag_ptr(ret_copy, true);
44543         return ret_ref;
44544 }
44545
44546 uint64_t  __attribute__((export_name("TS_DecodeError_unknown_version"))) TS_DecodeError_unknown_version() {
44547         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
44548         *ret_copy = DecodeError_unknown_version();
44549         uint64_t ret_ref = tag_ptr(ret_copy, true);
44550         return ret_ref;
44551 }
44552
44553 uint64_t  __attribute__((export_name("TS_DecodeError_unknown_required_feature"))) TS_DecodeError_unknown_required_feature() {
44554         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
44555         *ret_copy = DecodeError_unknown_required_feature();
44556         uint64_t ret_ref = tag_ptr(ret_copy, true);
44557         return ret_ref;
44558 }
44559
44560 uint64_t  __attribute__((export_name("TS_DecodeError_invalid_value"))) TS_DecodeError_invalid_value() {
44561         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
44562         *ret_copy = DecodeError_invalid_value();
44563         uint64_t ret_ref = tag_ptr(ret_copy, true);
44564         return ret_ref;
44565 }
44566
44567 uint64_t  __attribute__((export_name("TS_DecodeError_short_read"))) TS_DecodeError_short_read() {
44568         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
44569         *ret_copy = DecodeError_short_read();
44570         uint64_t ret_ref = tag_ptr(ret_copy, true);
44571         return ret_ref;
44572 }
44573
44574 uint64_t  __attribute__((export_name("TS_DecodeError_bad_length_descriptor"))) TS_DecodeError_bad_length_descriptor() {
44575         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
44576         *ret_copy = DecodeError_bad_length_descriptor();
44577         uint64_t ret_ref = tag_ptr(ret_copy, true);
44578         return ret_ref;
44579 }
44580
44581 uint64_t  __attribute__((export_name("TS_DecodeError_io"))) TS_DecodeError_io(uint32_t a) {
44582         LDKIOError a_conv = LDKIOError_from_js(a);
44583         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
44584         *ret_copy = DecodeError_io(a_conv);
44585         uint64_t ret_ref = tag_ptr(ret_copy, true);
44586         return ret_ref;
44587 }
44588
44589 uint64_t  __attribute__((export_name("TS_DecodeError_unsupported_compression"))) TS_DecodeError_unsupported_compression() {
44590         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
44591         *ret_copy = DecodeError_unsupported_compression();
44592         uint64_t ret_ref = tag_ptr(ret_copy, true);
44593         return ret_ref;
44594 }
44595
44596 uint64_t  __attribute__((export_name("TS_DecodeError_dangerous_value"))) TS_DecodeError_dangerous_value() {
44597         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
44598         *ret_copy = DecodeError_dangerous_value();
44599         uint64_t ret_ref = tag_ptr(ret_copy, true);
44600         return ret_ref;
44601 }
44602
44603 int64_t  __attribute__((export_name("TS_DecodeError_hash"))) TS_DecodeError_hash(uint64_t o) {
44604         LDKDecodeError* o_conv = (LDKDecodeError*)untag_ptr(o);
44605         int64_t ret_conv = DecodeError_hash(o_conv);
44606         return ret_conv;
44607 }
44608
44609 jboolean  __attribute__((export_name("TS_DecodeError_eq"))) TS_DecodeError_eq(uint64_t a, uint64_t b) {
44610         LDKDecodeError* a_conv = (LDKDecodeError*)untag_ptr(a);
44611         LDKDecodeError* b_conv = (LDKDecodeError*)untag_ptr(b);
44612         jboolean ret_conv = DecodeError_eq(a_conv, b_conv);
44613         return ret_conv;
44614 }
44615
44616 void  __attribute__((export_name("TS_Init_free"))) TS_Init_free(uint64_t this_obj) {
44617         LDKInit this_obj_conv;
44618         this_obj_conv.inner = untag_ptr(this_obj);
44619         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44621         Init_free(this_obj_conv);
44622 }
44623
44624 uint64_t  __attribute__((export_name("TS_Init_get_features"))) TS_Init_get_features(uint64_t this_ptr) {
44625         LDKInit this_ptr_conv;
44626         this_ptr_conv.inner = untag_ptr(this_ptr);
44627         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44629         this_ptr_conv.is_owned = false;
44630         LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
44631         uint64_t ret_ref = 0;
44632         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44633         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44634         return ret_ref;
44635 }
44636
44637 void  __attribute__((export_name("TS_Init_set_features"))) TS_Init_set_features(uint64_t this_ptr, uint64_t val) {
44638         LDKInit this_ptr_conv;
44639         this_ptr_conv.inner = untag_ptr(this_ptr);
44640         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44642         this_ptr_conv.is_owned = false;
44643         LDKInitFeatures val_conv;
44644         val_conv.inner = untag_ptr(val);
44645         val_conv.is_owned = ptr_is_owned(val);
44646         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44647         val_conv = InitFeatures_clone(&val_conv);
44648         Init_set_features(&this_ptr_conv, val_conv);
44649 }
44650
44651 uint64_t  __attribute__((export_name("TS_Init_get_networks"))) TS_Init_get_networks(uint64_t this_ptr) {
44652         LDKInit this_ptr_conv;
44653         this_ptr_conv.inner = untag_ptr(this_ptr);
44654         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44656         this_ptr_conv.is_owned = false;
44657         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
44658         *ret_copy = Init_get_networks(&this_ptr_conv);
44659         uint64_t ret_ref = tag_ptr(ret_copy, true);
44660         return ret_ref;
44661 }
44662
44663 void  __attribute__((export_name("TS_Init_set_networks"))) TS_Init_set_networks(uint64_t this_ptr, uint64_t val) {
44664         LDKInit 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         void* val_ptr = untag_ptr(val);
44670         CHECK_ACCESS(val_ptr);
44671         LDKCOption_CVec_ThirtyTwoBytesZZ val_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(val_ptr);
44672         val_conv = COption_CVec_ThirtyTwoBytesZZ_clone((LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(val));
44673         Init_set_networks(&this_ptr_conv, val_conv);
44674 }
44675
44676 uint64_t  __attribute__((export_name("TS_Init_get_remote_network_address"))) TS_Init_get_remote_network_address(uint64_t this_ptr) {
44677         LDKInit this_ptr_conv;
44678         this_ptr_conv.inner = untag_ptr(this_ptr);
44679         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44681         this_ptr_conv.is_owned = false;
44682         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
44683         *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
44684         uint64_t ret_ref = tag_ptr(ret_copy, true);
44685         return ret_ref;
44686 }
44687
44688 void  __attribute__((export_name("TS_Init_set_remote_network_address"))) TS_Init_set_remote_network_address(uint64_t this_ptr, uint64_t val) {
44689         LDKInit 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         void* val_ptr = untag_ptr(val);
44695         CHECK_ACCESS(val_ptr);
44696         LDKCOption_SocketAddressZ val_conv = *(LDKCOption_SocketAddressZ*)(val_ptr);
44697         val_conv = COption_SocketAddressZ_clone((LDKCOption_SocketAddressZ*)untag_ptr(val));
44698         Init_set_remote_network_address(&this_ptr_conv, val_conv);
44699 }
44700
44701 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) {
44702         LDKInitFeatures features_arg_conv;
44703         features_arg_conv.inner = untag_ptr(features_arg);
44704         features_arg_conv.is_owned = ptr_is_owned(features_arg);
44705         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
44706         features_arg_conv = InitFeatures_clone(&features_arg_conv);
44707         void* networks_arg_ptr = untag_ptr(networks_arg);
44708         CHECK_ACCESS(networks_arg_ptr);
44709         LDKCOption_CVec_ThirtyTwoBytesZZ networks_arg_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(networks_arg_ptr);
44710         networks_arg_conv = COption_CVec_ThirtyTwoBytesZZ_clone((LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(networks_arg));
44711         void* remote_network_address_arg_ptr = untag_ptr(remote_network_address_arg);
44712         CHECK_ACCESS(remote_network_address_arg_ptr);
44713         LDKCOption_SocketAddressZ remote_network_address_arg_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_arg_ptr);
44714         LDKInit ret_var = Init_new(features_arg_conv, networks_arg_conv, remote_network_address_arg_conv);
44715         uint64_t ret_ref = 0;
44716         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44717         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44718         return ret_ref;
44719 }
44720
44721 static inline uint64_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
44722         LDKInit ret_var = Init_clone(arg);
44723         uint64_t ret_ref = 0;
44724         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44725         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44726         return ret_ref;
44727 }
44728 int64_t  __attribute__((export_name("TS_Init_clone_ptr"))) TS_Init_clone_ptr(uint64_t arg) {
44729         LDKInit arg_conv;
44730         arg_conv.inner = untag_ptr(arg);
44731         arg_conv.is_owned = ptr_is_owned(arg);
44732         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44733         arg_conv.is_owned = false;
44734         int64_t ret_conv = Init_clone_ptr(&arg_conv);
44735         return ret_conv;
44736 }
44737
44738 uint64_t  __attribute__((export_name("TS_Init_clone"))) TS_Init_clone(uint64_t orig) {
44739         LDKInit orig_conv;
44740         orig_conv.inner = untag_ptr(orig);
44741         orig_conv.is_owned = ptr_is_owned(orig);
44742         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44743         orig_conv.is_owned = false;
44744         LDKInit ret_var = Init_clone(&orig_conv);
44745         uint64_t ret_ref = 0;
44746         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44747         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44748         return ret_ref;
44749 }
44750
44751 int64_t  __attribute__((export_name("TS_Init_hash"))) TS_Init_hash(uint64_t o) {
44752         LDKInit o_conv;
44753         o_conv.inner = untag_ptr(o);
44754         o_conv.is_owned = ptr_is_owned(o);
44755         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44756         o_conv.is_owned = false;
44757         int64_t ret_conv = Init_hash(&o_conv);
44758         return ret_conv;
44759 }
44760
44761 jboolean  __attribute__((export_name("TS_Init_eq"))) TS_Init_eq(uint64_t a, uint64_t b) {
44762         LDKInit a_conv;
44763         a_conv.inner = untag_ptr(a);
44764         a_conv.is_owned = ptr_is_owned(a);
44765         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44766         a_conv.is_owned = false;
44767         LDKInit b_conv;
44768         b_conv.inner = untag_ptr(b);
44769         b_conv.is_owned = ptr_is_owned(b);
44770         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44771         b_conv.is_owned = false;
44772         jboolean ret_conv = Init_eq(&a_conv, &b_conv);
44773         return ret_conv;
44774 }
44775
44776 void  __attribute__((export_name("TS_ErrorMessage_free"))) TS_ErrorMessage_free(uint64_t this_obj) {
44777         LDKErrorMessage this_obj_conv;
44778         this_obj_conv.inner = untag_ptr(this_obj);
44779         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44781         ErrorMessage_free(this_obj_conv);
44782 }
44783
44784 uint64_t  __attribute__((export_name("TS_ErrorMessage_get_channel_id"))) TS_ErrorMessage_get_channel_id(uint64_t this_ptr) {
44785         LDKErrorMessage this_ptr_conv;
44786         this_ptr_conv.inner = untag_ptr(this_ptr);
44787         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44789         this_ptr_conv.is_owned = false;
44790         LDKChannelId ret_var = ErrorMessage_get_channel_id(&this_ptr_conv);
44791         uint64_t ret_ref = 0;
44792         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44793         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44794         return ret_ref;
44795 }
44796
44797 void  __attribute__((export_name("TS_ErrorMessage_set_channel_id"))) TS_ErrorMessage_set_channel_id(uint64_t this_ptr, uint64_t val) {
44798         LDKErrorMessage this_ptr_conv;
44799         this_ptr_conv.inner = untag_ptr(this_ptr);
44800         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44802         this_ptr_conv.is_owned = false;
44803         LDKChannelId val_conv;
44804         val_conv.inner = untag_ptr(val);
44805         val_conv.is_owned = ptr_is_owned(val);
44806         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44807         val_conv = ChannelId_clone(&val_conv);
44808         ErrorMessage_set_channel_id(&this_ptr_conv, val_conv);
44809 }
44810
44811 jstring  __attribute__((export_name("TS_ErrorMessage_get_data"))) TS_ErrorMessage_get_data(uint64_t this_ptr) {
44812         LDKErrorMessage this_ptr_conv;
44813         this_ptr_conv.inner = untag_ptr(this_ptr);
44814         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44816         this_ptr_conv.is_owned = false;
44817         LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
44818         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
44819         Str_free(ret_str);
44820         return ret_conv;
44821 }
44822
44823 void  __attribute__((export_name("TS_ErrorMessage_set_data"))) TS_ErrorMessage_set_data(uint64_t this_ptr, jstring val) {
44824         LDKErrorMessage this_ptr_conv;
44825         this_ptr_conv.inner = untag_ptr(this_ptr);
44826         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44828         this_ptr_conv.is_owned = false;
44829         LDKStr val_conv = str_ref_to_owned_c(val);
44830         ErrorMessage_set_data(&this_ptr_conv, val_conv);
44831 }
44832
44833 uint64_t  __attribute__((export_name("TS_ErrorMessage_new"))) TS_ErrorMessage_new(uint64_t channel_id_arg, jstring data_arg) {
44834         LDKChannelId channel_id_arg_conv;
44835         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
44836         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
44837         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
44838         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
44839         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
44840         LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_conv, data_arg_conv);
44841         uint64_t ret_ref = 0;
44842         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44843         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44844         return ret_ref;
44845 }
44846
44847 static inline uint64_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
44848         LDKErrorMessage ret_var = ErrorMessage_clone(arg);
44849         uint64_t ret_ref = 0;
44850         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44851         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44852         return ret_ref;
44853 }
44854 int64_t  __attribute__((export_name("TS_ErrorMessage_clone_ptr"))) TS_ErrorMessage_clone_ptr(uint64_t arg) {
44855         LDKErrorMessage arg_conv;
44856         arg_conv.inner = untag_ptr(arg);
44857         arg_conv.is_owned = ptr_is_owned(arg);
44858         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44859         arg_conv.is_owned = false;
44860         int64_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
44861         return ret_conv;
44862 }
44863
44864 uint64_t  __attribute__((export_name("TS_ErrorMessage_clone"))) TS_ErrorMessage_clone(uint64_t orig) {
44865         LDKErrorMessage orig_conv;
44866         orig_conv.inner = untag_ptr(orig);
44867         orig_conv.is_owned = ptr_is_owned(orig);
44868         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44869         orig_conv.is_owned = false;
44870         LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
44871         uint64_t ret_ref = 0;
44872         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44873         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44874         return ret_ref;
44875 }
44876
44877 int64_t  __attribute__((export_name("TS_ErrorMessage_hash"))) TS_ErrorMessage_hash(uint64_t o) {
44878         LDKErrorMessage o_conv;
44879         o_conv.inner = untag_ptr(o);
44880         o_conv.is_owned = ptr_is_owned(o);
44881         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44882         o_conv.is_owned = false;
44883         int64_t ret_conv = ErrorMessage_hash(&o_conv);
44884         return ret_conv;
44885 }
44886
44887 jboolean  __attribute__((export_name("TS_ErrorMessage_eq"))) TS_ErrorMessage_eq(uint64_t a, uint64_t b) {
44888         LDKErrorMessage a_conv;
44889         a_conv.inner = untag_ptr(a);
44890         a_conv.is_owned = ptr_is_owned(a);
44891         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44892         a_conv.is_owned = false;
44893         LDKErrorMessage b_conv;
44894         b_conv.inner = untag_ptr(b);
44895         b_conv.is_owned = ptr_is_owned(b);
44896         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44897         b_conv.is_owned = false;
44898         jboolean ret_conv = ErrorMessage_eq(&a_conv, &b_conv);
44899         return ret_conv;
44900 }
44901
44902 void  __attribute__((export_name("TS_WarningMessage_free"))) TS_WarningMessage_free(uint64_t this_obj) {
44903         LDKWarningMessage this_obj_conv;
44904         this_obj_conv.inner = untag_ptr(this_obj);
44905         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44907         WarningMessage_free(this_obj_conv);
44908 }
44909
44910 uint64_t  __attribute__((export_name("TS_WarningMessage_get_channel_id"))) TS_WarningMessage_get_channel_id(uint64_t this_ptr) {
44911         LDKWarningMessage this_ptr_conv;
44912         this_ptr_conv.inner = untag_ptr(this_ptr);
44913         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44915         this_ptr_conv.is_owned = false;
44916         LDKChannelId ret_var = WarningMessage_get_channel_id(&this_ptr_conv);
44917         uint64_t ret_ref = 0;
44918         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44919         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44920         return ret_ref;
44921 }
44922
44923 void  __attribute__((export_name("TS_WarningMessage_set_channel_id"))) TS_WarningMessage_set_channel_id(uint64_t this_ptr, uint64_t val) {
44924         LDKWarningMessage 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         LDKChannelId val_conv;
44930         val_conv.inner = untag_ptr(val);
44931         val_conv.is_owned = ptr_is_owned(val);
44932         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44933         val_conv = ChannelId_clone(&val_conv);
44934         WarningMessage_set_channel_id(&this_ptr_conv, val_conv);
44935 }
44936
44937 jstring  __attribute__((export_name("TS_WarningMessage_get_data"))) TS_WarningMessage_get_data(uint64_t this_ptr) {
44938         LDKWarningMessage this_ptr_conv;
44939         this_ptr_conv.inner = untag_ptr(this_ptr);
44940         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44942         this_ptr_conv.is_owned = false;
44943         LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
44944         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
44945         Str_free(ret_str);
44946         return ret_conv;
44947 }
44948
44949 void  __attribute__((export_name("TS_WarningMessage_set_data"))) TS_WarningMessage_set_data(uint64_t this_ptr, jstring val) {
44950         LDKWarningMessage this_ptr_conv;
44951         this_ptr_conv.inner = untag_ptr(this_ptr);
44952         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44954         this_ptr_conv.is_owned = false;
44955         LDKStr val_conv = str_ref_to_owned_c(val);
44956         WarningMessage_set_data(&this_ptr_conv, val_conv);
44957 }
44958
44959 uint64_t  __attribute__((export_name("TS_WarningMessage_new"))) TS_WarningMessage_new(uint64_t channel_id_arg, jstring data_arg) {
44960         LDKChannelId channel_id_arg_conv;
44961         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
44962         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
44963         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
44964         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
44965         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
44966         LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_conv, data_arg_conv);
44967         uint64_t ret_ref = 0;
44968         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44969         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44970         return ret_ref;
44971 }
44972
44973 static inline uint64_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
44974         LDKWarningMessage ret_var = WarningMessage_clone(arg);
44975         uint64_t ret_ref = 0;
44976         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44977         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44978         return ret_ref;
44979 }
44980 int64_t  __attribute__((export_name("TS_WarningMessage_clone_ptr"))) TS_WarningMessage_clone_ptr(uint64_t arg) {
44981         LDKWarningMessage arg_conv;
44982         arg_conv.inner = untag_ptr(arg);
44983         arg_conv.is_owned = ptr_is_owned(arg);
44984         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44985         arg_conv.is_owned = false;
44986         int64_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
44987         return ret_conv;
44988 }
44989
44990 uint64_t  __attribute__((export_name("TS_WarningMessage_clone"))) TS_WarningMessage_clone(uint64_t orig) {
44991         LDKWarningMessage orig_conv;
44992         orig_conv.inner = untag_ptr(orig);
44993         orig_conv.is_owned = ptr_is_owned(orig);
44994         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44995         orig_conv.is_owned = false;
44996         LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
44997         uint64_t ret_ref = 0;
44998         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44999         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45000         return ret_ref;
45001 }
45002
45003 int64_t  __attribute__((export_name("TS_WarningMessage_hash"))) TS_WarningMessage_hash(uint64_t o) {
45004         LDKWarningMessage o_conv;
45005         o_conv.inner = untag_ptr(o);
45006         o_conv.is_owned = ptr_is_owned(o);
45007         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45008         o_conv.is_owned = false;
45009         int64_t ret_conv = WarningMessage_hash(&o_conv);
45010         return ret_conv;
45011 }
45012
45013 jboolean  __attribute__((export_name("TS_WarningMessage_eq"))) TS_WarningMessage_eq(uint64_t a, uint64_t b) {
45014         LDKWarningMessage a_conv;
45015         a_conv.inner = untag_ptr(a);
45016         a_conv.is_owned = ptr_is_owned(a);
45017         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45018         a_conv.is_owned = false;
45019         LDKWarningMessage b_conv;
45020         b_conv.inner = untag_ptr(b);
45021         b_conv.is_owned = ptr_is_owned(b);
45022         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45023         b_conv.is_owned = false;
45024         jboolean ret_conv = WarningMessage_eq(&a_conv, &b_conv);
45025         return ret_conv;
45026 }
45027
45028 void  __attribute__((export_name("TS_Ping_free"))) TS_Ping_free(uint64_t this_obj) {
45029         LDKPing this_obj_conv;
45030         this_obj_conv.inner = untag_ptr(this_obj);
45031         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45033         Ping_free(this_obj_conv);
45034 }
45035
45036 int16_t  __attribute__((export_name("TS_Ping_get_ponglen"))) TS_Ping_get_ponglen(uint64_t this_ptr) {
45037         LDKPing this_ptr_conv;
45038         this_ptr_conv.inner = untag_ptr(this_ptr);
45039         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45041         this_ptr_conv.is_owned = false;
45042         int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
45043         return ret_conv;
45044 }
45045
45046 void  __attribute__((export_name("TS_Ping_set_ponglen"))) TS_Ping_set_ponglen(uint64_t this_ptr, int16_t val) {
45047         LDKPing this_ptr_conv;
45048         this_ptr_conv.inner = untag_ptr(this_ptr);
45049         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45051         this_ptr_conv.is_owned = false;
45052         Ping_set_ponglen(&this_ptr_conv, val);
45053 }
45054
45055 int16_t  __attribute__((export_name("TS_Ping_get_byteslen"))) TS_Ping_get_byteslen(uint64_t this_ptr) {
45056         LDKPing this_ptr_conv;
45057         this_ptr_conv.inner = untag_ptr(this_ptr);
45058         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45060         this_ptr_conv.is_owned = false;
45061         int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
45062         return ret_conv;
45063 }
45064
45065 void  __attribute__((export_name("TS_Ping_set_byteslen"))) TS_Ping_set_byteslen(uint64_t this_ptr, int16_t val) {
45066         LDKPing 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         Ping_set_byteslen(&this_ptr_conv, val);
45072 }
45073
45074 uint64_t  __attribute__((export_name("TS_Ping_new"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
45075         LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
45076         uint64_t ret_ref = 0;
45077         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45078         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45079         return ret_ref;
45080 }
45081
45082 static inline uint64_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
45083         LDKPing ret_var = Ping_clone(arg);
45084         uint64_t ret_ref = 0;
45085         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45086         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45087         return ret_ref;
45088 }
45089 int64_t  __attribute__((export_name("TS_Ping_clone_ptr"))) TS_Ping_clone_ptr(uint64_t arg) {
45090         LDKPing arg_conv;
45091         arg_conv.inner = untag_ptr(arg);
45092         arg_conv.is_owned = ptr_is_owned(arg);
45093         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45094         arg_conv.is_owned = false;
45095         int64_t ret_conv = Ping_clone_ptr(&arg_conv);
45096         return ret_conv;
45097 }
45098
45099 uint64_t  __attribute__((export_name("TS_Ping_clone"))) TS_Ping_clone(uint64_t orig) {
45100         LDKPing orig_conv;
45101         orig_conv.inner = untag_ptr(orig);
45102         orig_conv.is_owned = ptr_is_owned(orig);
45103         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45104         orig_conv.is_owned = false;
45105         LDKPing ret_var = Ping_clone(&orig_conv);
45106         uint64_t ret_ref = 0;
45107         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45108         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45109         return ret_ref;
45110 }
45111
45112 int64_t  __attribute__((export_name("TS_Ping_hash"))) TS_Ping_hash(uint64_t o) {
45113         LDKPing o_conv;
45114         o_conv.inner = untag_ptr(o);
45115         o_conv.is_owned = ptr_is_owned(o);
45116         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45117         o_conv.is_owned = false;
45118         int64_t ret_conv = Ping_hash(&o_conv);
45119         return ret_conv;
45120 }
45121
45122 jboolean  __attribute__((export_name("TS_Ping_eq"))) TS_Ping_eq(uint64_t a, uint64_t b) {
45123         LDKPing a_conv;
45124         a_conv.inner = untag_ptr(a);
45125         a_conv.is_owned = ptr_is_owned(a);
45126         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45127         a_conv.is_owned = false;
45128         LDKPing b_conv;
45129         b_conv.inner = untag_ptr(b);
45130         b_conv.is_owned = ptr_is_owned(b);
45131         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45132         b_conv.is_owned = false;
45133         jboolean ret_conv = Ping_eq(&a_conv, &b_conv);
45134         return ret_conv;
45135 }
45136
45137 void  __attribute__((export_name("TS_Pong_free"))) TS_Pong_free(uint64_t this_obj) {
45138         LDKPong this_obj_conv;
45139         this_obj_conv.inner = untag_ptr(this_obj);
45140         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45142         Pong_free(this_obj_conv);
45143 }
45144
45145 int16_t  __attribute__((export_name("TS_Pong_get_byteslen"))) TS_Pong_get_byteslen(uint64_t this_ptr) {
45146         LDKPong 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         int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
45152         return ret_conv;
45153 }
45154
45155 void  __attribute__((export_name("TS_Pong_set_byteslen"))) TS_Pong_set_byteslen(uint64_t this_ptr, int16_t val) {
45156         LDKPong this_ptr_conv;
45157         this_ptr_conv.inner = untag_ptr(this_ptr);
45158         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45160         this_ptr_conv.is_owned = false;
45161         Pong_set_byteslen(&this_ptr_conv, val);
45162 }
45163
45164 uint64_t  __attribute__((export_name("TS_Pong_new"))) TS_Pong_new(int16_t byteslen_arg) {
45165         LDKPong ret_var = Pong_new(byteslen_arg);
45166         uint64_t ret_ref = 0;
45167         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45168         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45169         return ret_ref;
45170 }
45171
45172 static inline uint64_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
45173         LDKPong ret_var = Pong_clone(arg);
45174         uint64_t ret_ref = 0;
45175         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45176         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45177         return ret_ref;
45178 }
45179 int64_t  __attribute__((export_name("TS_Pong_clone_ptr"))) TS_Pong_clone_ptr(uint64_t arg) {
45180         LDKPong arg_conv;
45181         arg_conv.inner = untag_ptr(arg);
45182         arg_conv.is_owned = ptr_is_owned(arg);
45183         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45184         arg_conv.is_owned = false;
45185         int64_t ret_conv = Pong_clone_ptr(&arg_conv);
45186         return ret_conv;
45187 }
45188
45189 uint64_t  __attribute__((export_name("TS_Pong_clone"))) TS_Pong_clone(uint64_t orig) {
45190         LDKPong orig_conv;
45191         orig_conv.inner = untag_ptr(orig);
45192         orig_conv.is_owned = ptr_is_owned(orig);
45193         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45194         orig_conv.is_owned = false;
45195         LDKPong ret_var = Pong_clone(&orig_conv);
45196         uint64_t ret_ref = 0;
45197         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45198         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45199         return ret_ref;
45200 }
45201
45202 int64_t  __attribute__((export_name("TS_Pong_hash"))) TS_Pong_hash(uint64_t o) {
45203         LDKPong o_conv;
45204         o_conv.inner = untag_ptr(o);
45205         o_conv.is_owned = ptr_is_owned(o);
45206         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45207         o_conv.is_owned = false;
45208         int64_t ret_conv = Pong_hash(&o_conv);
45209         return ret_conv;
45210 }
45211
45212 jboolean  __attribute__((export_name("TS_Pong_eq"))) TS_Pong_eq(uint64_t a, uint64_t b) {
45213         LDKPong a_conv;
45214         a_conv.inner = untag_ptr(a);
45215         a_conv.is_owned = ptr_is_owned(a);
45216         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45217         a_conv.is_owned = false;
45218         LDKPong b_conv;
45219         b_conv.inner = untag_ptr(b);
45220         b_conv.is_owned = ptr_is_owned(b);
45221         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45222         b_conv.is_owned = false;
45223         jboolean ret_conv = Pong_eq(&a_conv, &b_conv);
45224         return ret_conv;
45225 }
45226
45227 void  __attribute__((export_name("TS_CommonOpenChannelFields_free"))) TS_CommonOpenChannelFields_free(uint64_t this_obj) {
45228         LDKCommonOpenChannelFields this_obj_conv;
45229         this_obj_conv.inner = untag_ptr(this_obj);
45230         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45232         CommonOpenChannelFields_free(this_obj_conv);
45233 }
45234
45235 int8_tArray  __attribute__((export_name("TS_CommonOpenChannelFields_get_chain_hash"))) TS_CommonOpenChannelFields_get_chain_hash(uint64_t this_ptr) {
45236         LDKCommonOpenChannelFields 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         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
45242         memcpy(ret_arr->elems, *CommonOpenChannelFields_get_chain_hash(&this_ptr_conv), 32);
45243         return ret_arr;
45244 }
45245
45246 void  __attribute__((export_name("TS_CommonOpenChannelFields_set_chain_hash"))) TS_CommonOpenChannelFields_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
45247         LDKCommonOpenChannelFields this_ptr_conv;
45248         this_ptr_conv.inner = untag_ptr(this_ptr);
45249         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45251         this_ptr_conv.is_owned = false;
45252         LDKThirtyTwoBytes val_ref;
45253         CHECK(val->arr_len == 32);
45254         memcpy(val_ref.data, val->elems, 32); FREE(val);
45255         CommonOpenChannelFields_set_chain_hash(&this_ptr_conv, val_ref);
45256 }
45257
45258 uint64_t  __attribute__((export_name("TS_CommonOpenChannelFields_get_temporary_channel_id"))) TS_CommonOpenChannelFields_get_temporary_channel_id(uint64_t this_ptr) {
45259         LDKCommonOpenChannelFields 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         LDKChannelId ret_var = CommonOpenChannelFields_get_temporary_channel_id(&this_ptr_conv);
45265         uint64_t ret_ref = 0;
45266         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45267         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45268         return ret_ref;
45269 }
45270
45271 void  __attribute__((export_name("TS_CommonOpenChannelFields_set_temporary_channel_id"))) TS_CommonOpenChannelFields_set_temporary_channel_id(uint64_t this_ptr, uint64_t val) {
45272         LDKCommonOpenChannelFields this_ptr_conv;
45273         this_ptr_conv.inner = untag_ptr(this_ptr);
45274         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45276         this_ptr_conv.is_owned = false;
45277         LDKChannelId val_conv;
45278         val_conv.inner = untag_ptr(val);
45279         val_conv.is_owned = ptr_is_owned(val);
45280         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45281         val_conv = ChannelId_clone(&val_conv);
45282         CommonOpenChannelFields_set_temporary_channel_id(&this_ptr_conv, val_conv);
45283 }
45284
45285 int64_t  __attribute__((export_name("TS_CommonOpenChannelFields_get_funding_satoshis"))) TS_CommonOpenChannelFields_get_funding_satoshis(uint64_t this_ptr) {
45286         LDKCommonOpenChannelFields this_ptr_conv;
45287         this_ptr_conv.inner = untag_ptr(this_ptr);
45288         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45290         this_ptr_conv.is_owned = false;
45291         int64_t ret_conv = CommonOpenChannelFields_get_funding_satoshis(&this_ptr_conv);
45292         return ret_conv;
45293 }
45294
45295 void  __attribute__((export_name("TS_CommonOpenChannelFields_set_funding_satoshis"))) TS_CommonOpenChannelFields_set_funding_satoshis(uint64_t this_ptr, int64_t val) {
45296         LDKCommonOpenChannelFields this_ptr_conv;
45297         this_ptr_conv.inner = untag_ptr(this_ptr);
45298         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45300         this_ptr_conv.is_owned = false;
45301         CommonOpenChannelFields_set_funding_satoshis(&this_ptr_conv, val);
45302 }
45303
45304 int64_t  __attribute__((export_name("TS_CommonOpenChannelFields_get_dust_limit_satoshis"))) TS_CommonOpenChannelFields_get_dust_limit_satoshis(uint64_t this_ptr) {
45305         LDKCommonOpenChannelFields this_ptr_conv;
45306         this_ptr_conv.inner = untag_ptr(this_ptr);
45307         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45309         this_ptr_conv.is_owned = false;
45310         int64_t ret_conv = CommonOpenChannelFields_get_dust_limit_satoshis(&this_ptr_conv);
45311         return ret_conv;
45312 }
45313
45314 void  __attribute__((export_name("TS_CommonOpenChannelFields_set_dust_limit_satoshis"))) TS_CommonOpenChannelFields_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
45315         LDKCommonOpenChannelFields this_ptr_conv;
45316         this_ptr_conv.inner = untag_ptr(this_ptr);
45317         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45319         this_ptr_conv.is_owned = false;
45320         CommonOpenChannelFields_set_dust_limit_satoshis(&this_ptr_conv, val);
45321 }
45322
45323 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) {
45324         LDKCommonOpenChannelFields this_ptr_conv;
45325         this_ptr_conv.inner = untag_ptr(this_ptr);
45326         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45328         this_ptr_conv.is_owned = false;
45329         int64_t ret_conv = CommonOpenChannelFields_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
45330         return ret_conv;
45331 }
45332
45333 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) {
45334         LDKCommonOpenChannelFields this_ptr_conv;
45335         this_ptr_conv.inner = untag_ptr(this_ptr);
45336         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45338         this_ptr_conv.is_owned = false;
45339         CommonOpenChannelFields_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
45340 }
45341
45342 int64_t  __attribute__((export_name("TS_CommonOpenChannelFields_get_htlc_minimum_msat"))) TS_CommonOpenChannelFields_get_htlc_minimum_msat(uint64_t this_ptr) {
45343         LDKCommonOpenChannelFields this_ptr_conv;
45344         this_ptr_conv.inner = untag_ptr(this_ptr);
45345         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45347         this_ptr_conv.is_owned = false;
45348         int64_t ret_conv = CommonOpenChannelFields_get_htlc_minimum_msat(&this_ptr_conv);
45349         return ret_conv;
45350 }
45351
45352 void  __attribute__((export_name("TS_CommonOpenChannelFields_set_htlc_minimum_msat"))) TS_CommonOpenChannelFields_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
45353         LDKCommonOpenChannelFields this_ptr_conv;
45354         this_ptr_conv.inner = untag_ptr(this_ptr);
45355         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45357         this_ptr_conv.is_owned = false;
45358         CommonOpenChannelFields_set_htlc_minimum_msat(&this_ptr_conv, val);
45359 }
45360
45361 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) {
45362         LDKCommonOpenChannelFields 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         int32_t ret_conv = CommonOpenChannelFields_get_commitment_feerate_sat_per_1000_weight(&this_ptr_conv);
45368         return ret_conv;
45369 }
45370
45371 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) {
45372         LDKCommonOpenChannelFields this_ptr_conv;
45373         this_ptr_conv.inner = untag_ptr(this_ptr);
45374         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45376         this_ptr_conv.is_owned = false;
45377         CommonOpenChannelFields_set_commitment_feerate_sat_per_1000_weight(&this_ptr_conv, val);
45378 }
45379
45380 int16_t  __attribute__((export_name("TS_CommonOpenChannelFields_get_to_self_delay"))) TS_CommonOpenChannelFields_get_to_self_delay(uint64_t this_ptr) {
45381         LDKCommonOpenChannelFields this_ptr_conv;
45382         this_ptr_conv.inner = untag_ptr(this_ptr);
45383         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45385         this_ptr_conv.is_owned = false;
45386         int16_t ret_conv = CommonOpenChannelFields_get_to_self_delay(&this_ptr_conv);
45387         return ret_conv;
45388 }
45389
45390 void  __attribute__((export_name("TS_CommonOpenChannelFields_set_to_self_delay"))) TS_CommonOpenChannelFields_set_to_self_delay(uint64_t this_ptr, int16_t val) {
45391         LDKCommonOpenChannelFields this_ptr_conv;
45392         this_ptr_conv.inner = untag_ptr(this_ptr);
45393         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45395         this_ptr_conv.is_owned = false;
45396         CommonOpenChannelFields_set_to_self_delay(&this_ptr_conv, val);
45397 }
45398
45399 int16_t  __attribute__((export_name("TS_CommonOpenChannelFields_get_max_accepted_htlcs"))) TS_CommonOpenChannelFields_get_max_accepted_htlcs(uint64_t this_ptr) {
45400         LDKCommonOpenChannelFields 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         int16_t ret_conv = CommonOpenChannelFields_get_max_accepted_htlcs(&this_ptr_conv);
45406         return ret_conv;
45407 }
45408
45409 void  __attribute__((export_name("TS_CommonOpenChannelFields_set_max_accepted_htlcs"))) TS_CommonOpenChannelFields_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
45410         LDKCommonOpenChannelFields this_ptr_conv;
45411         this_ptr_conv.inner = untag_ptr(this_ptr);
45412         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45414         this_ptr_conv.is_owned = false;
45415         CommonOpenChannelFields_set_max_accepted_htlcs(&this_ptr_conv, val);
45416 }
45417
45418 int8_tArray  __attribute__((export_name("TS_CommonOpenChannelFields_get_funding_pubkey"))) TS_CommonOpenChannelFields_get_funding_pubkey(uint64_t this_ptr) {
45419         LDKCommonOpenChannelFields this_ptr_conv;
45420         this_ptr_conv.inner = untag_ptr(this_ptr);
45421         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45423         this_ptr_conv.is_owned = false;
45424         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
45425         memcpy(ret_arr->elems, CommonOpenChannelFields_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
45426         return ret_arr;
45427 }
45428
45429 void  __attribute__((export_name("TS_CommonOpenChannelFields_set_funding_pubkey"))) TS_CommonOpenChannelFields_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
45430         LDKCommonOpenChannelFields this_ptr_conv;
45431         this_ptr_conv.inner = untag_ptr(this_ptr);
45432         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45434         this_ptr_conv.is_owned = false;
45435         LDKPublicKey val_ref;
45436         CHECK(val->arr_len == 33);
45437         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
45438         CommonOpenChannelFields_set_funding_pubkey(&this_ptr_conv, val_ref);
45439 }
45440
45441 int8_tArray  __attribute__((export_name("TS_CommonOpenChannelFields_get_revocation_basepoint"))) TS_CommonOpenChannelFields_get_revocation_basepoint(uint64_t this_ptr) {
45442         LDKCommonOpenChannelFields this_ptr_conv;
45443         this_ptr_conv.inner = untag_ptr(this_ptr);
45444         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45446         this_ptr_conv.is_owned = false;
45447         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
45448         memcpy(ret_arr->elems, CommonOpenChannelFields_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
45449         return ret_arr;
45450 }
45451
45452 void  __attribute__((export_name("TS_CommonOpenChannelFields_set_revocation_basepoint"))) TS_CommonOpenChannelFields_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
45453         LDKCommonOpenChannelFields this_ptr_conv;
45454         this_ptr_conv.inner = untag_ptr(this_ptr);
45455         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45457         this_ptr_conv.is_owned = false;
45458         LDKPublicKey val_ref;
45459         CHECK(val->arr_len == 33);
45460         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
45461         CommonOpenChannelFields_set_revocation_basepoint(&this_ptr_conv, val_ref);
45462 }
45463
45464 int8_tArray  __attribute__((export_name("TS_CommonOpenChannelFields_get_payment_basepoint"))) TS_CommonOpenChannelFields_get_payment_basepoint(uint64_t this_ptr) {
45465         LDKCommonOpenChannelFields this_ptr_conv;
45466         this_ptr_conv.inner = untag_ptr(this_ptr);
45467         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45469         this_ptr_conv.is_owned = false;
45470         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
45471         memcpy(ret_arr->elems, CommonOpenChannelFields_get_payment_basepoint(&this_ptr_conv).compressed_form, 33);
45472         return ret_arr;
45473 }
45474
45475 void  __attribute__((export_name("TS_CommonOpenChannelFields_set_payment_basepoint"))) TS_CommonOpenChannelFields_set_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
45476         LDKCommonOpenChannelFields this_ptr_conv;
45477         this_ptr_conv.inner = untag_ptr(this_ptr);
45478         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45480         this_ptr_conv.is_owned = false;
45481         LDKPublicKey val_ref;
45482         CHECK(val->arr_len == 33);
45483         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
45484         CommonOpenChannelFields_set_payment_basepoint(&this_ptr_conv, val_ref);
45485 }
45486
45487 int8_tArray  __attribute__((export_name("TS_CommonOpenChannelFields_get_delayed_payment_basepoint"))) TS_CommonOpenChannelFields_get_delayed_payment_basepoint(uint64_t this_ptr) {
45488         LDKCommonOpenChannelFields this_ptr_conv;
45489         this_ptr_conv.inner = untag_ptr(this_ptr);
45490         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45492         this_ptr_conv.is_owned = false;
45493         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
45494         memcpy(ret_arr->elems, CommonOpenChannelFields_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
45495         return ret_arr;
45496 }
45497
45498 void  __attribute__((export_name("TS_CommonOpenChannelFields_set_delayed_payment_basepoint"))) TS_CommonOpenChannelFields_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
45499         LDKCommonOpenChannelFields this_ptr_conv;
45500         this_ptr_conv.inner = untag_ptr(this_ptr);
45501         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45503         this_ptr_conv.is_owned = false;
45504         LDKPublicKey val_ref;
45505         CHECK(val->arr_len == 33);
45506         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
45507         CommonOpenChannelFields_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
45508 }
45509
45510 int8_tArray  __attribute__((export_name("TS_CommonOpenChannelFields_get_htlc_basepoint"))) TS_CommonOpenChannelFields_get_htlc_basepoint(uint64_t this_ptr) {
45511         LDKCommonOpenChannelFields this_ptr_conv;
45512         this_ptr_conv.inner = untag_ptr(this_ptr);
45513         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45515         this_ptr_conv.is_owned = false;
45516         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
45517         memcpy(ret_arr->elems, CommonOpenChannelFields_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
45518         return ret_arr;
45519 }
45520
45521 void  __attribute__((export_name("TS_CommonOpenChannelFields_set_htlc_basepoint"))) TS_CommonOpenChannelFields_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
45522         LDKCommonOpenChannelFields this_ptr_conv;
45523         this_ptr_conv.inner = untag_ptr(this_ptr);
45524         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45526         this_ptr_conv.is_owned = false;
45527         LDKPublicKey val_ref;
45528         CHECK(val->arr_len == 33);
45529         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
45530         CommonOpenChannelFields_set_htlc_basepoint(&this_ptr_conv, val_ref);
45531 }
45532
45533 int8_tArray  __attribute__((export_name("TS_CommonOpenChannelFields_get_first_per_commitment_point"))) TS_CommonOpenChannelFields_get_first_per_commitment_point(uint64_t this_ptr) {
45534         LDKCommonOpenChannelFields this_ptr_conv;
45535         this_ptr_conv.inner = untag_ptr(this_ptr);
45536         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45538         this_ptr_conv.is_owned = false;
45539         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
45540         memcpy(ret_arr->elems, CommonOpenChannelFields_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
45541         return ret_arr;
45542 }
45543
45544 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) {
45545         LDKCommonOpenChannelFields this_ptr_conv;
45546         this_ptr_conv.inner = untag_ptr(this_ptr);
45547         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45549         this_ptr_conv.is_owned = false;
45550         LDKPublicKey val_ref;
45551         CHECK(val->arr_len == 33);
45552         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
45553         CommonOpenChannelFields_set_first_per_commitment_point(&this_ptr_conv, val_ref);
45554 }
45555
45556 int8_t  __attribute__((export_name("TS_CommonOpenChannelFields_get_channel_flags"))) TS_CommonOpenChannelFields_get_channel_flags(uint64_t this_ptr) {
45557         LDKCommonOpenChannelFields this_ptr_conv;
45558         this_ptr_conv.inner = untag_ptr(this_ptr);
45559         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45561         this_ptr_conv.is_owned = false;
45562         int8_t ret_conv = CommonOpenChannelFields_get_channel_flags(&this_ptr_conv);
45563         return ret_conv;
45564 }
45565
45566 void  __attribute__((export_name("TS_CommonOpenChannelFields_set_channel_flags"))) TS_CommonOpenChannelFields_set_channel_flags(uint64_t this_ptr, int8_t val) {
45567         LDKCommonOpenChannelFields this_ptr_conv;
45568         this_ptr_conv.inner = untag_ptr(this_ptr);
45569         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45571         this_ptr_conv.is_owned = false;
45572         CommonOpenChannelFields_set_channel_flags(&this_ptr_conv, val);
45573 }
45574
45575 uint64_t  __attribute__((export_name("TS_CommonOpenChannelFields_get_shutdown_scriptpubkey"))) TS_CommonOpenChannelFields_get_shutdown_scriptpubkey(uint64_t this_ptr) {
45576         LDKCommonOpenChannelFields this_ptr_conv;
45577         this_ptr_conv.inner = untag_ptr(this_ptr);
45578         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45580         this_ptr_conv.is_owned = false;
45581         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
45582         *ret_copy = CommonOpenChannelFields_get_shutdown_scriptpubkey(&this_ptr_conv);
45583         uint64_t ret_ref = tag_ptr(ret_copy, true);
45584         return ret_ref;
45585 }
45586
45587 void  __attribute__((export_name("TS_CommonOpenChannelFields_set_shutdown_scriptpubkey"))) TS_CommonOpenChannelFields_set_shutdown_scriptpubkey(uint64_t this_ptr, uint64_t val) {
45588         LDKCommonOpenChannelFields this_ptr_conv;
45589         this_ptr_conv.inner = untag_ptr(this_ptr);
45590         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45592         this_ptr_conv.is_owned = false;
45593         void* val_ptr = untag_ptr(val);
45594         CHECK_ACCESS(val_ptr);
45595         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
45596         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
45597         CommonOpenChannelFields_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
45598 }
45599
45600 uint64_t  __attribute__((export_name("TS_CommonOpenChannelFields_get_channel_type"))) TS_CommonOpenChannelFields_get_channel_type(uint64_t this_ptr) {
45601         LDKCommonOpenChannelFields this_ptr_conv;
45602         this_ptr_conv.inner = untag_ptr(this_ptr);
45603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45605         this_ptr_conv.is_owned = false;
45606         LDKChannelTypeFeatures ret_var = CommonOpenChannelFields_get_channel_type(&this_ptr_conv);
45607         uint64_t ret_ref = 0;
45608         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45609         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45610         return ret_ref;
45611 }
45612
45613 void  __attribute__((export_name("TS_CommonOpenChannelFields_set_channel_type"))) TS_CommonOpenChannelFields_set_channel_type(uint64_t this_ptr, uint64_t val) {
45614         LDKCommonOpenChannelFields this_ptr_conv;
45615         this_ptr_conv.inner = untag_ptr(this_ptr);
45616         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45618         this_ptr_conv.is_owned = false;
45619         LDKChannelTypeFeatures val_conv;
45620         val_conv.inner = untag_ptr(val);
45621         val_conv.is_owned = ptr_is_owned(val);
45622         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45623         val_conv = ChannelTypeFeatures_clone(&val_conv);
45624         CommonOpenChannelFields_set_channel_type(&this_ptr_conv, val_conv);
45625 }
45626
45627 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) {
45628         LDKThirtyTwoBytes chain_hash_arg_ref;
45629         CHECK(chain_hash_arg->arr_len == 32);
45630         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
45631         LDKChannelId temporary_channel_id_arg_conv;
45632         temporary_channel_id_arg_conv.inner = untag_ptr(temporary_channel_id_arg);
45633         temporary_channel_id_arg_conv.is_owned = ptr_is_owned(temporary_channel_id_arg);
45634         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_arg_conv);
45635         temporary_channel_id_arg_conv = ChannelId_clone(&temporary_channel_id_arg_conv);
45636         LDKPublicKey funding_pubkey_arg_ref;
45637         CHECK(funding_pubkey_arg->arr_len == 33);
45638         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
45639         LDKPublicKey revocation_basepoint_arg_ref;
45640         CHECK(revocation_basepoint_arg->arr_len == 33);
45641         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
45642         LDKPublicKey payment_basepoint_arg_ref;
45643         CHECK(payment_basepoint_arg->arr_len == 33);
45644         memcpy(payment_basepoint_arg_ref.compressed_form, payment_basepoint_arg->elems, 33); FREE(payment_basepoint_arg);
45645         LDKPublicKey delayed_payment_basepoint_arg_ref;
45646         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
45647         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
45648         LDKPublicKey htlc_basepoint_arg_ref;
45649         CHECK(htlc_basepoint_arg->arr_len == 33);
45650         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
45651         LDKPublicKey first_per_commitment_point_arg_ref;
45652         CHECK(first_per_commitment_point_arg->arr_len == 33);
45653         memcpy(first_per_commitment_point_arg_ref.compressed_form, first_per_commitment_point_arg->elems, 33); FREE(first_per_commitment_point_arg);
45654         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
45655         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
45656         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
45657         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
45658         LDKChannelTypeFeatures channel_type_arg_conv;
45659         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
45660         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
45661         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
45662         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
45663         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);
45664         uint64_t ret_ref = 0;
45665         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45666         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45667         return ret_ref;
45668 }
45669
45670 static inline uint64_t CommonOpenChannelFields_clone_ptr(LDKCommonOpenChannelFields *NONNULL_PTR arg) {
45671         LDKCommonOpenChannelFields ret_var = CommonOpenChannelFields_clone(arg);
45672         uint64_t ret_ref = 0;
45673         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45674         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45675         return ret_ref;
45676 }
45677 int64_t  __attribute__((export_name("TS_CommonOpenChannelFields_clone_ptr"))) TS_CommonOpenChannelFields_clone_ptr(uint64_t arg) {
45678         LDKCommonOpenChannelFields arg_conv;
45679         arg_conv.inner = untag_ptr(arg);
45680         arg_conv.is_owned = ptr_is_owned(arg);
45681         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45682         arg_conv.is_owned = false;
45683         int64_t ret_conv = CommonOpenChannelFields_clone_ptr(&arg_conv);
45684         return ret_conv;
45685 }
45686
45687 uint64_t  __attribute__((export_name("TS_CommonOpenChannelFields_clone"))) TS_CommonOpenChannelFields_clone(uint64_t orig) {
45688         LDKCommonOpenChannelFields orig_conv;
45689         orig_conv.inner = untag_ptr(orig);
45690         orig_conv.is_owned = ptr_is_owned(orig);
45691         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45692         orig_conv.is_owned = false;
45693         LDKCommonOpenChannelFields ret_var = CommonOpenChannelFields_clone(&orig_conv);
45694         uint64_t ret_ref = 0;
45695         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45696         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45697         return ret_ref;
45698 }
45699
45700 int64_t  __attribute__((export_name("TS_CommonOpenChannelFields_hash"))) TS_CommonOpenChannelFields_hash(uint64_t o) {
45701         LDKCommonOpenChannelFields o_conv;
45702         o_conv.inner = untag_ptr(o);
45703         o_conv.is_owned = ptr_is_owned(o);
45704         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45705         o_conv.is_owned = false;
45706         int64_t ret_conv = CommonOpenChannelFields_hash(&o_conv);
45707         return ret_conv;
45708 }
45709
45710 jboolean  __attribute__((export_name("TS_CommonOpenChannelFields_eq"))) TS_CommonOpenChannelFields_eq(uint64_t a, uint64_t b) {
45711         LDKCommonOpenChannelFields a_conv;
45712         a_conv.inner = untag_ptr(a);
45713         a_conv.is_owned = ptr_is_owned(a);
45714         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45715         a_conv.is_owned = false;
45716         LDKCommonOpenChannelFields b_conv;
45717         b_conv.inner = untag_ptr(b);
45718         b_conv.is_owned = ptr_is_owned(b);
45719         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45720         b_conv.is_owned = false;
45721         jboolean ret_conv = CommonOpenChannelFields_eq(&a_conv, &b_conv);
45722         return ret_conv;
45723 }
45724
45725 void  __attribute__((export_name("TS_OpenChannel_free"))) TS_OpenChannel_free(uint64_t this_obj) {
45726         LDKOpenChannel this_obj_conv;
45727         this_obj_conv.inner = untag_ptr(this_obj);
45728         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45730         OpenChannel_free(this_obj_conv);
45731 }
45732
45733 uint64_t  __attribute__((export_name("TS_OpenChannel_get_common_fields"))) TS_OpenChannel_get_common_fields(uint64_t this_ptr) {
45734         LDKOpenChannel this_ptr_conv;
45735         this_ptr_conv.inner = untag_ptr(this_ptr);
45736         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45738         this_ptr_conv.is_owned = false;
45739         LDKCommonOpenChannelFields ret_var = OpenChannel_get_common_fields(&this_ptr_conv);
45740         uint64_t ret_ref = 0;
45741         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45742         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45743         return ret_ref;
45744 }
45745
45746 void  __attribute__((export_name("TS_OpenChannel_set_common_fields"))) TS_OpenChannel_set_common_fields(uint64_t this_ptr, uint64_t val) {
45747         LDKOpenChannel this_ptr_conv;
45748         this_ptr_conv.inner = untag_ptr(this_ptr);
45749         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45751         this_ptr_conv.is_owned = false;
45752         LDKCommonOpenChannelFields val_conv;
45753         val_conv.inner = untag_ptr(val);
45754         val_conv.is_owned = ptr_is_owned(val);
45755         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45756         val_conv = CommonOpenChannelFields_clone(&val_conv);
45757         OpenChannel_set_common_fields(&this_ptr_conv, val_conv);
45758 }
45759
45760 int64_t  __attribute__((export_name("TS_OpenChannel_get_push_msat"))) TS_OpenChannel_get_push_msat(uint64_t this_ptr) {
45761         LDKOpenChannel this_ptr_conv;
45762         this_ptr_conv.inner = untag_ptr(this_ptr);
45763         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45765         this_ptr_conv.is_owned = false;
45766         int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
45767         return ret_conv;
45768 }
45769
45770 void  __attribute__((export_name("TS_OpenChannel_set_push_msat"))) TS_OpenChannel_set_push_msat(uint64_t this_ptr, int64_t val) {
45771         LDKOpenChannel this_ptr_conv;
45772         this_ptr_conv.inner = untag_ptr(this_ptr);
45773         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45775         this_ptr_conv.is_owned = false;
45776         OpenChannel_set_push_msat(&this_ptr_conv, val);
45777 }
45778
45779 int64_t  __attribute__((export_name("TS_OpenChannel_get_channel_reserve_satoshis"))) TS_OpenChannel_get_channel_reserve_satoshis(uint64_t this_ptr) {
45780         LDKOpenChannel this_ptr_conv;
45781         this_ptr_conv.inner = untag_ptr(this_ptr);
45782         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45784         this_ptr_conv.is_owned = false;
45785         int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
45786         return ret_conv;
45787 }
45788
45789 void  __attribute__((export_name("TS_OpenChannel_set_channel_reserve_satoshis"))) TS_OpenChannel_set_channel_reserve_satoshis(uint64_t this_ptr, int64_t val) {
45790         LDKOpenChannel this_ptr_conv;
45791         this_ptr_conv.inner = untag_ptr(this_ptr);
45792         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45794         this_ptr_conv.is_owned = false;
45795         OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
45796 }
45797
45798 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) {
45799         LDKCommonOpenChannelFields common_fields_arg_conv;
45800         common_fields_arg_conv.inner = untag_ptr(common_fields_arg);
45801         common_fields_arg_conv.is_owned = ptr_is_owned(common_fields_arg);
45802         CHECK_INNER_FIELD_ACCESS_OR_NULL(common_fields_arg_conv);
45803         common_fields_arg_conv = CommonOpenChannelFields_clone(&common_fields_arg_conv);
45804         LDKOpenChannel ret_var = OpenChannel_new(common_fields_arg_conv, push_msat_arg, channel_reserve_satoshis_arg);
45805         uint64_t ret_ref = 0;
45806         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45807         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45808         return ret_ref;
45809 }
45810
45811 static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
45812         LDKOpenChannel ret_var = OpenChannel_clone(arg);
45813         uint64_t ret_ref = 0;
45814         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45815         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45816         return ret_ref;
45817 }
45818 int64_t  __attribute__((export_name("TS_OpenChannel_clone_ptr"))) TS_OpenChannel_clone_ptr(uint64_t arg) {
45819         LDKOpenChannel arg_conv;
45820         arg_conv.inner = untag_ptr(arg);
45821         arg_conv.is_owned = ptr_is_owned(arg);
45822         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45823         arg_conv.is_owned = false;
45824         int64_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
45825         return ret_conv;
45826 }
45827
45828 uint64_t  __attribute__((export_name("TS_OpenChannel_clone"))) TS_OpenChannel_clone(uint64_t orig) {
45829         LDKOpenChannel orig_conv;
45830         orig_conv.inner = untag_ptr(orig);
45831         orig_conv.is_owned = ptr_is_owned(orig);
45832         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45833         orig_conv.is_owned = false;
45834         LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
45835         uint64_t ret_ref = 0;
45836         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45837         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45838         return ret_ref;
45839 }
45840
45841 int64_t  __attribute__((export_name("TS_OpenChannel_hash"))) TS_OpenChannel_hash(uint64_t o) {
45842         LDKOpenChannel o_conv;
45843         o_conv.inner = untag_ptr(o);
45844         o_conv.is_owned = ptr_is_owned(o);
45845         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45846         o_conv.is_owned = false;
45847         int64_t ret_conv = OpenChannel_hash(&o_conv);
45848         return ret_conv;
45849 }
45850
45851 jboolean  __attribute__((export_name("TS_OpenChannel_eq"))) TS_OpenChannel_eq(uint64_t a, uint64_t b) {
45852         LDKOpenChannel a_conv;
45853         a_conv.inner = untag_ptr(a);
45854         a_conv.is_owned = ptr_is_owned(a);
45855         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45856         a_conv.is_owned = false;
45857         LDKOpenChannel b_conv;
45858         b_conv.inner = untag_ptr(b);
45859         b_conv.is_owned = ptr_is_owned(b);
45860         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45861         b_conv.is_owned = false;
45862         jboolean ret_conv = OpenChannel_eq(&a_conv, &b_conv);
45863         return ret_conv;
45864 }
45865
45866 void  __attribute__((export_name("TS_OpenChannelV2_free"))) TS_OpenChannelV2_free(uint64_t this_obj) {
45867         LDKOpenChannelV2 this_obj_conv;
45868         this_obj_conv.inner = untag_ptr(this_obj);
45869         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45871         OpenChannelV2_free(this_obj_conv);
45872 }
45873
45874 uint64_t  __attribute__((export_name("TS_OpenChannelV2_get_common_fields"))) TS_OpenChannelV2_get_common_fields(uint64_t this_ptr) {
45875         LDKOpenChannelV2 this_ptr_conv;
45876         this_ptr_conv.inner = untag_ptr(this_ptr);
45877         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45879         this_ptr_conv.is_owned = false;
45880         LDKCommonOpenChannelFields ret_var = OpenChannelV2_get_common_fields(&this_ptr_conv);
45881         uint64_t ret_ref = 0;
45882         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45883         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45884         return ret_ref;
45885 }
45886
45887 void  __attribute__((export_name("TS_OpenChannelV2_set_common_fields"))) TS_OpenChannelV2_set_common_fields(uint64_t this_ptr, uint64_t val) {
45888         LDKOpenChannelV2 this_ptr_conv;
45889         this_ptr_conv.inner = untag_ptr(this_ptr);
45890         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45892         this_ptr_conv.is_owned = false;
45893         LDKCommonOpenChannelFields val_conv;
45894         val_conv.inner = untag_ptr(val);
45895         val_conv.is_owned = ptr_is_owned(val);
45896         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45897         val_conv = CommonOpenChannelFields_clone(&val_conv);
45898         OpenChannelV2_set_common_fields(&this_ptr_conv, val_conv);
45899 }
45900
45901 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) {
45902         LDKOpenChannelV2 this_ptr_conv;
45903         this_ptr_conv.inner = untag_ptr(this_ptr);
45904         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45906         this_ptr_conv.is_owned = false;
45907         int32_t ret_conv = OpenChannelV2_get_funding_feerate_sat_per_1000_weight(&this_ptr_conv);
45908         return ret_conv;
45909 }
45910
45911 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) {
45912         LDKOpenChannelV2 this_ptr_conv;
45913         this_ptr_conv.inner = untag_ptr(this_ptr);
45914         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45916         this_ptr_conv.is_owned = false;
45917         OpenChannelV2_set_funding_feerate_sat_per_1000_weight(&this_ptr_conv, val);
45918 }
45919
45920 int32_t  __attribute__((export_name("TS_OpenChannelV2_get_locktime"))) TS_OpenChannelV2_get_locktime(uint64_t this_ptr) {
45921         LDKOpenChannelV2 this_ptr_conv;
45922         this_ptr_conv.inner = untag_ptr(this_ptr);
45923         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45925         this_ptr_conv.is_owned = false;
45926         int32_t ret_conv = OpenChannelV2_get_locktime(&this_ptr_conv);
45927         return ret_conv;
45928 }
45929
45930 void  __attribute__((export_name("TS_OpenChannelV2_set_locktime"))) TS_OpenChannelV2_set_locktime(uint64_t this_ptr, int32_t val) {
45931         LDKOpenChannelV2 this_ptr_conv;
45932         this_ptr_conv.inner = untag_ptr(this_ptr);
45933         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45935         this_ptr_conv.is_owned = false;
45936         OpenChannelV2_set_locktime(&this_ptr_conv, val);
45937 }
45938
45939 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_second_per_commitment_point"))) TS_OpenChannelV2_get_second_per_commitment_point(uint64_t this_ptr) {
45940         LDKOpenChannelV2 this_ptr_conv;
45941         this_ptr_conv.inner = untag_ptr(this_ptr);
45942         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45944         this_ptr_conv.is_owned = false;
45945         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
45946         memcpy(ret_arr->elems, OpenChannelV2_get_second_per_commitment_point(&this_ptr_conv).compressed_form, 33);
45947         return ret_arr;
45948 }
45949
45950 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) {
45951         LDKOpenChannelV2 this_ptr_conv;
45952         this_ptr_conv.inner = untag_ptr(this_ptr);
45953         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45955         this_ptr_conv.is_owned = false;
45956         LDKPublicKey val_ref;
45957         CHECK(val->arr_len == 33);
45958         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
45959         OpenChannelV2_set_second_per_commitment_point(&this_ptr_conv, val_ref);
45960 }
45961
45962 uint32_t  __attribute__((export_name("TS_OpenChannelV2_get_require_confirmed_inputs"))) TS_OpenChannelV2_get_require_confirmed_inputs(uint64_t this_ptr) {
45963         LDKOpenChannelV2 this_ptr_conv;
45964         this_ptr_conv.inner = untag_ptr(this_ptr);
45965         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45967         this_ptr_conv.is_owned = false;
45968         uint32_t ret_conv = LDKCOption_NoneZ_to_js(OpenChannelV2_get_require_confirmed_inputs(&this_ptr_conv));
45969         return ret_conv;
45970 }
45971
45972 void  __attribute__((export_name("TS_OpenChannelV2_set_require_confirmed_inputs"))) TS_OpenChannelV2_set_require_confirmed_inputs(uint64_t this_ptr, uint32_t val) {
45973         LDKOpenChannelV2 this_ptr_conv;
45974         this_ptr_conv.inner = untag_ptr(this_ptr);
45975         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45977         this_ptr_conv.is_owned = false;
45978         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
45979         OpenChannelV2_set_require_confirmed_inputs(&this_ptr_conv, val_conv);
45980 }
45981
45982 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) {
45983         LDKCommonOpenChannelFields common_fields_arg_conv;
45984         common_fields_arg_conv.inner = untag_ptr(common_fields_arg);
45985         common_fields_arg_conv.is_owned = ptr_is_owned(common_fields_arg);
45986         CHECK_INNER_FIELD_ACCESS_OR_NULL(common_fields_arg_conv);
45987         common_fields_arg_conv = CommonOpenChannelFields_clone(&common_fields_arg_conv);
45988         LDKPublicKey second_per_commitment_point_arg_ref;
45989         CHECK(second_per_commitment_point_arg->arr_len == 33);
45990         memcpy(second_per_commitment_point_arg_ref.compressed_form, second_per_commitment_point_arg->elems, 33); FREE(second_per_commitment_point_arg);
45991         LDKCOption_NoneZ require_confirmed_inputs_arg_conv = LDKCOption_NoneZ_from_js(require_confirmed_inputs_arg);
45992         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);
45993         uint64_t ret_ref = 0;
45994         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45995         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45996         return ret_ref;
45997 }
45998
45999 static inline uint64_t OpenChannelV2_clone_ptr(LDKOpenChannelV2 *NONNULL_PTR arg) {
46000         LDKOpenChannelV2 ret_var = OpenChannelV2_clone(arg);
46001         uint64_t ret_ref = 0;
46002         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46003         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46004         return ret_ref;
46005 }
46006 int64_t  __attribute__((export_name("TS_OpenChannelV2_clone_ptr"))) TS_OpenChannelV2_clone_ptr(uint64_t arg) {
46007         LDKOpenChannelV2 arg_conv;
46008         arg_conv.inner = untag_ptr(arg);
46009         arg_conv.is_owned = ptr_is_owned(arg);
46010         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46011         arg_conv.is_owned = false;
46012         int64_t ret_conv = OpenChannelV2_clone_ptr(&arg_conv);
46013         return ret_conv;
46014 }
46015
46016 uint64_t  __attribute__((export_name("TS_OpenChannelV2_clone"))) TS_OpenChannelV2_clone(uint64_t orig) {
46017         LDKOpenChannelV2 orig_conv;
46018         orig_conv.inner = untag_ptr(orig);
46019         orig_conv.is_owned = ptr_is_owned(orig);
46020         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46021         orig_conv.is_owned = false;
46022         LDKOpenChannelV2 ret_var = OpenChannelV2_clone(&orig_conv);
46023         uint64_t ret_ref = 0;
46024         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46025         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46026         return ret_ref;
46027 }
46028
46029 int64_t  __attribute__((export_name("TS_OpenChannelV2_hash"))) TS_OpenChannelV2_hash(uint64_t o) {
46030         LDKOpenChannelV2 o_conv;
46031         o_conv.inner = untag_ptr(o);
46032         o_conv.is_owned = ptr_is_owned(o);
46033         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46034         o_conv.is_owned = false;
46035         int64_t ret_conv = OpenChannelV2_hash(&o_conv);
46036         return ret_conv;
46037 }
46038
46039 jboolean  __attribute__((export_name("TS_OpenChannelV2_eq"))) TS_OpenChannelV2_eq(uint64_t a, uint64_t b) {
46040         LDKOpenChannelV2 a_conv;
46041         a_conv.inner = untag_ptr(a);
46042         a_conv.is_owned = ptr_is_owned(a);
46043         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46044         a_conv.is_owned = false;
46045         LDKOpenChannelV2 b_conv;
46046         b_conv.inner = untag_ptr(b);
46047         b_conv.is_owned = ptr_is_owned(b);
46048         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46049         b_conv.is_owned = false;
46050         jboolean ret_conv = OpenChannelV2_eq(&a_conv, &b_conv);
46051         return ret_conv;
46052 }
46053
46054 void  __attribute__((export_name("TS_CommonAcceptChannelFields_free"))) TS_CommonAcceptChannelFields_free(uint64_t this_obj) {
46055         LDKCommonAcceptChannelFields this_obj_conv;
46056         this_obj_conv.inner = untag_ptr(this_obj);
46057         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46059         CommonAcceptChannelFields_free(this_obj_conv);
46060 }
46061
46062 uint64_t  __attribute__((export_name("TS_CommonAcceptChannelFields_get_temporary_channel_id"))) TS_CommonAcceptChannelFields_get_temporary_channel_id(uint64_t this_ptr) {
46063         LDKCommonAcceptChannelFields this_ptr_conv;
46064         this_ptr_conv.inner = untag_ptr(this_ptr);
46065         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46067         this_ptr_conv.is_owned = false;
46068         LDKChannelId ret_var = CommonAcceptChannelFields_get_temporary_channel_id(&this_ptr_conv);
46069         uint64_t ret_ref = 0;
46070         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46071         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46072         return ret_ref;
46073 }
46074
46075 void  __attribute__((export_name("TS_CommonAcceptChannelFields_set_temporary_channel_id"))) TS_CommonAcceptChannelFields_set_temporary_channel_id(uint64_t this_ptr, uint64_t val) {
46076         LDKCommonAcceptChannelFields this_ptr_conv;
46077         this_ptr_conv.inner = untag_ptr(this_ptr);
46078         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46080         this_ptr_conv.is_owned = false;
46081         LDKChannelId val_conv;
46082         val_conv.inner = untag_ptr(val);
46083         val_conv.is_owned = ptr_is_owned(val);
46084         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46085         val_conv = ChannelId_clone(&val_conv);
46086         CommonAcceptChannelFields_set_temporary_channel_id(&this_ptr_conv, val_conv);
46087 }
46088
46089 int64_t  __attribute__((export_name("TS_CommonAcceptChannelFields_get_dust_limit_satoshis"))) TS_CommonAcceptChannelFields_get_dust_limit_satoshis(uint64_t this_ptr) {
46090         LDKCommonAcceptChannelFields this_ptr_conv;
46091         this_ptr_conv.inner = untag_ptr(this_ptr);
46092         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46094         this_ptr_conv.is_owned = false;
46095         int64_t ret_conv = CommonAcceptChannelFields_get_dust_limit_satoshis(&this_ptr_conv);
46096         return ret_conv;
46097 }
46098
46099 void  __attribute__((export_name("TS_CommonAcceptChannelFields_set_dust_limit_satoshis"))) TS_CommonAcceptChannelFields_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
46100         LDKCommonAcceptChannelFields this_ptr_conv;
46101         this_ptr_conv.inner = untag_ptr(this_ptr);
46102         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46104         this_ptr_conv.is_owned = false;
46105         CommonAcceptChannelFields_set_dust_limit_satoshis(&this_ptr_conv, val);
46106 }
46107
46108 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) {
46109         LDKCommonAcceptChannelFields this_ptr_conv;
46110         this_ptr_conv.inner = untag_ptr(this_ptr);
46111         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46113         this_ptr_conv.is_owned = false;
46114         int64_t ret_conv = CommonAcceptChannelFields_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
46115         return ret_conv;
46116 }
46117
46118 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) {
46119         LDKCommonAcceptChannelFields this_ptr_conv;
46120         this_ptr_conv.inner = untag_ptr(this_ptr);
46121         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46123         this_ptr_conv.is_owned = false;
46124         CommonAcceptChannelFields_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
46125 }
46126
46127 int64_t  __attribute__((export_name("TS_CommonAcceptChannelFields_get_htlc_minimum_msat"))) TS_CommonAcceptChannelFields_get_htlc_minimum_msat(uint64_t this_ptr) {
46128         LDKCommonAcceptChannelFields 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         int64_t ret_conv = CommonAcceptChannelFields_get_htlc_minimum_msat(&this_ptr_conv);
46134         return ret_conv;
46135 }
46136
46137 void  __attribute__((export_name("TS_CommonAcceptChannelFields_set_htlc_minimum_msat"))) TS_CommonAcceptChannelFields_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
46138         LDKCommonAcceptChannelFields this_ptr_conv;
46139         this_ptr_conv.inner = untag_ptr(this_ptr);
46140         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46142         this_ptr_conv.is_owned = false;
46143         CommonAcceptChannelFields_set_htlc_minimum_msat(&this_ptr_conv, val);
46144 }
46145
46146 int32_t  __attribute__((export_name("TS_CommonAcceptChannelFields_get_minimum_depth"))) TS_CommonAcceptChannelFields_get_minimum_depth(uint64_t this_ptr) {
46147         LDKCommonAcceptChannelFields this_ptr_conv;
46148         this_ptr_conv.inner = untag_ptr(this_ptr);
46149         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46151         this_ptr_conv.is_owned = false;
46152         int32_t ret_conv = CommonAcceptChannelFields_get_minimum_depth(&this_ptr_conv);
46153         return ret_conv;
46154 }
46155
46156 void  __attribute__((export_name("TS_CommonAcceptChannelFields_set_minimum_depth"))) TS_CommonAcceptChannelFields_set_minimum_depth(uint64_t this_ptr, int32_t val) {
46157         LDKCommonAcceptChannelFields this_ptr_conv;
46158         this_ptr_conv.inner = untag_ptr(this_ptr);
46159         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46161         this_ptr_conv.is_owned = false;
46162         CommonAcceptChannelFields_set_minimum_depth(&this_ptr_conv, val);
46163 }
46164
46165 int16_t  __attribute__((export_name("TS_CommonAcceptChannelFields_get_to_self_delay"))) TS_CommonAcceptChannelFields_get_to_self_delay(uint64_t this_ptr) {
46166         LDKCommonAcceptChannelFields this_ptr_conv;
46167         this_ptr_conv.inner = untag_ptr(this_ptr);
46168         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46170         this_ptr_conv.is_owned = false;
46171         int16_t ret_conv = CommonAcceptChannelFields_get_to_self_delay(&this_ptr_conv);
46172         return ret_conv;
46173 }
46174
46175 void  __attribute__((export_name("TS_CommonAcceptChannelFields_set_to_self_delay"))) TS_CommonAcceptChannelFields_set_to_self_delay(uint64_t this_ptr, int16_t val) {
46176         LDKCommonAcceptChannelFields this_ptr_conv;
46177         this_ptr_conv.inner = untag_ptr(this_ptr);
46178         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46180         this_ptr_conv.is_owned = false;
46181         CommonAcceptChannelFields_set_to_self_delay(&this_ptr_conv, val);
46182 }
46183
46184 int16_t  __attribute__((export_name("TS_CommonAcceptChannelFields_get_max_accepted_htlcs"))) TS_CommonAcceptChannelFields_get_max_accepted_htlcs(uint64_t this_ptr) {
46185         LDKCommonAcceptChannelFields this_ptr_conv;
46186         this_ptr_conv.inner = untag_ptr(this_ptr);
46187         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46189         this_ptr_conv.is_owned = false;
46190         int16_t ret_conv = CommonAcceptChannelFields_get_max_accepted_htlcs(&this_ptr_conv);
46191         return ret_conv;
46192 }
46193
46194 void  __attribute__((export_name("TS_CommonAcceptChannelFields_set_max_accepted_htlcs"))) TS_CommonAcceptChannelFields_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
46195         LDKCommonAcceptChannelFields this_ptr_conv;
46196         this_ptr_conv.inner = untag_ptr(this_ptr);
46197         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46199         this_ptr_conv.is_owned = false;
46200         CommonAcceptChannelFields_set_max_accepted_htlcs(&this_ptr_conv, val);
46201 }
46202
46203 int8_tArray  __attribute__((export_name("TS_CommonAcceptChannelFields_get_funding_pubkey"))) TS_CommonAcceptChannelFields_get_funding_pubkey(uint64_t this_ptr) {
46204         LDKCommonAcceptChannelFields this_ptr_conv;
46205         this_ptr_conv.inner = untag_ptr(this_ptr);
46206         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46208         this_ptr_conv.is_owned = false;
46209         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46210         memcpy(ret_arr->elems, CommonAcceptChannelFields_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
46211         return ret_arr;
46212 }
46213
46214 void  __attribute__((export_name("TS_CommonAcceptChannelFields_set_funding_pubkey"))) TS_CommonAcceptChannelFields_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
46215         LDKCommonAcceptChannelFields this_ptr_conv;
46216         this_ptr_conv.inner = untag_ptr(this_ptr);
46217         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46219         this_ptr_conv.is_owned = false;
46220         LDKPublicKey val_ref;
46221         CHECK(val->arr_len == 33);
46222         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46223         CommonAcceptChannelFields_set_funding_pubkey(&this_ptr_conv, val_ref);
46224 }
46225
46226 int8_tArray  __attribute__((export_name("TS_CommonAcceptChannelFields_get_revocation_basepoint"))) TS_CommonAcceptChannelFields_get_revocation_basepoint(uint64_t this_ptr) {
46227         LDKCommonAcceptChannelFields 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         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46233         memcpy(ret_arr->elems, CommonAcceptChannelFields_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
46234         return ret_arr;
46235 }
46236
46237 void  __attribute__((export_name("TS_CommonAcceptChannelFields_set_revocation_basepoint"))) TS_CommonAcceptChannelFields_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
46238         LDKCommonAcceptChannelFields this_ptr_conv;
46239         this_ptr_conv.inner = untag_ptr(this_ptr);
46240         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46242         this_ptr_conv.is_owned = false;
46243         LDKPublicKey val_ref;
46244         CHECK(val->arr_len == 33);
46245         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46246         CommonAcceptChannelFields_set_revocation_basepoint(&this_ptr_conv, val_ref);
46247 }
46248
46249 int8_tArray  __attribute__((export_name("TS_CommonAcceptChannelFields_get_payment_basepoint"))) TS_CommonAcceptChannelFields_get_payment_basepoint(uint64_t this_ptr) {
46250         LDKCommonAcceptChannelFields this_ptr_conv;
46251         this_ptr_conv.inner = untag_ptr(this_ptr);
46252         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46254         this_ptr_conv.is_owned = false;
46255         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46256         memcpy(ret_arr->elems, CommonAcceptChannelFields_get_payment_basepoint(&this_ptr_conv).compressed_form, 33);
46257         return ret_arr;
46258 }
46259
46260 void  __attribute__((export_name("TS_CommonAcceptChannelFields_set_payment_basepoint"))) TS_CommonAcceptChannelFields_set_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
46261         LDKCommonAcceptChannelFields this_ptr_conv;
46262         this_ptr_conv.inner = untag_ptr(this_ptr);
46263         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46265         this_ptr_conv.is_owned = false;
46266         LDKPublicKey val_ref;
46267         CHECK(val->arr_len == 33);
46268         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46269         CommonAcceptChannelFields_set_payment_basepoint(&this_ptr_conv, val_ref);
46270 }
46271
46272 int8_tArray  __attribute__((export_name("TS_CommonAcceptChannelFields_get_delayed_payment_basepoint"))) TS_CommonAcceptChannelFields_get_delayed_payment_basepoint(uint64_t this_ptr) {
46273         LDKCommonAcceptChannelFields this_ptr_conv;
46274         this_ptr_conv.inner = untag_ptr(this_ptr);
46275         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46277         this_ptr_conv.is_owned = false;
46278         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46279         memcpy(ret_arr->elems, CommonAcceptChannelFields_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
46280         return ret_arr;
46281 }
46282
46283 void  __attribute__((export_name("TS_CommonAcceptChannelFields_set_delayed_payment_basepoint"))) TS_CommonAcceptChannelFields_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
46284         LDKCommonAcceptChannelFields this_ptr_conv;
46285         this_ptr_conv.inner = untag_ptr(this_ptr);
46286         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46288         this_ptr_conv.is_owned = false;
46289         LDKPublicKey val_ref;
46290         CHECK(val->arr_len == 33);
46291         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46292         CommonAcceptChannelFields_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
46293 }
46294
46295 int8_tArray  __attribute__((export_name("TS_CommonAcceptChannelFields_get_htlc_basepoint"))) TS_CommonAcceptChannelFields_get_htlc_basepoint(uint64_t this_ptr) {
46296         LDKCommonAcceptChannelFields this_ptr_conv;
46297         this_ptr_conv.inner = untag_ptr(this_ptr);
46298         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46300         this_ptr_conv.is_owned = false;
46301         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46302         memcpy(ret_arr->elems, CommonAcceptChannelFields_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
46303         return ret_arr;
46304 }
46305
46306 void  __attribute__((export_name("TS_CommonAcceptChannelFields_set_htlc_basepoint"))) TS_CommonAcceptChannelFields_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
46307         LDKCommonAcceptChannelFields this_ptr_conv;
46308         this_ptr_conv.inner = untag_ptr(this_ptr);
46309         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46311         this_ptr_conv.is_owned = false;
46312         LDKPublicKey val_ref;
46313         CHECK(val->arr_len == 33);
46314         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46315         CommonAcceptChannelFields_set_htlc_basepoint(&this_ptr_conv, val_ref);
46316 }
46317
46318 int8_tArray  __attribute__((export_name("TS_CommonAcceptChannelFields_get_first_per_commitment_point"))) TS_CommonAcceptChannelFields_get_first_per_commitment_point(uint64_t this_ptr) {
46319         LDKCommonAcceptChannelFields this_ptr_conv;
46320         this_ptr_conv.inner = untag_ptr(this_ptr);
46321         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46323         this_ptr_conv.is_owned = false;
46324         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46325         memcpy(ret_arr->elems, CommonAcceptChannelFields_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
46326         return ret_arr;
46327 }
46328
46329 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) {
46330         LDKCommonAcceptChannelFields this_ptr_conv;
46331         this_ptr_conv.inner = untag_ptr(this_ptr);
46332         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46334         this_ptr_conv.is_owned = false;
46335         LDKPublicKey val_ref;
46336         CHECK(val->arr_len == 33);
46337         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46338         CommonAcceptChannelFields_set_first_per_commitment_point(&this_ptr_conv, val_ref);
46339 }
46340
46341 uint64_t  __attribute__((export_name("TS_CommonAcceptChannelFields_get_shutdown_scriptpubkey"))) TS_CommonAcceptChannelFields_get_shutdown_scriptpubkey(uint64_t this_ptr) {
46342         LDKCommonAcceptChannelFields this_ptr_conv;
46343         this_ptr_conv.inner = untag_ptr(this_ptr);
46344         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46346         this_ptr_conv.is_owned = false;
46347         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
46348         *ret_copy = CommonAcceptChannelFields_get_shutdown_scriptpubkey(&this_ptr_conv);
46349         uint64_t ret_ref = tag_ptr(ret_copy, true);
46350         return ret_ref;
46351 }
46352
46353 void  __attribute__((export_name("TS_CommonAcceptChannelFields_set_shutdown_scriptpubkey"))) TS_CommonAcceptChannelFields_set_shutdown_scriptpubkey(uint64_t this_ptr, uint64_t val) {
46354         LDKCommonAcceptChannelFields this_ptr_conv;
46355         this_ptr_conv.inner = untag_ptr(this_ptr);
46356         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46358         this_ptr_conv.is_owned = false;
46359         void* val_ptr = untag_ptr(val);
46360         CHECK_ACCESS(val_ptr);
46361         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
46362         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
46363         CommonAcceptChannelFields_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
46364 }
46365
46366 uint64_t  __attribute__((export_name("TS_CommonAcceptChannelFields_get_channel_type"))) TS_CommonAcceptChannelFields_get_channel_type(uint64_t this_ptr) {
46367         LDKCommonAcceptChannelFields this_ptr_conv;
46368         this_ptr_conv.inner = untag_ptr(this_ptr);
46369         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46371         this_ptr_conv.is_owned = false;
46372         LDKChannelTypeFeatures ret_var = CommonAcceptChannelFields_get_channel_type(&this_ptr_conv);
46373         uint64_t ret_ref = 0;
46374         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46375         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46376         return ret_ref;
46377 }
46378
46379 void  __attribute__((export_name("TS_CommonAcceptChannelFields_set_channel_type"))) TS_CommonAcceptChannelFields_set_channel_type(uint64_t this_ptr, uint64_t val) {
46380         LDKCommonAcceptChannelFields this_ptr_conv;
46381         this_ptr_conv.inner = untag_ptr(this_ptr);
46382         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46384         this_ptr_conv.is_owned = false;
46385         LDKChannelTypeFeatures val_conv;
46386         val_conv.inner = untag_ptr(val);
46387         val_conv.is_owned = ptr_is_owned(val);
46388         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46389         val_conv = ChannelTypeFeatures_clone(&val_conv);
46390         CommonAcceptChannelFields_set_channel_type(&this_ptr_conv, val_conv);
46391 }
46392
46393 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) {
46394         LDKChannelId temporary_channel_id_arg_conv;
46395         temporary_channel_id_arg_conv.inner = untag_ptr(temporary_channel_id_arg);
46396         temporary_channel_id_arg_conv.is_owned = ptr_is_owned(temporary_channel_id_arg);
46397         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_arg_conv);
46398         temporary_channel_id_arg_conv = ChannelId_clone(&temporary_channel_id_arg_conv);
46399         LDKPublicKey funding_pubkey_arg_ref;
46400         CHECK(funding_pubkey_arg->arr_len == 33);
46401         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
46402         LDKPublicKey revocation_basepoint_arg_ref;
46403         CHECK(revocation_basepoint_arg->arr_len == 33);
46404         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
46405         LDKPublicKey payment_basepoint_arg_ref;
46406         CHECK(payment_basepoint_arg->arr_len == 33);
46407         memcpy(payment_basepoint_arg_ref.compressed_form, payment_basepoint_arg->elems, 33); FREE(payment_basepoint_arg);
46408         LDKPublicKey delayed_payment_basepoint_arg_ref;
46409         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
46410         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
46411         LDKPublicKey htlc_basepoint_arg_ref;
46412         CHECK(htlc_basepoint_arg->arr_len == 33);
46413         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
46414         LDKPublicKey first_per_commitment_point_arg_ref;
46415         CHECK(first_per_commitment_point_arg->arr_len == 33);
46416         memcpy(first_per_commitment_point_arg_ref.compressed_form, first_per_commitment_point_arg->elems, 33); FREE(first_per_commitment_point_arg);
46417         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
46418         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
46419         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
46420         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
46421         LDKChannelTypeFeatures channel_type_arg_conv;
46422         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
46423         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
46424         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
46425         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
46426         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);
46427         uint64_t ret_ref = 0;
46428         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46429         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46430         return ret_ref;
46431 }
46432
46433 static inline uint64_t CommonAcceptChannelFields_clone_ptr(LDKCommonAcceptChannelFields *NONNULL_PTR arg) {
46434         LDKCommonAcceptChannelFields ret_var = CommonAcceptChannelFields_clone(arg);
46435         uint64_t ret_ref = 0;
46436         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46437         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46438         return ret_ref;
46439 }
46440 int64_t  __attribute__((export_name("TS_CommonAcceptChannelFields_clone_ptr"))) TS_CommonAcceptChannelFields_clone_ptr(uint64_t arg) {
46441         LDKCommonAcceptChannelFields arg_conv;
46442         arg_conv.inner = untag_ptr(arg);
46443         arg_conv.is_owned = ptr_is_owned(arg);
46444         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46445         arg_conv.is_owned = false;
46446         int64_t ret_conv = CommonAcceptChannelFields_clone_ptr(&arg_conv);
46447         return ret_conv;
46448 }
46449
46450 uint64_t  __attribute__((export_name("TS_CommonAcceptChannelFields_clone"))) TS_CommonAcceptChannelFields_clone(uint64_t orig) {
46451         LDKCommonAcceptChannelFields orig_conv;
46452         orig_conv.inner = untag_ptr(orig);
46453         orig_conv.is_owned = ptr_is_owned(orig);
46454         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46455         orig_conv.is_owned = false;
46456         LDKCommonAcceptChannelFields ret_var = CommonAcceptChannelFields_clone(&orig_conv);
46457         uint64_t ret_ref = 0;
46458         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46459         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46460         return ret_ref;
46461 }
46462
46463 int64_t  __attribute__((export_name("TS_CommonAcceptChannelFields_hash"))) TS_CommonAcceptChannelFields_hash(uint64_t o) {
46464         LDKCommonAcceptChannelFields o_conv;
46465         o_conv.inner = untag_ptr(o);
46466         o_conv.is_owned = ptr_is_owned(o);
46467         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46468         o_conv.is_owned = false;
46469         int64_t ret_conv = CommonAcceptChannelFields_hash(&o_conv);
46470         return ret_conv;
46471 }
46472
46473 jboolean  __attribute__((export_name("TS_CommonAcceptChannelFields_eq"))) TS_CommonAcceptChannelFields_eq(uint64_t a, uint64_t b) {
46474         LDKCommonAcceptChannelFields a_conv;
46475         a_conv.inner = untag_ptr(a);
46476         a_conv.is_owned = ptr_is_owned(a);
46477         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46478         a_conv.is_owned = false;
46479         LDKCommonAcceptChannelFields b_conv;
46480         b_conv.inner = untag_ptr(b);
46481         b_conv.is_owned = ptr_is_owned(b);
46482         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46483         b_conv.is_owned = false;
46484         jboolean ret_conv = CommonAcceptChannelFields_eq(&a_conv, &b_conv);
46485         return ret_conv;
46486 }
46487
46488 void  __attribute__((export_name("TS_AcceptChannel_free"))) TS_AcceptChannel_free(uint64_t this_obj) {
46489         LDKAcceptChannel this_obj_conv;
46490         this_obj_conv.inner = untag_ptr(this_obj);
46491         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46493         AcceptChannel_free(this_obj_conv);
46494 }
46495
46496 uint64_t  __attribute__((export_name("TS_AcceptChannel_get_common_fields"))) TS_AcceptChannel_get_common_fields(uint64_t this_ptr) {
46497         LDKAcceptChannel this_ptr_conv;
46498         this_ptr_conv.inner = untag_ptr(this_ptr);
46499         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46501         this_ptr_conv.is_owned = false;
46502         LDKCommonAcceptChannelFields ret_var = AcceptChannel_get_common_fields(&this_ptr_conv);
46503         uint64_t ret_ref = 0;
46504         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46505         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46506         return ret_ref;
46507 }
46508
46509 void  __attribute__((export_name("TS_AcceptChannel_set_common_fields"))) TS_AcceptChannel_set_common_fields(uint64_t this_ptr, uint64_t val) {
46510         LDKAcceptChannel this_ptr_conv;
46511         this_ptr_conv.inner = untag_ptr(this_ptr);
46512         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46514         this_ptr_conv.is_owned = false;
46515         LDKCommonAcceptChannelFields val_conv;
46516         val_conv.inner = untag_ptr(val);
46517         val_conv.is_owned = ptr_is_owned(val);
46518         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46519         val_conv = CommonAcceptChannelFields_clone(&val_conv);
46520         AcceptChannel_set_common_fields(&this_ptr_conv, val_conv);
46521 }
46522
46523 int64_t  __attribute__((export_name("TS_AcceptChannel_get_channel_reserve_satoshis"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint64_t this_ptr) {
46524         LDKAcceptChannel this_ptr_conv;
46525         this_ptr_conv.inner = untag_ptr(this_ptr);
46526         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46528         this_ptr_conv.is_owned = false;
46529         int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
46530         return ret_conv;
46531 }
46532
46533 void  __attribute__((export_name("TS_AcceptChannel_set_channel_reserve_satoshis"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint64_t this_ptr, int64_t val) {
46534         LDKAcceptChannel this_ptr_conv;
46535         this_ptr_conv.inner = untag_ptr(this_ptr);
46536         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46538         this_ptr_conv.is_owned = false;
46539         AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
46540 }
46541
46542 uint64_t  __attribute__((export_name("TS_AcceptChannel_new"))) TS_AcceptChannel_new(uint64_t common_fields_arg, int64_t channel_reserve_satoshis_arg) {
46543         LDKCommonAcceptChannelFields common_fields_arg_conv;
46544         common_fields_arg_conv.inner = untag_ptr(common_fields_arg);
46545         common_fields_arg_conv.is_owned = ptr_is_owned(common_fields_arg);
46546         CHECK_INNER_FIELD_ACCESS_OR_NULL(common_fields_arg_conv);
46547         common_fields_arg_conv = CommonAcceptChannelFields_clone(&common_fields_arg_conv);
46548         LDKAcceptChannel ret_var = AcceptChannel_new(common_fields_arg_conv, channel_reserve_satoshis_arg);
46549         uint64_t ret_ref = 0;
46550         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46551         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46552         return ret_ref;
46553 }
46554
46555 static inline uint64_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
46556         LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
46557         uint64_t ret_ref = 0;
46558         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46559         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46560         return ret_ref;
46561 }
46562 int64_t  __attribute__((export_name("TS_AcceptChannel_clone_ptr"))) TS_AcceptChannel_clone_ptr(uint64_t arg) {
46563         LDKAcceptChannel arg_conv;
46564         arg_conv.inner = untag_ptr(arg);
46565         arg_conv.is_owned = ptr_is_owned(arg);
46566         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46567         arg_conv.is_owned = false;
46568         int64_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
46569         return ret_conv;
46570 }
46571
46572 uint64_t  __attribute__((export_name("TS_AcceptChannel_clone"))) TS_AcceptChannel_clone(uint64_t orig) {
46573         LDKAcceptChannel orig_conv;
46574         orig_conv.inner = untag_ptr(orig);
46575         orig_conv.is_owned = ptr_is_owned(orig);
46576         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46577         orig_conv.is_owned = false;
46578         LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
46579         uint64_t ret_ref = 0;
46580         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46581         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46582         return ret_ref;
46583 }
46584
46585 int64_t  __attribute__((export_name("TS_AcceptChannel_hash"))) TS_AcceptChannel_hash(uint64_t o) {
46586         LDKAcceptChannel o_conv;
46587         o_conv.inner = untag_ptr(o);
46588         o_conv.is_owned = ptr_is_owned(o);
46589         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46590         o_conv.is_owned = false;
46591         int64_t ret_conv = AcceptChannel_hash(&o_conv);
46592         return ret_conv;
46593 }
46594
46595 jboolean  __attribute__((export_name("TS_AcceptChannel_eq"))) TS_AcceptChannel_eq(uint64_t a, uint64_t b) {
46596         LDKAcceptChannel a_conv;
46597         a_conv.inner = untag_ptr(a);
46598         a_conv.is_owned = ptr_is_owned(a);
46599         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46600         a_conv.is_owned = false;
46601         LDKAcceptChannel b_conv;
46602         b_conv.inner = untag_ptr(b);
46603         b_conv.is_owned = ptr_is_owned(b);
46604         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46605         b_conv.is_owned = false;
46606         jboolean ret_conv = AcceptChannel_eq(&a_conv, &b_conv);
46607         return ret_conv;
46608 }
46609
46610 void  __attribute__((export_name("TS_AcceptChannelV2_free"))) TS_AcceptChannelV2_free(uint64_t this_obj) {
46611         LDKAcceptChannelV2 this_obj_conv;
46612         this_obj_conv.inner = untag_ptr(this_obj);
46613         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46615         AcceptChannelV2_free(this_obj_conv);
46616 }
46617
46618 uint64_t  __attribute__((export_name("TS_AcceptChannelV2_get_common_fields"))) TS_AcceptChannelV2_get_common_fields(uint64_t this_ptr) {
46619         LDKAcceptChannelV2 this_ptr_conv;
46620         this_ptr_conv.inner = untag_ptr(this_ptr);
46621         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46623         this_ptr_conv.is_owned = false;
46624         LDKCommonAcceptChannelFields ret_var = AcceptChannelV2_get_common_fields(&this_ptr_conv);
46625         uint64_t ret_ref = 0;
46626         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46627         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46628         return ret_ref;
46629 }
46630
46631 void  __attribute__((export_name("TS_AcceptChannelV2_set_common_fields"))) TS_AcceptChannelV2_set_common_fields(uint64_t this_ptr, uint64_t val) {
46632         LDKAcceptChannelV2 this_ptr_conv;
46633         this_ptr_conv.inner = untag_ptr(this_ptr);
46634         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46636         this_ptr_conv.is_owned = false;
46637         LDKCommonAcceptChannelFields val_conv;
46638         val_conv.inner = untag_ptr(val);
46639         val_conv.is_owned = ptr_is_owned(val);
46640         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46641         val_conv = CommonAcceptChannelFields_clone(&val_conv);
46642         AcceptChannelV2_set_common_fields(&this_ptr_conv, val_conv);
46643 }
46644
46645 int64_t  __attribute__((export_name("TS_AcceptChannelV2_get_funding_satoshis"))) TS_AcceptChannelV2_get_funding_satoshis(uint64_t this_ptr) {
46646         LDKAcceptChannelV2 this_ptr_conv;
46647         this_ptr_conv.inner = untag_ptr(this_ptr);
46648         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46650         this_ptr_conv.is_owned = false;
46651         int64_t ret_conv = AcceptChannelV2_get_funding_satoshis(&this_ptr_conv);
46652         return ret_conv;
46653 }
46654
46655 void  __attribute__((export_name("TS_AcceptChannelV2_set_funding_satoshis"))) TS_AcceptChannelV2_set_funding_satoshis(uint64_t this_ptr, int64_t val) {
46656         LDKAcceptChannelV2 this_ptr_conv;
46657         this_ptr_conv.inner = untag_ptr(this_ptr);
46658         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46660         this_ptr_conv.is_owned = false;
46661         AcceptChannelV2_set_funding_satoshis(&this_ptr_conv, val);
46662 }
46663
46664 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_second_per_commitment_point"))) TS_AcceptChannelV2_get_second_per_commitment_point(uint64_t this_ptr) {
46665         LDKAcceptChannelV2 this_ptr_conv;
46666         this_ptr_conv.inner = untag_ptr(this_ptr);
46667         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46669         this_ptr_conv.is_owned = false;
46670         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46671         memcpy(ret_arr->elems, AcceptChannelV2_get_second_per_commitment_point(&this_ptr_conv).compressed_form, 33);
46672         return ret_arr;
46673 }
46674
46675 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) {
46676         LDKAcceptChannelV2 this_ptr_conv;
46677         this_ptr_conv.inner = untag_ptr(this_ptr);
46678         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46680         this_ptr_conv.is_owned = false;
46681         LDKPublicKey val_ref;
46682         CHECK(val->arr_len == 33);
46683         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46684         AcceptChannelV2_set_second_per_commitment_point(&this_ptr_conv, val_ref);
46685 }
46686
46687 uint32_t  __attribute__((export_name("TS_AcceptChannelV2_get_require_confirmed_inputs"))) TS_AcceptChannelV2_get_require_confirmed_inputs(uint64_t this_ptr) {
46688         LDKAcceptChannelV2 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         uint32_t ret_conv = LDKCOption_NoneZ_to_js(AcceptChannelV2_get_require_confirmed_inputs(&this_ptr_conv));
46694         return ret_conv;
46695 }
46696
46697 void  __attribute__((export_name("TS_AcceptChannelV2_set_require_confirmed_inputs"))) TS_AcceptChannelV2_set_require_confirmed_inputs(uint64_t this_ptr, uint32_t val) {
46698         LDKAcceptChannelV2 this_ptr_conv;
46699         this_ptr_conv.inner = untag_ptr(this_ptr);
46700         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46702         this_ptr_conv.is_owned = false;
46703         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
46704         AcceptChannelV2_set_require_confirmed_inputs(&this_ptr_conv, val_conv);
46705 }
46706
46707 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) {
46708         LDKCommonAcceptChannelFields common_fields_arg_conv;
46709         common_fields_arg_conv.inner = untag_ptr(common_fields_arg);
46710         common_fields_arg_conv.is_owned = ptr_is_owned(common_fields_arg);
46711         CHECK_INNER_FIELD_ACCESS_OR_NULL(common_fields_arg_conv);
46712         common_fields_arg_conv = CommonAcceptChannelFields_clone(&common_fields_arg_conv);
46713         LDKPublicKey second_per_commitment_point_arg_ref;
46714         CHECK(second_per_commitment_point_arg->arr_len == 33);
46715         memcpy(second_per_commitment_point_arg_ref.compressed_form, second_per_commitment_point_arg->elems, 33); FREE(second_per_commitment_point_arg);
46716         LDKCOption_NoneZ require_confirmed_inputs_arg_conv = LDKCOption_NoneZ_from_js(require_confirmed_inputs_arg);
46717         LDKAcceptChannelV2 ret_var = AcceptChannelV2_new(common_fields_arg_conv, funding_satoshis_arg, second_per_commitment_point_arg_ref, require_confirmed_inputs_arg_conv);
46718         uint64_t ret_ref = 0;
46719         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46720         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46721         return ret_ref;
46722 }
46723
46724 static inline uint64_t AcceptChannelV2_clone_ptr(LDKAcceptChannelV2 *NONNULL_PTR arg) {
46725         LDKAcceptChannelV2 ret_var = AcceptChannelV2_clone(arg);
46726         uint64_t ret_ref = 0;
46727         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46728         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46729         return ret_ref;
46730 }
46731 int64_t  __attribute__((export_name("TS_AcceptChannelV2_clone_ptr"))) TS_AcceptChannelV2_clone_ptr(uint64_t arg) {
46732         LDKAcceptChannelV2 arg_conv;
46733         arg_conv.inner = untag_ptr(arg);
46734         arg_conv.is_owned = ptr_is_owned(arg);
46735         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46736         arg_conv.is_owned = false;
46737         int64_t ret_conv = AcceptChannelV2_clone_ptr(&arg_conv);
46738         return ret_conv;
46739 }
46740
46741 uint64_t  __attribute__((export_name("TS_AcceptChannelV2_clone"))) TS_AcceptChannelV2_clone(uint64_t orig) {
46742         LDKAcceptChannelV2 orig_conv;
46743         orig_conv.inner = untag_ptr(orig);
46744         orig_conv.is_owned = ptr_is_owned(orig);
46745         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46746         orig_conv.is_owned = false;
46747         LDKAcceptChannelV2 ret_var = AcceptChannelV2_clone(&orig_conv);
46748         uint64_t ret_ref = 0;
46749         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46750         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46751         return ret_ref;
46752 }
46753
46754 int64_t  __attribute__((export_name("TS_AcceptChannelV2_hash"))) TS_AcceptChannelV2_hash(uint64_t o) {
46755         LDKAcceptChannelV2 o_conv;
46756         o_conv.inner = untag_ptr(o);
46757         o_conv.is_owned = ptr_is_owned(o);
46758         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46759         o_conv.is_owned = false;
46760         int64_t ret_conv = AcceptChannelV2_hash(&o_conv);
46761         return ret_conv;
46762 }
46763
46764 jboolean  __attribute__((export_name("TS_AcceptChannelV2_eq"))) TS_AcceptChannelV2_eq(uint64_t a, uint64_t b) {
46765         LDKAcceptChannelV2 a_conv;
46766         a_conv.inner = untag_ptr(a);
46767         a_conv.is_owned = ptr_is_owned(a);
46768         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46769         a_conv.is_owned = false;
46770         LDKAcceptChannelV2 b_conv;
46771         b_conv.inner = untag_ptr(b);
46772         b_conv.is_owned = ptr_is_owned(b);
46773         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46774         b_conv.is_owned = false;
46775         jboolean ret_conv = AcceptChannelV2_eq(&a_conv, &b_conv);
46776         return ret_conv;
46777 }
46778
46779 void  __attribute__((export_name("TS_FundingCreated_free"))) TS_FundingCreated_free(uint64_t this_obj) {
46780         LDKFundingCreated this_obj_conv;
46781         this_obj_conv.inner = untag_ptr(this_obj);
46782         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46784         FundingCreated_free(this_obj_conv);
46785 }
46786
46787 uint64_t  __attribute__((export_name("TS_FundingCreated_get_temporary_channel_id"))) TS_FundingCreated_get_temporary_channel_id(uint64_t this_ptr) {
46788         LDKFundingCreated this_ptr_conv;
46789         this_ptr_conv.inner = untag_ptr(this_ptr);
46790         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46792         this_ptr_conv.is_owned = false;
46793         LDKChannelId ret_var = FundingCreated_get_temporary_channel_id(&this_ptr_conv);
46794         uint64_t ret_ref = 0;
46795         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46796         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46797         return ret_ref;
46798 }
46799
46800 void  __attribute__((export_name("TS_FundingCreated_set_temporary_channel_id"))) TS_FundingCreated_set_temporary_channel_id(uint64_t this_ptr, uint64_t val) {
46801         LDKFundingCreated this_ptr_conv;
46802         this_ptr_conv.inner = untag_ptr(this_ptr);
46803         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46805         this_ptr_conv.is_owned = false;
46806         LDKChannelId val_conv;
46807         val_conv.inner = untag_ptr(val);
46808         val_conv.is_owned = ptr_is_owned(val);
46809         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46810         val_conv = ChannelId_clone(&val_conv);
46811         FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_conv);
46812 }
46813
46814 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_funding_txid"))) TS_FundingCreated_get_funding_txid(uint64_t this_ptr) {
46815         LDKFundingCreated 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         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46821         memcpy(ret_arr->elems, *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
46822         return ret_arr;
46823 }
46824
46825 void  __attribute__((export_name("TS_FundingCreated_set_funding_txid"))) TS_FundingCreated_set_funding_txid(uint64_t this_ptr, int8_tArray val) {
46826         LDKFundingCreated this_ptr_conv;
46827         this_ptr_conv.inner = untag_ptr(this_ptr);
46828         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46830         this_ptr_conv.is_owned = false;
46831         LDKThirtyTwoBytes val_ref;
46832         CHECK(val->arr_len == 32);
46833         memcpy(val_ref.data, val->elems, 32); FREE(val);
46834         FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
46835 }
46836
46837 int16_t  __attribute__((export_name("TS_FundingCreated_get_funding_output_index"))) TS_FundingCreated_get_funding_output_index(uint64_t this_ptr) {
46838         LDKFundingCreated 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         int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
46844         return ret_conv;
46845 }
46846
46847 void  __attribute__((export_name("TS_FundingCreated_set_funding_output_index"))) TS_FundingCreated_set_funding_output_index(uint64_t this_ptr, int16_t val) {
46848         LDKFundingCreated this_ptr_conv;
46849         this_ptr_conv.inner = untag_ptr(this_ptr);
46850         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46852         this_ptr_conv.is_owned = false;
46853         FundingCreated_set_funding_output_index(&this_ptr_conv, val);
46854 }
46855
46856 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_signature"))) TS_FundingCreated_get_signature(uint64_t this_ptr) {
46857         LDKFundingCreated this_ptr_conv;
46858         this_ptr_conv.inner = untag_ptr(this_ptr);
46859         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46861         this_ptr_conv.is_owned = false;
46862         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
46863         memcpy(ret_arr->elems, FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
46864         return ret_arr;
46865 }
46866
46867 void  __attribute__((export_name("TS_FundingCreated_set_signature"))) TS_FundingCreated_set_signature(uint64_t this_ptr, int8_tArray val) {
46868         LDKFundingCreated this_ptr_conv;
46869         this_ptr_conv.inner = untag_ptr(this_ptr);
46870         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46872         this_ptr_conv.is_owned = false;
46873         LDKECDSASignature val_ref;
46874         CHECK(val->arr_len == 64);
46875         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
46876         FundingCreated_set_signature(&this_ptr_conv, val_ref);
46877 }
46878
46879 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) {
46880         LDKChannelId temporary_channel_id_arg_conv;
46881         temporary_channel_id_arg_conv.inner = untag_ptr(temporary_channel_id_arg);
46882         temporary_channel_id_arg_conv.is_owned = ptr_is_owned(temporary_channel_id_arg);
46883         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_arg_conv);
46884         temporary_channel_id_arg_conv = ChannelId_clone(&temporary_channel_id_arg_conv);
46885         LDKThirtyTwoBytes funding_txid_arg_ref;
46886         CHECK(funding_txid_arg->arr_len == 32);
46887         memcpy(funding_txid_arg_ref.data, funding_txid_arg->elems, 32); FREE(funding_txid_arg);
46888         LDKECDSASignature signature_arg_ref;
46889         CHECK(signature_arg->arr_len == 64);
46890         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
46891         LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_conv, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
46892         uint64_t ret_ref = 0;
46893         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46894         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46895         return ret_ref;
46896 }
46897
46898 static inline uint64_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
46899         LDKFundingCreated ret_var = FundingCreated_clone(arg);
46900         uint64_t ret_ref = 0;
46901         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46902         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46903         return ret_ref;
46904 }
46905 int64_t  __attribute__((export_name("TS_FundingCreated_clone_ptr"))) TS_FundingCreated_clone_ptr(uint64_t arg) {
46906         LDKFundingCreated arg_conv;
46907         arg_conv.inner = untag_ptr(arg);
46908         arg_conv.is_owned = ptr_is_owned(arg);
46909         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46910         arg_conv.is_owned = false;
46911         int64_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
46912         return ret_conv;
46913 }
46914
46915 uint64_t  __attribute__((export_name("TS_FundingCreated_clone"))) TS_FundingCreated_clone(uint64_t orig) {
46916         LDKFundingCreated orig_conv;
46917         orig_conv.inner = untag_ptr(orig);
46918         orig_conv.is_owned = ptr_is_owned(orig);
46919         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46920         orig_conv.is_owned = false;
46921         LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
46922         uint64_t ret_ref = 0;
46923         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46924         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46925         return ret_ref;
46926 }
46927
46928 int64_t  __attribute__((export_name("TS_FundingCreated_hash"))) TS_FundingCreated_hash(uint64_t o) {
46929         LDKFundingCreated o_conv;
46930         o_conv.inner = untag_ptr(o);
46931         o_conv.is_owned = ptr_is_owned(o);
46932         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46933         o_conv.is_owned = false;
46934         int64_t ret_conv = FundingCreated_hash(&o_conv);
46935         return ret_conv;
46936 }
46937
46938 jboolean  __attribute__((export_name("TS_FundingCreated_eq"))) TS_FundingCreated_eq(uint64_t a, uint64_t b) {
46939         LDKFundingCreated a_conv;
46940         a_conv.inner = untag_ptr(a);
46941         a_conv.is_owned = ptr_is_owned(a);
46942         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46943         a_conv.is_owned = false;
46944         LDKFundingCreated b_conv;
46945         b_conv.inner = untag_ptr(b);
46946         b_conv.is_owned = ptr_is_owned(b);
46947         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46948         b_conv.is_owned = false;
46949         jboolean ret_conv = FundingCreated_eq(&a_conv, &b_conv);
46950         return ret_conv;
46951 }
46952
46953 void  __attribute__((export_name("TS_FundingSigned_free"))) TS_FundingSigned_free(uint64_t this_obj) {
46954         LDKFundingSigned this_obj_conv;
46955         this_obj_conv.inner = untag_ptr(this_obj);
46956         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46958         FundingSigned_free(this_obj_conv);
46959 }
46960
46961 uint64_t  __attribute__((export_name("TS_FundingSigned_get_channel_id"))) TS_FundingSigned_get_channel_id(uint64_t this_ptr) {
46962         LDKFundingSigned this_ptr_conv;
46963         this_ptr_conv.inner = untag_ptr(this_ptr);
46964         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46966         this_ptr_conv.is_owned = false;
46967         LDKChannelId ret_var = FundingSigned_get_channel_id(&this_ptr_conv);
46968         uint64_t ret_ref = 0;
46969         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46970         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46971         return ret_ref;
46972 }
46973
46974 void  __attribute__((export_name("TS_FundingSigned_set_channel_id"))) TS_FundingSigned_set_channel_id(uint64_t this_ptr, uint64_t val) {
46975         LDKFundingSigned this_ptr_conv;
46976         this_ptr_conv.inner = untag_ptr(this_ptr);
46977         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46979         this_ptr_conv.is_owned = false;
46980         LDKChannelId val_conv;
46981         val_conv.inner = untag_ptr(val);
46982         val_conv.is_owned = ptr_is_owned(val);
46983         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46984         val_conv = ChannelId_clone(&val_conv);
46985         FundingSigned_set_channel_id(&this_ptr_conv, val_conv);
46986 }
46987
46988 int8_tArray  __attribute__((export_name("TS_FundingSigned_get_signature"))) TS_FundingSigned_get_signature(uint64_t this_ptr) {
46989         LDKFundingSigned this_ptr_conv;
46990         this_ptr_conv.inner = untag_ptr(this_ptr);
46991         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46993         this_ptr_conv.is_owned = false;
46994         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
46995         memcpy(ret_arr->elems, FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
46996         return ret_arr;
46997 }
46998
46999 void  __attribute__((export_name("TS_FundingSigned_set_signature"))) TS_FundingSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
47000         LDKFundingSigned this_ptr_conv;
47001         this_ptr_conv.inner = untag_ptr(this_ptr);
47002         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47004         this_ptr_conv.is_owned = false;
47005         LDKECDSASignature val_ref;
47006         CHECK(val->arr_len == 64);
47007         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
47008         FundingSigned_set_signature(&this_ptr_conv, val_ref);
47009 }
47010
47011 uint64_t  __attribute__((export_name("TS_FundingSigned_new"))) TS_FundingSigned_new(uint64_t channel_id_arg, int8_tArray signature_arg) {
47012         LDKChannelId channel_id_arg_conv;
47013         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
47014         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
47015         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
47016         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
47017         LDKECDSASignature signature_arg_ref;
47018         CHECK(signature_arg->arr_len == 64);
47019         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
47020         LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_conv, signature_arg_ref);
47021         uint64_t ret_ref = 0;
47022         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47023         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47024         return ret_ref;
47025 }
47026
47027 static inline uint64_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
47028         LDKFundingSigned ret_var = FundingSigned_clone(arg);
47029         uint64_t ret_ref = 0;
47030         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47031         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47032         return ret_ref;
47033 }
47034 int64_t  __attribute__((export_name("TS_FundingSigned_clone_ptr"))) TS_FundingSigned_clone_ptr(uint64_t arg) {
47035         LDKFundingSigned arg_conv;
47036         arg_conv.inner = untag_ptr(arg);
47037         arg_conv.is_owned = ptr_is_owned(arg);
47038         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47039         arg_conv.is_owned = false;
47040         int64_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
47041         return ret_conv;
47042 }
47043
47044 uint64_t  __attribute__((export_name("TS_FundingSigned_clone"))) TS_FundingSigned_clone(uint64_t orig) {
47045         LDKFundingSigned orig_conv;
47046         orig_conv.inner = untag_ptr(orig);
47047         orig_conv.is_owned = ptr_is_owned(orig);
47048         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47049         orig_conv.is_owned = false;
47050         LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
47051         uint64_t ret_ref = 0;
47052         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47053         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47054         return ret_ref;
47055 }
47056
47057 int64_t  __attribute__((export_name("TS_FundingSigned_hash"))) TS_FundingSigned_hash(uint64_t o) {
47058         LDKFundingSigned o_conv;
47059         o_conv.inner = untag_ptr(o);
47060         o_conv.is_owned = ptr_is_owned(o);
47061         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47062         o_conv.is_owned = false;
47063         int64_t ret_conv = FundingSigned_hash(&o_conv);
47064         return ret_conv;
47065 }
47066
47067 jboolean  __attribute__((export_name("TS_FundingSigned_eq"))) TS_FundingSigned_eq(uint64_t a, uint64_t b) {
47068         LDKFundingSigned a_conv;
47069         a_conv.inner = untag_ptr(a);
47070         a_conv.is_owned = ptr_is_owned(a);
47071         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47072         a_conv.is_owned = false;
47073         LDKFundingSigned b_conv;
47074         b_conv.inner = untag_ptr(b);
47075         b_conv.is_owned = ptr_is_owned(b);
47076         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47077         b_conv.is_owned = false;
47078         jboolean ret_conv = FundingSigned_eq(&a_conv, &b_conv);
47079         return ret_conv;
47080 }
47081
47082 void  __attribute__((export_name("TS_ChannelReady_free"))) TS_ChannelReady_free(uint64_t this_obj) {
47083         LDKChannelReady this_obj_conv;
47084         this_obj_conv.inner = untag_ptr(this_obj);
47085         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47087         ChannelReady_free(this_obj_conv);
47088 }
47089
47090 uint64_t  __attribute__((export_name("TS_ChannelReady_get_channel_id"))) TS_ChannelReady_get_channel_id(uint64_t this_ptr) {
47091         LDKChannelReady this_ptr_conv;
47092         this_ptr_conv.inner = untag_ptr(this_ptr);
47093         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47095         this_ptr_conv.is_owned = false;
47096         LDKChannelId ret_var = ChannelReady_get_channel_id(&this_ptr_conv);
47097         uint64_t ret_ref = 0;
47098         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47099         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47100         return ret_ref;
47101 }
47102
47103 void  __attribute__((export_name("TS_ChannelReady_set_channel_id"))) TS_ChannelReady_set_channel_id(uint64_t this_ptr, uint64_t val) {
47104         LDKChannelReady this_ptr_conv;
47105         this_ptr_conv.inner = untag_ptr(this_ptr);
47106         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47108         this_ptr_conv.is_owned = false;
47109         LDKChannelId val_conv;
47110         val_conv.inner = untag_ptr(val);
47111         val_conv.is_owned = ptr_is_owned(val);
47112         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47113         val_conv = ChannelId_clone(&val_conv);
47114         ChannelReady_set_channel_id(&this_ptr_conv, val_conv);
47115 }
47116
47117 int8_tArray  __attribute__((export_name("TS_ChannelReady_get_next_per_commitment_point"))) TS_ChannelReady_get_next_per_commitment_point(uint64_t this_ptr) {
47118         LDKChannelReady this_ptr_conv;
47119         this_ptr_conv.inner = untag_ptr(this_ptr);
47120         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47122         this_ptr_conv.is_owned = false;
47123         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47124         memcpy(ret_arr->elems, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
47125         return ret_arr;
47126 }
47127
47128 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) {
47129         LDKChannelReady this_ptr_conv;
47130         this_ptr_conv.inner = untag_ptr(this_ptr);
47131         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47133         this_ptr_conv.is_owned = false;
47134         LDKPublicKey val_ref;
47135         CHECK(val->arr_len == 33);
47136         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47137         ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
47138 }
47139
47140 uint64_t  __attribute__((export_name("TS_ChannelReady_get_short_channel_id_alias"))) TS_ChannelReady_get_short_channel_id_alias(uint64_t this_ptr) {
47141         LDKChannelReady this_ptr_conv;
47142         this_ptr_conv.inner = untag_ptr(this_ptr);
47143         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47145         this_ptr_conv.is_owned = false;
47146         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
47147         *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
47148         uint64_t ret_ref = tag_ptr(ret_copy, true);
47149         return ret_ref;
47150 }
47151
47152 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) {
47153         LDKChannelReady this_ptr_conv;
47154         this_ptr_conv.inner = untag_ptr(this_ptr);
47155         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47157         this_ptr_conv.is_owned = false;
47158         void* val_ptr = untag_ptr(val);
47159         CHECK_ACCESS(val_ptr);
47160         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
47161         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
47162         ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
47163 }
47164
47165 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) {
47166         LDKChannelId channel_id_arg_conv;
47167         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
47168         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
47169         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
47170         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
47171         LDKPublicKey next_per_commitment_point_arg_ref;
47172         CHECK(next_per_commitment_point_arg->arr_len == 33);
47173         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
47174         void* short_channel_id_alias_arg_ptr = untag_ptr(short_channel_id_alias_arg);
47175         CHECK_ACCESS(short_channel_id_alias_arg_ptr);
47176         LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
47177         short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_alias_arg));
47178         LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_conv, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
47179         uint64_t ret_ref = 0;
47180         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47181         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47182         return ret_ref;
47183 }
47184
47185 static inline uint64_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
47186         LDKChannelReady ret_var = ChannelReady_clone(arg);
47187         uint64_t ret_ref = 0;
47188         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47189         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47190         return ret_ref;
47191 }
47192 int64_t  __attribute__((export_name("TS_ChannelReady_clone_ptr"))) TS_ChannelReady_clone_ptr(uint64_t arg) {
47193         LDKChannelReady arg_conv;
47194         arg_conv.inner = untag_ptr(arg);
47195         arg_conv.is_owned = ptr_is_owned(arg);
47196         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47197         arg_conv.is_owned = false;
47198         int64_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
47199         return ret_conv;
47200 }
47201
47202 uint64_t  __attribute__((export_name("TS_ChannelReady_clone"))) TS_ChannelReady_clone(uint64_t orig) {
47203         LDKChannelReady orig_conv;
47204         orig_conv.inner = untag_ptr(orig);
47205         orig_conv.is_owned = ptr_is_owned(orig);
47206         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47207         orig_conv.is_owned = false;
47208         LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
47209         uint64_t ret_ref = 0;
47210         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47211         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47212         return ret_ref;
47213 }
47214
47215 int64_t  __attribute__((export_name("TS_ChannelReady_hash"))) TS_ChannelReady_hash(uint64_t o) {
47216         LDKChannelReady o_conv;
47217         o_conv.inner = untag_ptr(o);
47218         o_conv.is_owned = ptr_is_owned(o);
47219         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47220         o_conv.is_owned = false;
47221         int64_t ret_conv = ChannelReady_hash(&o_conv);
47222         return ret_conv;
47223 }
47224
47225 jboolean  __attribute__((export_name("TS_ChannelReady_eq"))) TS_ChannelReady_eq(uint64_t a, uint64_t b) {
47226         LDKChannelReady a_conv;
47227         a_conv.inner = untag_ptr(a);
47228         a_conv.is_owned = ptr_is_owned(a);
47229         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47230         a_conv.is_owned = false;
47231         LDKChannelReady b_conv;
47232         b_conv.inner = untag_ptr(b);
47233         b_conv.is_owned = ptr_is_owned(b);
47234         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47235         b_conv.is_owned = false;
47236         jboolean ret_conv = ChannelReady_eq(&a_conv, &b_conv);
47237         return ret_conv;
47238 }
47239
47240 void  __attribute__((export_name("TS_Stfu_free"))) TS_Stfu_free(uint64_t this_obj) {
47241         LDKStfu this_obj_conv;
47242         this_obj_conv.inner = untag_ptr(this_obj);
47243         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47245         Stfu_free(this_obj_conv);
47246 }
47247
47248 uint64_t  __attribute__((export_name("TS_Stfu_get_channel_id"))) TS_Stfu_get_channel_id(uint64_t this_ptr) {
47249         LDKStfu this_ptr_conv;
47250         this_ptr_conv.inner = untag_ptr(this_ptr);
47251         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47253         this_ptr_conv.is_owned = false;
47254         LDKChannelId ret_var = Stfu_get_channel_id(&this_ptr_conv);
47255         uint64_t ret_ref = 0;
47256         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47257         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47258         return ret_ref;
47259 }
47260
47261 void  __attribute__((export_name("TS_Stfu_set_channel_id"))) TS_Stfu_set_channel_id(uint64_t this_ptr, uint64_t val) {
47262         LDKStfu this_ptr_conv;
47263         this_ptr_conv.inner = untag_ptr(this_ptr);
47264         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47266         this_ptr_conv.is_owned = false;
47267         LDKChannelId val_conv;
47268         val_conv.inner = untag_ptr(val);
47269         val_conv.is_owned = ptr_is_owned(val);
47270         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47271         val_conv = ChannelId_clone(&val_conv);
47272         Stfu_set_channel_id(&this_ptr_conv, val_conv);
47273 }
47274
47275 int8_t  __attribute__((export_name("TS_Stfu_get_initiator"))) TS_Stfu_get_initiator(uint64_t this_ptr) {
47276         LDKStfu this_ptr_conv;
47277         this_ptr_conv.inner = untag_ptr(this_ptr);
47278         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47280         this_ptr_conv.is_owned = false;
47281         int8_t ret_conv = Stfu_get_initiator(&this_ptr_conv);
47282         return ret_conv;
47283 }
47284
47285 void  __attribute__((export_name("TS_Stfu_set_initiator"))) TS_Stfu_set_initiator(uint64_t this_ptr, int8_t val) {
47286         LDKStfu this_ptr_conv;
47287         this_ptr_conv.inner = untag_ptr(this_ptr);
47288         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47290         this_ptr_conv.is_owned = false;
47291         Stfu_set_initiator(&this_ptr_conv, val);
47292 }
47293
47294 uint64_t  __attribute__((export_name("TS_Stfu_new"))) TS_Stfu_new(uint64_t channel_id_arg, int8_t initiator_arg) {
47295         LDKChannelId channel_id_arg_conv;
47296         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
47297         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
47298         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
47299         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
47300         LDKStfu ret_var = Stfu_new(channel_id_arg_conv, initiator_arg);
47301         uint64_t ret_ref = 0;
47302         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47303         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47304         return ret_ref;
47305 }
47306
47307 static inline uint64_t Stfu_clone_ptr(LDKStfu *NONNULL_PTR arg) {
47308         LDKStfu ret_var = Stfu_clone(arg);
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 int64_t  __attribute__((export_name("TS_Stfu_clone_ptr"))) TS_Stfu_clone_ptr(uint64_t arg) {
47315         LDKStfu arg_conv;
47316         arg_conv.inner = untag_ptr(arg);
47317         arg_conv.is_owned = ptr_is_owned(arg);
47318         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47319         arg_conv.is_owned = false;
47320         int64_t ret_conv = Stfu_clone_ptr(&arg_conv);
47321         return ret_conv;
47322 }
47323
47324 uint64_t  __attribute__((export_name("TS_Stfu_clone"))) TS_Stfu_clone(uint64_t orig) {
47325         LDKStfu orig_conv;
47326         orig_conv.inner = untag_ptr(orig);
47327         orig_conv.is_owned = ptr_is_owned(orig);
47328         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47329         orig_conv.is_owned = false;
47330         LDKStfu ret_var = Stfu_clone(&orig_conv);
47331         uint64_t ret_ref = 0;
47332         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47333         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47334         return ret_ref;
47335 }
47336
47337 jboolean  __attribute__((export_name("TS_Stfu_eq"))) TS_Stfu_eq(uint64_t a, uint64_t b) {
47338         LDKStfu a_conv;
47339         a_conv.inner = untag_ptr(a);
47340         a_conv.is_owned = ptr_is_owned(a);
47341         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47342         a_conv.is_owned = false;
47343         LDKStfu b_conv;
47344         b_conv.inner = untag_ptr(b);
47345         b_conv.is_owned = ptr_is_owned(b);
47346         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47347         b_conv.is_owned = false;
47348         jboolean ret_conv = Stfu_eq(&a_conv, &b_conv);
47349         return ret_conv;
47350 }
47351
47352 void  __attribute__((export_name("TS_Splice_free"))) TS_Splice_free(uint64_t this_obj) {
47353         LDKSplice this_obj_conv;
47354         this_obj_conv.inner = untag_ptr(this_obj);
47355         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47357         Splice_free(this_obj_conv);
47358 }
47359
47360 uint64_t  __attribute__((export_name("TS_Splice_get_channel_id"))) TS_Splice_get_channel_id(uint64_t this_ptr) {
47361         LDKSplice this_ptr_conv;
47362         this_ptr_conv.inner = untag_ptr(this_ptr);
47363         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47365         this_ptr_conv.is_owned = false;
47366         LDKChannelId ret_var = Splice_get_channel_id(&this_ptr_conv);
47367         uint64_t ret_ref = 0;
47368         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47369         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47370         return ret_ref;
47371 }
47372
47373 void  __attribute__((export_name("TS_Splice_set_channel_id"))) TS_Splice_set_channel_id(uint64_t this_ptr, uint64_t val) {
47374         LDKSplice this_ptr_conv;
47375         this_ptr_conv.inner = untag_ptr(this_ptr);
47376         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47378         this_ptr_conv.is_owned = false;
47379         LDKChannelId val_conv;
47380         val_conv.inner = untag_ptr(val);
47381         val_conv.is_owned = ptr_is_owned(val);
47382         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47383         val_conv = ChannelId_clone(&val_conv);
47384         Splice_set_channel_id(&this_ptr_conv, val_conv);
47385 }
47386
47387 int8_tArray  __attribute__((export_name("TS_Splice_get_chain_hash"))) TS_Splice_get_chain_hash(uint64_t this_ptr) {
47388         LDKSplice this_ptr_conv;
47389         this_ptr_conv.inner = untag_ptr(this_ptr);
47390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47392         this_ptr_conv.is_owned = false;
47393         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
47394         memcpy(ret_arr->elems, *Splice_get_chain_hash(&this_ptr_conv), 32);
47395         return ret_arr;
47396 }
47397
47398 void  __attribute__((export_name("TS_Splice_set_chain_hash"))) TS_Splice_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
47399         LDKSplice this_ptr_conv;
47400         this_ptr_conv.inner = untag_ptr(this_ptr);
47401         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47403         this_ptr_conv.is_owned = false;
47404         LDKThirtyTwoBytes val_ref;
47405         CHECK(val->arr_len == 32);
47406         memcpy(val_ref.data, val->elems, 32); FREE(val);
47407         Splice_set_chain_hash(&this_ptr_conv, val_ref);
47408 }
47409
47410 int64_t  __attribute__((export_name("TS_Splice_get_relative_satoshis"))) TS_Splice_get_relative_satoshis(uint64_t this_ptr) {
47411         LDKSplice this_ptr_conv;
47412         this_ptr_conv.inner = untag_ptr(this_ptr);
47413         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47415         this_ptr_conv.is_owned = false;
47416         int64_t ret_conv = Splice_get_relative_satoshis(&this_ptr_conv);
47417         return ret_conv;
47418 }
47419
47420 void  __attribute__((export_name("TS_Splice_set_relative_satoshis"))) TS_Splice_set_relative_satoshis(uint64_t this_ptr, int64_t val) {
47421         LDKSplice this_ptr_conv;
47422         this_ptr_conv.inner = untag_ptr(this_ptr);
47423         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47425         this_ptr_conv.is_owned = false;
47426         Splice_set_relative_satoshis(&this_ptr_conv, val);
47427 }
47428
47429 int32_t  __attribute__((export_name("TS_Splice_get_funding_feerate_perkw"))) TS_Splice_get_funding_feerate_perkw(uint64_t this_ptr) {
47430         LDKSplice this_ptr_conv;
47431         this_ptr_conv.inner = untag_ptr(this_ptr);
47432         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47434         this_ptr_conv.is_owned = false;
47435         int32_t ret_conv = Splice_get_funding_feerate_perkw(&this_ptr_conv);
47436         return ret_conv;
47437 }
47438
47439 void  __attribute__((export_name("TS_Splice_set_funding_feerate_perkw"))) TS_Splice_set_funding_feerate_perkw(uint64_t this_ptr, int32_t val) {
47440         LDKSplice this_ptr_conv;
47441         this_ptr_conv.inner = untag_ptr(this_ptr);
47442         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47444         this_ptr_conv.is_owned = false;
47445         Splice_set_funding_feerate_perkw(&this_ptr_conv, val);
47446 }
47447
47448 int32_t  __attribute__((export_name("TS_Splice_get_locktime"))) TS_Splice_get_locktime(uint64_t this_ptr) {
47449         LDKSplice this_ptr_conv;
47450         this_ptr_conv.inner = untag_ptr(this_ptr);
47451         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47453         this_ptr_conv.is_owned = false;
47454         int32_t ret_conv = Splice_get_locktime(&this_ptr_conv);
47455         return ret_conv;
47456 }
47457
47458 void  __attribute__((export_name("TS_Splice_set_locktime"))) TS_Splice_set_locktime(uint64_t this_ptr, int32_t val) {
47459         LDKSplice this_ptr_conv;
47460         this_ptr_conv.inner = untag_ptr(this_ptr);
47461         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47463         this_ptr_conv.is_owned = false;
47464         Splice_set_locktime(&this_ptr_conv, val);
47465 }
47466
47467 int8_tArray  __attribute__((export_name("TS_Splice_get_funding_pubkey"))) TS_Splice_get_funding_pubkey(uint64_t this_ptr) {
47468         LDKSplice this_ptr_conv;
47469         this_ptr_conv.inner = untag_ptr(this_ptr);
47470         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47472         this_ptr_conv.is_owned = false;
47473         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47474         memcpy(ret_arr->elems, Splice_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
47475         return ret_arr;
47476 }
47477
47478 void  __attribute__((export_name("TS_Splice_set_funding_pubkey"))) TS_Splice_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
47479         LDKSplice this_ptr_conv;
47480         this_ptr_conv.inner = untag_ptr(this_ptr);
47481         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47483         this_ptr_conv.is_owned = false;
47484         LDKPublicKey val_ref;
47485         CHECK(val->arr_len == 33);
47486         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47487         Splice_set_funding_pubkey(&this_ptr_conv, val_ref);
47488 }
47489
47490 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) {
47491         LDKChannelId channel_id_arg_conv;
47492         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
47493         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
47494         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
47495         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
47496         LDKThirtyTwoBytes chain_hash_arg_ref;
47497         CHECK(chain_hash_arg->arr_len == 32);
47498         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
47499         LDKPublicKey funding_pubkey_arg_ref;
47500         CHECK(funding_pubkey_arg->arr_len == 33);
47501         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
47502         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);
47503         uint64_t ret_ref = 0;
47504         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47505         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47506         return ret_ref;
47507 }
47508
47509 static inline uint64_t Splice_clone_ptr(LDKSplice *NONNULL_PTR arg) {
47510         LDKSplice ret_var = Splice_clone(arg);
47511         uint64_t ret_ref = 0;
47512         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47513         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47514         return ret_ref;
47515 }
47516 int64_t  __attribute__((export_name("TS_Splice_clone_ptr"))) TS_Splice_clone_ptr(uint64_t arg) {
47517         LDKSplice arg_conv;
47518         arg_conv.inner = untag_ptr(arg);
47519         arg_conv.is_owned = ptr_is_owned(arg);
47520         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47521         arg_conv.is_owned = false;
47522         int64_t ret_conv = Splice_clone_ptr(&arg_conv);
47523         return ret_conv;
47524 }
47525
47526 uint64_t  __attribute__((export_name("TS_Splice_clone"))) TS_Splice_clone(uint64_t orig) {
47527         LDKSplice orig_conv;
47528         orig_conv.inner = untag_ptr(orig);
47529         orig_conv.is_owned = ptr_is_owned(orig);
47530         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47531         orig_conv.is_owned = false;
47532         LDKSplice ret_var = Splice_clone(&orig_conv);
47533         uint64_t ret_ref = 0;
47534         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47535         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47536         return ret_ref;
47537 }
47538
47539 jboolean  __attribute__((export_name("TS_Splice_eq"))) TS_Splice_eq(uint64_t a, uint64_t b) {
47540         LDKSplice a_conv;
47541         a_conv.inner = untag_ptr(a);
47542         a_conv.is_owned = ptr_is_owned(a);
47543         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47544         a_conv.is_owned = false;
47545         LDKSplice b_conv;
47546         b_conv.inner = untag_ptr(b);
47547         b_conv.is_owned = ptr_is_owned(b);
47548         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47549         b_conv.is_owned = false;
47550         jboolean ret_conv = Splice_eq(&a_conv, &b_conv);
47551         return ret_conv;
47552 }
47553
47554 void  __attribute__((export_name("TS_SpliceAck_free"))) TS_SpliceAck_free(uint64_t this_obj) {
47555         LDKSpliceAck this_obj_conv;
47556         this_obj_conv.inner = untag_ptr(this_obj);
47557         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47559         SpliceAck_free(this_obj_conv);
47560 }
47561
47562 uint64_t  __attribute__((export_name("TS_SpliceAck_get_channel_id"))) TS_SpliceAck_get_channel_id(uint64_t this_ptr) {
47563         LDKSpliceAck this_ptr_conv;
47564         this_ptr_conv.inner = untag_ptr(this_ptr);
47565         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47567         this_ptr_conv.is_owned = false;
47568         LDKChannelId ret_var = SpliceAck_get_channel_id(&this_ptr_conv);
47569         uint64_t ret_ref = 0;
47570         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47571         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47572         return ret_ref;
47573 }
47574
47575 void  __attribute__((export_name("TS_SpliceAck_set_channel_id"))) TS_SpliceAck_set_channel_id(uint64_t this_ptr, uint64_t val) {
47576         LDKSpliceAck this_ptr_conv;
47577         this_ptr_conv.inner = untag_ptr(this_ptr);
47578         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47580         this_ptr_conv.is_owned = false;
47581         LDKChannelId val_conv;
47582         val_conv.inner = untag_ptr(val);
47583         val_conv.is_owned = ptr_is_owned(val);
47584         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47585         val_conv = ChannelId_clone(&val_conv);
47586         SpliceAck_set_channel_id(&this_ptr_conv, val_conv);
47587 }
47588
47589 int8_tArray  __attribute__((export_name("TS_SpliceAck_get_chain_hash"))) TS_SpliceAck_get_chain_hash(uint64_t this_ptr) {
47590         LDKSpliceAck this_ptr_conv;
47591         this_ptr_conv.inner = untag_ptr(this_ptr);
47592         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47594         this_ptr_conv.is_owned = false;
47595         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
47596         memcpy(ret_arr->elems, *SpliceAck_get_chain_hash(&this_ptr_conv), 32);
47597         return ret_arr;
47598 }
47599
47600 void  __attribute__((export_name("TS_SpliceAck_set_chain_hash"))) TS_SpliceAck_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
47601         LDKSpliceAck this_ptr_conv;
47602         this_ptr_conv.inner = untag_ptr(this_ptr);
47603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47605         this_ptr_conv.is_owned = false;
47606         LDKThirtyTwoBytes val_ref;
47607         CHECK(val->arr_len == 32);
47608         memcpy(val_ref.data, val->elems, 32); FREE(val);
47609         SpliceAck_set_chain_hash(&this_ptr_conv, val_ref);
47610 }
47611
47612 int64_t  __attribute__((export_name("TS_SpliceAck_get_relative_satoshis"))) TS_SpliceAck_get_relative_satoshis(uint64_t this_ptr) {
47613         LDKSpliceAck this_ptr_conv;
47614         this_ptr_conv.inner = untag_ptr(this_ptr);
47615         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47617         this_ptr_conv.is_owned = false;
47618         int64_t ret_conv = SpliceAck_get_relative_satoshis(&this_ptr_conv);
47619         return ret_conv;
47620 }
47621
47622 void  __attribute__((export_name("TS_SpliceAck_set_relative_satoshis"))) TS_SpliceAck_set_relative_satoshis(uint64_t this_ptr, int64_t val) {
47623         LDKSpliceAck 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         SpliceAck_set_relative_satoshis(&this_ptr_conv, val);
47629 }
47630
47631 int8_tArray  __attribute__((export_name("TS_SpliceAck_get_funding_pubkey"))) TS_SpliceAck_get_funding_pubkey(uint64_t this_ptr) {
47632         LDKSpliceAck this_ptr_conv;
47633         this_ptr_conv.inner = untag_ptr(this_ptr);
47634         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47636         this_ptr_conv.is_owned = false;
47637         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47638         memcpy(ret_arr->elems, SpliceAck_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
47639         return ret_arr;
47640 }
47641
47642 void  __attribute__((export_name("TS_SpliceAck_set_funding_pubkey"))) TS_SpliceAck_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
47643         LDKSpliceAck this_ptr_conv;
47644         this_ptr_conv.inner = untag_ptr(this_ptr);
47645         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47647         this_ptr_conv.is_owned = false;
47648         LDKPublicKey val_ref;
47649         CHECK(val->arr_len == 33);
47650         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47651         SpliceAck_set_funding_pubkey(&this_ptr_conv, val_ref);
47652 }
47653
47654 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) {
47655         LDKChannelId channel_id_arg_conv;
47656         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
47657         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
47658         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
47659         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
47660         LDKThirtyTwoBytes chain_hash_arg_ref;
47661         CHECK(chain_hash_arg->arr_len == 32);
47662         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
47663         LDKPublicKey funding_pubkey_arg_ref;
47664         CHECK(funding_pubkey_arg->arr_len == 33);
47665         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
47666         LDKSpliceAck ret_var = SpliceAck_new(channel_id_arg_conv, chain_hash_arg_ref, relative_satoshis_arg, funding_pubkey_arg_ref);
47667         uint64_t ret_ref = 0;
47668         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47669         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47670         return ret_ref;
47671 }
47672
47673 static inline uint64_t SpliceAck_clone_ptr(LDKSpliceAck *NONNULL_PTR arg) {
47674         LDKSpliceAck ret_var = SpliceAck_clone(arg);
47675         uint64_t ret_ref = 0;
47676         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47677         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47678         return ret_ref;
47679 }
47680 int64_t  __attribute__((export_name("TS_SpliceAck_clone_ptr"))) TS_SpliceAck_clone_ptr(uint64_t arg) {
47681         LDKSpliceAck arg_conv;
47682         arg_conv.inner = untag_ptr(arg);
47683         arg_conv.is_owned = ptr_is_owned(arg);
47684         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47685         arg_conv.is_owned = false;
47686         int64_t ret_conv = SpliceAck_clone_ptr(&arg_conv);
47687         return ret_conv;
47688 }
47689
47690 uint64_t  __attribute__((export_name("TS_SpliceAck_clone"))) TS_SpliceAck_clone(uint64_t orig) {
47691         LDKSpliceAck orig_conv;
47692         orig_conv.inner = untag_ptr(orig);
47693         orig_conv.is_owned = ptr_is_owned(orig);
47694         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47695         orig_conv.is_owned = false;
47696         LDKSpliceAck ret_var = SpliceAck_clone(&orig_conv);
47697         uint64_t ret_ref = 0;
47698         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47699         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47700         return ret_ref;
47701 }
47702
47703 jboolean  __attribute__((export_name("TS_SpliceAck_eq"))) TS_SpliceAck_eq(uint64_t a, uint64_t b) {
47704         LDKSpliceAck a_conv;
47705         a_conv.inner = untag_ptr(a);
47706         a_conv.is_owned = ptr_is_owned(a);
47707         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47708         a_conv.is_owned = false;
47709         LDKSpliceAck b_conv;
47710         b_conv.inner = untag_ptr(b);
47711         b_conv.is_owned = ptr_is_owned(b);
47712         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47713         b_conv.is_owned = false;
47714         jboolean ret_conv = SpliceAck_eq(&a_conv, &b_conv);
47715         return ret_conv;
47716 }
47717
47718 void  __attribute__((export_name("TS_SpliceLocked_free"))) TS_SpliceLocked_free(uint64_t this_obj) {
47719         LDKSpliceLocked this_obj_conv;
47720         this_obj_conv.inner = untag_ptr(this_obj);
47721         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47723         SpliceLocked_free(this_obj_conv);
47724 }
47725
47726 uint64_t  __attribute__((export_name("TS_SpliceLocked_get_channel_id"))) TS_SpliceLocked_get_channel_id(uint64_t this_ptr) {
47727         LDKSpliceLocked this_ptr_conv;
47728         this_ptr_conv.inner = untag_ptr(this_ptr);
47729         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47731         this_ptr_conv.is_owned = false;
47732         LDKChannelId ret_var = SpliceLocked_get_channel_id(&this_ptr_conv);
47733         uint64_t ret_ref = 0;
47734         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47735         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47736         return ret_ref;
47737 }
47738
47739 void  __attribute__((export_name("TS_SpliceLocked_set_channel_id"))) TS_SpliceLocked_set_channel_id(uint64_t this_ptr, uint64_t val) {
47740         LDKSpliceLocked this_ptr_conv;
47741         this_ptr_conv.inner = untag_ptr(this_ptr);
47742         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47744         this_ptr_conv.is_owned = false;
47745         LDKChannelId val_conv;
47746         val_conv.inner = untag_ptr(val);
47747         val_conv.is_owned = ptr_is_owned(val);
47748         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47749         val_conv = ChannelId_clone(&val_conv);
47750         SpliceLocked_set_channel_id(&this_ptr_conv, val_conv);
47751 }
47752
47753 uint64_t  __attribute__((export_name("TS_SpliceLocked_new"))) TS_SpliceLocked_new(uint64_t channel_id_arg) {
47754         LDKChannelId channel_id_arg_conv;
47755         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
47756         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
47757         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
47758         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
47759         LDKSpliceLocked ret_var = SpliceLocked_new(channel_id_arg_conv);
47760         uint64_t ret_ref = 0;
47761         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47762         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47763         return ret_ref;
47764 }
47765
47766 static inline uint64_t SpliceLocked_clone_ptr(LDKSpliceLocked *NONNULL_PTR arg) {
47767         LDKSpliceLocked ret_var = SpliceLocked_clone(arg);
47768         uint64_t ret_ref = 0;
47769         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47770         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47771         return ret_ref;
47772 }
47773 int64_t  __attribute__((export_name("TS_SpliceLocked_clone_ptr"))) TS_SpliceLocked_clone_ptr(uint64_t arg) {
47774         LDKSpliceLocked arg_conv;
47775         arg_conv.inner = untag_ptr(arg);
47776         arg_conv.is_owned = ptr_is_owned(arg);
47777         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47778         arg_conv.is_owned = false;
47779         int64_t ret_conv = SpliceLocked_clone_ptr(&arg_conv);
47780         return ret_conv;
47781 }
47782
47783 uint64_t  __attribute__((export_name("TS_SpliceLocked_clone"))) TS_SpliceLocked_clone(uint64_t orig) {
47784         LDKSpliceLocked orig_conv;
47785         orig_conv.inner = untag_ptr(orig);
47786         orig_conv.is_owned = ptr_is_owned(orig);
47787         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47788         orig_conv.is_owned = false;
47789         LDKSpliceLocked ret_var = SpliceLocked_clone(&orig_conv);
47790         uint64_t ret_ref = 0;
47791         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47792         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47793         return ret_ref;
47794 }
47795
47796 jboolean  __attribute__((export_name("TS_SpliceLocked_eq"))) TS_SpliceLocked_eq(uint64_t a, uint64_t b) {
47797         LDKSpliceLocked a_conv;
47798         a_conv.inner = untag_ptr(a);
47799         a_conv.is_owned = ptr_is_owned(a);
47800         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47801         a_conv.is_owned = false;
47802         LDKSpliceLocked b_conv;
47803         b_conv.inner = untag_ptr(b);
47804         b_conv.is_owned = ptr_is_owned(b);
47805         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47806         b_conv.is_owned = false;
47807         jboolean ret_conv = SpliceLocked_eq(&a_conv, &b_conv);
47808         return ret_conv;
47809 }
47810
47811 void  __attribute__((export_name("TS_TxAddInput_free"))) TS_TxAddInput_free(uint64_t this_obj) {
47812         LDKTxAddInput this_obj_conv;
47813         this_obj_conv.inner = untag_ptr(this_obj);
47814         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47816         TxAddInput_free(this_obj_conv);
47817 }
47818
47819 uint64_t  __attribute__((export_name("TS_TxAddInput_get_channel_id"))) TS_TxAddInput_get_channel_id(uint64_t this_ptr) {
47820         LDKTxAddInput this_ptr_conv;
47821         this_ptr_conv.inner = untag_ptr(this_ptr);
47822         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47824         this_ptr_conv.is_owned = false;
47825         LDKChannelId ret_var = TxAddInput_get_channel_id(&this_ptr_conv);
47826         uint64_t ret_ref = 0;
47827         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47828         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47829         return ret_ref;
47830 }
47831
47832 void  __attribute__((export_name("TS_TxAddInput_set_channel_id"))) TS_TxAddInput_set_channel_id(uint64_t this_ptr, uint64_t val) {
47833         LDKTxAddInput this_ptr_conv;
47834         this_ptr_conv.inner = untag_ptr(this_ptr);
47835         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47837         this_ptr_conv.is_owned = false;
47838         LDKChannelId val_conv;
47839         val_conv.inner = untag_ptr(val);
47840         val_conv.is_owned = ptr_is_owned(val);
47841         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47842         val_conv = ChannelId_clone(&val_conv);
47843         TxAddInput_set_channel_id(&this_ptr_conv, val_conv);
47844 }
47845
47846 int64_t  __attribute__((export_name("TS_TxAddInput_get_serial_id"))) TS_TxAddInput_get_serial_id(uint64_t this_ptr) {
47847         LDKTxAddInput this_ptr_conv;
47848         this_ptr_conv.inner = untag_ptr(this_ptr);
47849         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47851         this_ptr_conv.is_owned = false;
47852         int64_t ret_conv = TxAddInput_get_serial_id(&this_ptr_conv);
47853         return ret_conv;
47854 }
47855
47856 void  __attribute__((export_name("TS_TxAddInput_set_serial_id"))) TS_TxAddInput_set_serial_id(uint64_t this_ptr, int64_t val) {
47857         LDKTxAddInput this_ptr_conv;
47858         this_ptr_conv.inner = untag_ptr(this_ptr);
47859         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47861         this_ptr_conv.is_owned = false;
47862         TxAddInput_set_serial_id(&this_ptr_conv, val);
47863 }
47864
47865 uint64_t  __attribute__((export_name("TS_TxAddInput_get_prevtx"))) TS_TxAddInput_get_prevtx(uint64_t this_ptr) {
47866         LDKTxAddInput this_ptr_conv;
47867         this_ptr_conv.inner = untag_ptr(this_ptr);
47868         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47870         this_ptr_conv.is_owned = false;
47871         LDKTransactionU16LenLimited ret_var = TxAddInput_get_prevtx(&this_ptr_conv);
47872         uint64_t ret_ref = 0;
47873         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47874         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47875         return ret_ref;
47876 }
47877
47878 void  __attribute__((export_name("TS_TxAddInput_set_prevtx"))) TS_TxAddInput_set_prevtx(uint64_t this_ptr, uint64_t val) {
47879         LDKTxAddInput this_ptr_conv;
47880         this_ptr_conv.inner = untag_ptr(this_ptr);
47881         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47883         this_ptr_conv.is_owned = false;
47884         LDKTransactionU16LenLimited val_conv;
47885         val_conv.inner = untag_ptr(val);
47886         val_conv.is_owned = ptr_is_owned(val);
47887         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47888         val_conv = TransactionU16LenLimited_clone(&val_conv);
47889         TxAddInput_set_prevtx(&this_ptr_conv, val_conv);
47890 }
47891
47892 int32_t  __attribute__((export_name("TS_TxAddInput_get_prevtx_out"))) TS_TxAddInput_get_prevtx_out(uint64_t this_ptr) {
47893         LDKTxAddInput this_ptr_conv;
47894         this_ptr_conv.inner = untag_ptr(this_ptr);
47895         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47897         this_ptr_conv.is_owned = false;
47898         int32_t ret_conv = TxAddInput_get_prevtx_out(&this_ptr_conv);
47899         return ret_conv;
47900 }
47901
47902 void  __attribute__((export_name("TS_TxAddInput_set_prevtx_out"))) TS_TxAddInput_set_prevtx_out(uint64_t this_ptr, int32_t val) {
47903         LDKTxAddInput this_ptr_conv;
47904         this_ptr_conv.inner = untag_ptr(this_ptr);
47905         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47907         this_ptr_conv.is_owned = false;
47908         TxAddInput_set_prevtx_out(&this_ptr_conv, val);
47909 }
47910
47911 int32_t  __attribute__((export_name("TS_TxAddInput_get_sequence"))) TS_TxAddInput_get_sequence(uint64_t this_ptr) {
47912         LDKTxAddInput this_ptr_conv;
47913         this_ptr_conv.inner = untag_ptr(this_ptr);
47914         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47916         this_ptr_conv.is_owned = false;
47917         int32_t ret_conv = TxAddInput_get_sequence(&this_ptr_conv);
47918         return ret_conv;
47919 }
47920
47921 void  __attribute__((export_name("TS_TxAddInput_set_sequence"))) TS_TxAddInput_set_sequence(uint64_t this_ptr, int32_t val) {
47922         LDKTxAddInput this_ptr_conv;
47923         this_ptr_conv.inner = untag_ptr(this_ptr);
47924         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47926         this_ptr_conv.is_owned = false;
47927         TxAddInput_set_sequence(&this_ptr_conv, val);
47928 }
47929
47930 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) {
47931         LDKChannelId channel_id_arg_conv;
47932         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
47933         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
47934         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
47935         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
47936         LDKTransactionU16LenLimited prevtx_arg_conv;
47937         prevtx_arg_conv.inner = untag_ptr(prevtx_arg);
47938         prevtx_arg_conv.is_owned = ptr_is_owned(prevtx_arg);
47939         CHECK_INNER_FIELD_ACCESS_OR_NULL(prevtx_arg_conv);
47940         prevtx_arg_conv = TransactionU16LenLimited_clone(&prevtx_arg_conv);
47941         LDKTxAddInput ret_var = TxAddInput_new(channel_id_arg_conv, serial_id_arg, prevtx_arg_conv, prevtx_out_arg, sequence_arg);
47942         uint64_t ret_ref = 0;
47943         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47944         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47945         return ret_ref;
47946 }
47947
47948 static inline uint64_t TxAddInput_clone_ptr(LDKTxAddInput *NONNULL_PTR arg) {
47949         LDKTxAddInput ret_var = TxAddInput_clone(arg);
47950         uint64_t ret_ref = 0;
47951         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47952         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47953         return ret_ref;
47954 }
47955 int64_t  __attribute__((export_name("TS_TxAddInput_clone_ptr"))) TS_TxAddInput_clone_ptr(uint64_t arg) {
47956         LDKTxAddInput arg_conv;
47957         arg_conv.inner = untag_ptr(arg);
47958         arg_conv.is_owned = ptr_is_owned(arg);
47959         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47960         arg_conv.is_owned = false;
47961         int64_t ret_conv = TxAddInput_clone_ptr(&arg_conv);
47962         return ret_conv;
47963 }
47964
47965 uint64_t  __attribute__((export_name("TS_TxAddInput_clone"))) TS_TxAddInput_clone(uint64_t orig) {
47966         LDKTxAddInput orig_conv;
47967         orig_conv.inner = untag_ptr(orig);
47968         orig_conv.is_owned = ptr_is_owned(orig);
47969         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47970         orig_conv.is_owned = false;
47971         LDKTxAddInput ret_var = TxAddInput_clone(&orig_conv);
47972         uint64_t ret_ref = 0;
47973         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47974         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47975         return ret_ref;
47976 }
47977
47978 int64_t  __attribute__((export_name("TS_TxAddInput_hash"))) TS_TxAddInput_hash(uint64_t o) {
47979         LDKTxAddInput o_conv;
47980         o_conv.inner = untag_ptr(o);
47981         o_conv.is_owned = ptr_is_owned(o);
47982         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47983         o_conv.is_owned = false;
47984         int64_t ret_conv = TxAddInput_hash(&o_conv);
47985         return ret_conv;
47986 }
47987
47988 jboolean  __attribute__((export_name("TS_TxAddInput_eq"))) TS_TxAddInput_eq(uint64_t a, uint64_t b) {
47989         LDKTxAddInput a_conv;
47990         a_conv.inner = untag_ptr(a);
47991         a_conv.is_owned = ptr_is_owned(a);
47992         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47993         a_conv.is_owned = false;
47994         LDKTxAddInput b_conv;
47995         b_conv.inner = untag_ptr(b);
47996         b_conv.is_owned = ptr_is_owned(b);
47997         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47998         b_conv.is_owned = false;
47999         jboolean ret_conv = TxAddInput_eq(&a_conv, &b_conv);
48000         return ret_conv;
48001 }
48002
48003 void  __attribute__((export_name("TS_TxAddOutput_free"))) TS_TxAddOutput_free(uint64_t this_obj) {
48004         LDKTxAddOutput this_obj_conv;
48005         this_obj_conv.inner = untag_ptr(this_obj);
48006         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48008         TxAddOutput_free(this_obj_conv);
48009 }
48010
48011 uint64_t  __attribute__((export_name("TS_TxAddOutput_get_channel_id"))) TS_TxAddOutput_get_channel_id(uint64_t this_ptr) {
48012         LDKTxAddOutput this_ptr_conv;
48013         this_ptr_conv.inner = untag_ptr(this_ptr);
48014         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48016         this_ptr_conv.is_owned = false;
48017         LDKChannelId ret_var = TxAddOutput_get_channel_id(&this_ptr_conv);
48018         uint64_t ret_ref = 0;
48019         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48020         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48021         return ret_ref;
48022 }
48023
48024 void  __attribute__((export_name("TS_TxAddOutput_set_channel_id"))) TS_TxAddOutput_set_channel_id(uint64_t this_ptr, uint64_t val) {
48025         LDKTxAddOutput this_ptr_conv;
48026         this_ptr_conv.inner = untag_ptr(this_ptr);
48027         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48029         this_ptr_conv.is_owned = false;
48030         LDKChannelId val_conv;
48031         val_conv.inner = untag_ptr(val);
48032         val_conv.is_owned = ptr_is_owned(val);
48033         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48034         val_conv = ChannelId_clone(&val_conv);
48035         TxAddOutput_set_channel_id(&this_ptr_conv, val_conv);
48036 }
48037
48038 int64_t  __attribute__((export_name("TS_TxAddOutput_get_serial_id"))) TS_TxAddOutput_get_serial_id(uint64_t this_ptr) {
48039         LDKTxAddOutput this_ptr_conv;
48040         this_ptr_conv.inner = untag_ptr(this_ptr);
48041         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48043         this_ptr_conv.is_owned = false;
48044         int64_t ret_conv = TxAddOutput_get_serial_id(&this_ptr_conv);
48045         return ret_conv;
48046 }
48047
48048 void  __attribute__((export_name("TS_TxAddOutput_set_serial_id"))) TS_TxAddOutput_set_serial_id(uint64_t this_ptr, int64_t val) {
48049         LDKTxAddOutput this_ptr_conv;
48050         this_ptr_conv.inner = untag_ptr(this_ptr);
48051         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48053         this_ptr_conv.is_owned = false;
48054         TxAddOutput_set_serial_id(&this_ptr_conv, val);
48055 }
48056
48057 int64_t  __attribute__((export_name("TS_TxAddOutput_get_sats"))) TS_TxAddOutput_get_sats(uint64_t this_ptr) {
48058         LDKTxAddOutput this_ptr_conv;
48059         this_ptr_conv.inner = untag_ptr(this_ptr);
48060         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48062         this_ptr_conv.is_owned = false;
48063         int64_t ret_conv = TxAddOutput_get_sats(&this_ptr_conv);
48064         return ret_conv;
48065 }
48066
48067 void  __attribute__((export_name("TS_TxAddOutput_set_sats"))) TS_TxAddOutput_set_sats(uint64_t this_ptr, int64_t val) {
48068         LDKTxAddOutput this_ptr_conv;
48069         this_ptr_conv.inner = untag_ptr(this_ptr);
48070         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48072         this_ptr_conv.is_owned = false;
48073         TxAddOutput_set_sats(&this_ptr_conv, val);
48074 }
48075
48076 int8_tArray  __attribute__((export_name("TS_TxAddOutput_get_script"))) TS_TxAddOutput_get_script(uint64_t this_ptr) {
48077         LDKTxAddOutput this_ptr_conv;
48078         this_ptr_conv.inner = untag_ptr(this_ptr);
48079         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48081         this_ptr_conv.is_owned = false;
48082         LDKCVec_u8Z ret_var = TxAddOutput_get_script(&this_ptr_conv);
48083         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48084         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48085         CVec_u8Z_free(ret_var);
48086         return ret_arr;
48087 }
48088
48089 void  __attribute__((export_name("TS_TxAddOutput_set_script"))) TS_TxAddOutput_set_script(uint64_t this_ptr, int8_tArray val) {
48090         LDKTxAddOutput this_ptr_conv;
48091         this_ptr_conv.inner = untag_ptr(this_ptr);
48092         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48094         this_ptr_conv.is_owned = false;
48095         LDKCVec_u8Z val_ref;
48096         val_ref.datalen = val->arr_len;
48097         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
48098         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
48099         TxAddOutput_set_script(&this_ptr_conv, val_ref);
48100 }
48101
48102 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) {
48103         LDKChannelId channel_id_arg_conv;
48104         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
48105         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
48106         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
48107         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
48108         LDKCVec_u8Z script_arg_ref;
48109         script_arg_ref.datalen = script_arg->arr_len;
48110         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
48111         memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen); FREE(script_arg);
48112         LDKTxAddOutput ret_var = TxAddOutput_new(channel_id_arg_conv, serial_id_arg, sats_arg, script_arg_ref);
48113         uint64_t ret_ref = 0;
48114         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48115         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48116         return ret_ref;
48117 }
48118
48119 static inline uint64_t TxAddOutput_clone_ptr(LDKTxAddOutput *NONNULL_PTR arg) {
48120         LDKTxAddOutput ret_var = TxAddOutput_clone(arg);
48121         uint64_t ret_ref = 0;
48122         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48123         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48124         return ret_ref;
48125 }
48126 int64_t  __attribute__((export_name("TS_TxAddOutput_clone_ptr"))) TS_TxAddOutput_clone_ptr(uint64_t arg) {
48127         LDKTxAddOutput arg_conv;
48128         arg_conv.inner = untag_ptr(arg);
48129         arg_conv.is_owned = ptr_is_owned(arg);
48130         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48131         arg_conv.is_owned = false;
48132         int64_t ret_conv = TxAddOutput_clone_ptr(&arg_conv);
48133         return ret_conv;
48134 }
48135
48136 uint64_t  __attribute__((export_name("TS_TxAddOutput_clone"))) TS_TxAddOutput_clone(uint64_t orig) {
48137         LDKTxAddOutput orig_conv;
48138         orig_conv.inner = untag_ptr(orig);
48139         orig_conv.is_owned = ptr_is_owned(orig);
48140         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48141         orig_conv.is_owned = false;
48142         LDKTxAddOutput ret_var = TxAddOutput_clone(&orig_conv);
48143         uint64_t ret_ref = 0;
48144         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48145         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48146         return ret_ref;
48147 }
48148
48149 int64_t  __attribute__((export_name("TS_TxAddOutput_hash"))) TS_TxAddOutput_hash(uint64_t o) {
48150         LDKTxAddOutput o_conv;
48151         o_conv.inner = untag_ptr(o);
48152         o_conv.is_owned = ptr_is_owned(o);
48153         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48154         o_conv.is_owned = false;
48155         int64_t ret_conv = TxAddOutput_hash(&o_conv);
48156         return ret_conv;
48157 }
48158
48159 jboolean  __attribute__((export_name("TS_TxAddOutput_eq"))) TS_TxAddOutput_eq(uint64_t a, uint64_t b) {
48160         LDKTxAddOutput a_conv;
48161         a_conv.inner = untag_ptr(a);
48162         a_conv.is_owned = ptr_is_owned(a);
48163         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48164         a_conv.is_owned = false;
48165         LDKTxAddOutput b_conv;
48166         b_conv.inner = untag_ptr(b);
48167         b_conv.is_owned = ptr_is_owned(b);
48168         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48169         b_conv.is_owned = false;
48170         jboolean ret_conv = TxAddOutput_eq(&a_conv, &b_conv);
48171         return ret_conv;
48172 }
48173
48174 void  __attribute__((export_name("TS_TxRemoveInput_free"))) TS_TxRemoveInput_free(uint64_t this_obj) {
48175         LDKTxRemoveInput this_obj_conv;
48176         this_obj_conv.inner = untag_ptr(this_obj);
48177         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48179         TxRemoveInput_free(this_obj_conv);
48180 }
48181
48182 uint64_t  __attribute__((export_name("TS_TxRemoveInput_get_channel_id"))) TS_TxRemoveInput_get_channel_id(uint64_t this_ptr) {
48183         LDKTxRemoveInput this_ptr_conv;
48184         this_ptr_conv.inner = untag_ptr(this_ptr);
48185         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48187         this_ptr_conv.is_owned = false;
48188         LDKChannelId ret_var = TxRemoveInput_get_channel_id(&this_ptr_conv);
48189         uint64_t ret_ref = 0;
48190         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48191         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48192         return ret_ref;
48193 }
48194
48195 void  __attribute__((export_name("TS_TxRemoveInput_set_channel_id"))) TS_TxRemoveInput_set_channel_id(uint64_t this_ptr, uint64_t val) {
48196         LDKTxRemoveInput this_ptr_conv;
48197         this_ptr_conv.inner = untag_ptr(this_ptr);
48198         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48200         this_ptr_conv.is_owned = false;
48201         LDKChannelId val_conv;
48202         val_conv.inner = untag_ptr(val);
48203         val_conv.is_owned = ptr_is_owned(val);
48204         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48205         val_conv = ChannelId_clone(&val_conv);
48206         TxRemoveInput_set_channel_id(&this_ptr_conv, val_conv);
48207 }
48208
48209 int64_t  __attribute__((export_name("TS_TxRemoveInput_get_serial_id"))) TS_TxRemoveInput_get_serial_id(uint64_t this_ptr) {
48210         LDKTxRemoveInput this_ptr_conv;
48211         this_ptr_conv.inner = untag_ptr(this_ptr);
48212         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48214         this_ptr_conv.is_owned = false;
48215         int64_t ret_conv = TxRemoveInput_get_serial_id(&this_ptr_conv);
48216         return ret_conv;
48217 }
48218
48219 void  __attribute__((export_name("TS_TxRemoveInput_set_serial_id"))) TS_TxRemoveInput_set_serial_id(uint64_t this_ptr, int64_t val) {
48220         LDKTxRemoveInput this_ptr_conv;
48221         this_ptr_conv.inner = untag_ptr(this_ptr);
48222         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48224         this_ptr_conv.is_owned = false;
48225         TxRemoveInput_set_serial_id(&this_ptr_conv, val);
48226 }
48227
48228 uint64_t  __attribute__((export_name("TS_TxRemoveInput_new"))) TS_TxRemoveInput_new(uint64_t channel_id_arg, int64_t serial_id_arg) {
48229         LDKChannelId channel_id_arg_conv;
48230         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
48231         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
48232         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
48233         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
48234         LDKTxRemoveInput ret_var = TxRemoveInput_new(channel_id_arg_conv, serial_id_arg);
48235         uint64_t ret_ref = 0;
48236         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48237         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48238         return ret_ref;
48239 }
48240
48241 static inline uint64_t TxRemoveInput_clone_ptr(LDKTxRemoveInput *NONNULL_PTR arg) {
48242         LDKTxRemoveInput ret_var = TxRemoveInput_clone(arg);
48243         uint64_t ret_ref = 0;
48244         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48245         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48246         return ret_ref;
48247 }
48248 int64_t  __attribute__((export_name("TS_TxRemoveInput_clone_ptr"))) TS_TxRemoveInput_clone_ptr(uint64_t arg) {
48249         LDKTxRemoveInput arg_conv;
48250         arg_conv.inner = untag_ptr(arg);
48251         arg_conv.is_owned = ptr_is_owned(arg);
48252         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48253         arg_conv.is_owned = false;
48254         int64_t ret_conv = TxRemoveInput_clone_ptr(&arg_conv);
48255         return ret_conv;
48256 }
48257
48258 uint64_t  __attribute__((export_name("TS_TxRemoveInput_clone"))) TS_TxRemoveInput_clone(uint64_t orig) {
48259         LDKTxRemoveInput orig_conv;
48260         orig_conv.inner = untag_ptr(orig);
48261         orig_conv.is_owned = ptr_is_owned(orig);
48262         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48263         orig_conv.is_owned = false;
48264         LDKTxRemoveInput ret_var = TxRemoveInput_clone(&orig_conv);
48265         uint64_t ret_ref = 0;
48266         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48267         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48268         return ret_ref;
48269 }
48270
48271 int64_t  __attribute__((export_name("TS_TxRemoveInput_hash"))) TS_TxRemoveInput_hash(uint64_t o) {
48272         LDKTxRemoveInput o_conv;
48273         o_conv.inner = untag_ptr(o);
48274         o_conv.is_owned = ptr_is_owned(o);
48275         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48276         o_conv.is_owned = false;
48277         int64_t ret_conv = TxRemoveInput_hash(&o_conv);
48278         return ret_conv;
48279 }
48280
48281 jboolean  __attribute__((export_name("TS_TxRemoveInput_eq"))) TS_TxRemoveInput_eq(uint64_t a, uint64_t b) {
48282         LDKTxRemoveInput a_conv;
48283         a_conv.inner = untag_ptr(a);
48284         a_conv.is_owned = ptr_is_owned(a);
48285         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48286         a_conv.is_owned = false;
48287         LDKTxRemoveInput b_conv;
48288         b_conv.inner = untag_ptr(b);
48289         b_conv.is_owned = ptr_is_owned(b);
48290         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48291         b_conv.is_owned = false;
48292         jboolean ret_conv = TxRemoveInput_eq(&a_conv, &b_conv);
48293         return ret_conv;
48294 }
48295
48296 void  __attribute__((export_name("TS_TxRemoveOutput_free"))) TS_TxRemoveOutput_free(uint64_t this_obj) {
48297         LDKTxRemoveOutput this_obj_conv;
48298         this_obj_conv.inner = untag_ptr(this_obj);
48299         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48301         TxRemoveOutput_free(this_obj_conv);
48302 }
48303
48304 uint64_t  __attribute__((export_name("TS_TxRemoveOutput_get_channel_id"))) TS_TxRemoveOutput_get_channel_id(uint64_t this_ptr) {
48305         LDKTxRemoveOutput 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         LDKChannelId ret_var = TxRemoveOutput_get_channel_id(&this_ptr_conv);
48311         uint64_t ret_ref = 0;
48312         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48313         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48314         return ret_ref;
48315 }
48316
48317 void  __attribute__((export_name("TS_TxRemoveOutput_set_channel_id"))) TS_TxRemoveOutput_set_channel_id(uint64_t this_ptr, uint64_t val) {
48318         LDKTxRemoveOutput this_ptr_conv;
48319         this_ptr_conv.inner = untag_ptr(this_ptr);
48320         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48322         this_ptr_conv.is_owned = false;
48323         LDKChannelId val_conv;
48324         val_conv.inner = untag_ptr(val);
48325         val_conv.is_owned = ptr_is_owned(val);
48326         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48327         val_conv = ChannelId_clone(&val_conv);
48328         TxRemoveOutput_set_channel_id(&this_ptr_conv, val_conv);
48329 }
48330
48331 int64_t  __attribute__((export_name("TS_TxRemoveOutput_get_serial_id"))) TS_TxRemoveOutput_get_serial_id(uint64_t this_ptr) {
48332         LDKTxRemoveOutput this_ptr_conv;
48333         this_ptr_conv.inner = untag_ptr(this_ptr);
48334         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48336         this_ptr_conv.is_owned = false;
48337         int64_t ret_conv = TxRemoveOutput_get_serial_id(&this_ptr_conv);
48338         return ret_conv;
48339 }
48340
48341 void  __attribute__((export_name("TS_TxRemoveOutput_set_serial_id"))) TS_TxRemoveOutput_set_serial_id(uint64_t this_ptr, int64_t val) {
48342         LDKTxRemoveOutput this_ptr_conv;
48343         this_ptr_conv.inner = untag_ptr(this_ptr);
48344         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48346         this_ptr_conv.is_owned = false;
48347         TxRemoveOutput_set_serial_id(&this_ptr_conv, val);
48348 }
48349
48350 uint64_t  __attribute__((export_name("TS_TxRemoveOutput_new"))) TS_TxRemoveOutput_new(uint64_t channel_id_arg, int64_t serial_id_arg) {
48351         LDKChannelId channel_id_arg_conv;
48352         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
48353         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
48354         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
48355         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
48356         LDKTxRemoveOutput ret_var = TxRemoveOutput_new(channel_id_arg_conv, serial_id_arg);
48357         uint64_t ret_ref = 0;
48358         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48359         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48360         return ret_ref;
48361 }
48362
48363 static inline uint64_t TxRemoveOutput_clone_ptr(LDKTxRemoveOutput *NONNULL_PTR arg) {
48364         LDKTxRemoveOutput ret_var = TxRemoveOutput_clone(arg);
48365         uint64_t ret_ref = 0;
48366         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48367         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48368         return ret_ref;
48369 }
48370 int64_t  __attribute__((export_name("TS_TxRemoveOutput_clone_ptr"))) TS_TxRemoveOutput_clone_ptr(uint64_t arg) {
48371         LDKTxRemoveOutput arg_conv;
48372         arg_conv.inner = untag_ptr(arg);
48373         arg_conv.is_owned = ptr_is_owned(arg);
48374         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48375         arg_conv.is_owned = false;
48376         int64_t ret_conv = TxRemoveOutput_clone_ptr(&arg_conv);
48377         return ret_conv;
48378 }
48379
48380 uint64_t  __attribute__((export_name("TS_TxRemoveOutput_clone"))) TS_TxRemoveOutput_clone(uint64_t orig) {
48381         LDKTxRemoveOutput orig_conv;
48382         orig_conv.inner = untag_ptr(orig);
48383         orig_conv.is_owned = ptr_is_owned(orig);
48384         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48385         orig_conv.is_owned = false;
48386         LDKTxRemoveOutput ret_var = TxRemoveOutput_clone(&orig_conv);
48387         uint64_t ret_ref = 0;
48388         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48389         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48390         return ret_ref;
48391 }
48392
48393 int64_t  __attribute__((export_name("TS_TxRemoveOutput_hash"))) TS_TxRemoveOutput_hash(uint64_t o) {
48394         LDKTxRemoveOutput o_conv;
48395         o_conv.inner = untag_ptr(o);
48396         o_conv.is_owned = ptr_is_owned(o);
48397         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48398         o_conv.is_owned = false;
48399         int64_t ret_conv = TxRemoveOutput_hash(&o_conv);
48400         return ret_conv;
48401 }
48402
48403 jboolean  __attribute__((export_name("TS_TxRemoveOutput_eq"))) TS_TxRemoveOutput_eq(uint64_t a, uint64_t b) {
48404         LDKTxRemoveOutput a_conv;
48405         a_conv.inner = untag_ptr(a);
48406         a_conv.is_owned = ptr_is_owned(a);
48407         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48408         a_conv.is_owned = false;
48409         LDKTxRemoveOutput b_conv;
48410         b_conv.inner = untag_ptr(b);
48411         b_conv.is_owned = ptr_is_owned(b);
48412         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48413         b_conv.is_owned = false;
48414         jboolean ret_conv = TxRemoveOutput_eq(&a_conv, &b_conv);
48415         return ret_conv;
48416 }
48417
48418 void  __attribute__((export_name("TS_TxComplete_free"))) TS_TxComplete_free(uint64_t this_obj) {
48419         LDKTxComplete this_obj_conv;
48420         this_obj_conv.inner = untag_ptr(this_obj);
48421         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48423         TxComplete_free(this_obj_conv);
48424 }
48425
48426 uint64_t  __attribute__((export_name("TS_TxComplete_get_channel_id"))) TS_TxComplete_get_channel_id(uint64_t this_ptr) {
48427         LDKTxComplete this_ptr_conv;
48428         this_ptr_conv.inner = untag_ptr(this_ptr);
48429         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48431         this_ptr_conv.is_owned = false;
48432         LDKChannelId ret_var = TxComplete_get_channel_id(&this_ptr_conv);
48433         uint64_t ret_ref = 0;
48434         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48435         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48436         return ret_ref;
48437 }
48438
48439 void  __attribute__((export_name("TS_TxComplete_set_channel_id"))) TS_TxComplete_set_channel_id(uint64_t this_ptr, uint64_t val) {
48440         LDKTxComplete this_ptr_conv;
48441         this_ptr_conv.inner = untag_ptr(this_ptr);
48442         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48444         this_ptr_conv.is_owned = false;
48445         LDKChannelId val_conv;
48446         val_conv.inner = untag_ptr(val);
48447         val_conv.is_owned = ptr_is_owned(val);
48448         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48449         val_conv = ChannelId_clone(&val_conv);
48450         TxComplete_set_channel_id(&this_ptr_conv, val_conv);
48451 }
48452
48453 uint64_t  __attribute__((export_name("TS_TxComplete_new"))) TS_TxComplete_new(uint64_t channel_id_arg) {
48454         LDKChannelId channel_id_arg_conv;
48455         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
48456         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
48457         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
48458         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
48459         LDKTxComplete ret_var = TxComplete_new(channel_id_arg_conv);
48460         uint64_t ret_ref = 0;
48461         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48462         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48463         return ret_ref;
48464 }
48465
48466 static inline uint64_t TxComplete_clone_ptr(LDKTxComplete *NONNULL_PTR arg) {
48467         LDKTxComplete ret_var = TxComplete_clone(arg);
48468         uint64_t ret_ref = 0;
48469         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48470         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48471         return ret_ref;
48472 }
48473 int64_t  __attribute__((export_name("TS_TxComplete_clone_ptr"))) TS_TxComplete_clone_ptr(uint64_t arg) {
48474         LDKTxComplete arg_conv;
48475         arg_conv.inner = untag_ptr(arg);
48476         arg_conv.is_owned = ptr_is_owned(arg);
48477         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48478         arg_conv.is_owned = false;
48479         int64_t ret_conv = TxComplete_clone_ptr(&arg_conv);
48480         return ret_conv;
48481 }
48482
48483 uint64_t  __attribute__((export_name("TS_TxComplete_clone"))) TS_TxComplete_clone(uint64_t orig) {
48484         LDKTxComplete orig_conv;
48485         orig_conv.inner = untag_ptr(orig);
48486         orig_conv.is_owned = ptr_is_owned(orig);
48487         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48488         orig_conv.is_owned = false;
48489         LDKTxComplete ret_var = TxComplete_clone(&orig_conv);
48490         uint64_t ret_ref = 0;
48491         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48492         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48493         return ret_ref;
48494 }
48495
48496 int64_t  __attribute__((export_name("TS_TxComplete_hash"))) TS_TxComplete_hash(uint64_t o) {
48497         LDKTxComplete o_conv;
48498         o_conv.inner = untag_ptr(o);
48499         o_conv.is_owned = ptr_is_owned(o);
48500         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48501         o_conv.is_owned = false;
48502         int64_t ret_conv = TxComplete_hash(&o_conv);
48503         return ret_conv;
48504 }
48505
48506 jboolean  __attribute__((export_name("TS_TxComplete_eq"))) TS_TxComplete_eq(uint64_t a, uint64_t b) {
48507         LDKTxComplete a_conv;
48508         a_conv.inner = untag_ptr(a);
48509         a_conv.is_owned = ptr_is_owned(a);
48510         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48511         a_conv.is_owned = false;
48512         LDKTxComplete b_conv;
48513         b_conv.inner = untag_ptr(b);
48514         b_conv.is_owned = ptr_is_owned(b);
48515         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48516         b_conv.is_owned = false;
48517         jboolean ret_conv = TxComplete_eq(&a_conv, &b_conv);
48518         return ret_conv;
48519 }
48520
48521 void  __attribute__((export_name("TS_TxSignatures_free"))) TS_TxSignatures_free(uint64_t this_obj) {
48522         LDKTxSignatures this_obj_conv;
48523         this_obj_conv.inner = untag_ptr(this_obj);
48524         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48526         TxSignatures_free(this_obj_conv);
48527 }
48528
48529 uint64_t  __attribute__((export_name("TS_TxSignatures_get_channel_id"))) TS_TxSignatures_get_channel_id(uint64_t this_ptr) {
48530         LDKTxSignatures this_ptr_conv;
48531         this_ptr_conv.inner = untag_ptr(this_ptr);
48532         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48534         this_ptr_conv.is_owned = false;
48535         LDKChannelId ret_var = TxSignatures_get_channel_id(&this_ptr_conv);
48536         uint64_t ret_ref = 0;
48537         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48538         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48539         return ret_ref;
48540 }
48541
48542 void  __attribute__((export_name("TS_TxSignatures_set_channel_id"))) TS_TxSignatures_set_channel_id(uint64_t this_ptr, uint64_t val) {
48543         LDKTxSignatures this_ptr_conv;
48544         this_ptr_conv.inner = untag_ptr(this_ptr);
48545         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48547         this_ptr_conv.is_owned = false;
48548         LDKChannelId val_conv;
48549         val_conv.inner = untag_ptr(val);
48550         val_conv.is_owned = ptr_is_owned(val);
48551         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48552         val_conv = ChannelId_clone(&val_conv);
48553         TxSignatures_set_channel_id(&this_ptr_conv, val_conv);
48554 }
48555
48556 int8_tArray  __attribute__((export_name("TS_TxSignatures_get_tx_hash"))) TS_TxSignatures_get_tx_hash(uint64_t this_ptr) {
48557         LDKTxSignatures this_ptr_conv;
48558         this_ptr_conv.inner = untag_ptr(this_ptr);
48559         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48561         this_ptr_conv.is_owned = false;
48562         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
48563         memcpy(ret_arr->elems, *TxSignatures_get_tx_hash(&this_ptr_conv), 32);
48564         return ret_arr;
48565 }
48566
48567 void  __attribute__((export_name("TS_TxSignatures_set_tx_hash"))) TS_TxSignatures_set_tx_hash(uint64_t this_ptr, int8_tArray val) {
48568         LDKTxSignatures this_ptr_conv;
48569         this_ptr_conv.inner = untag_ptr(this_ptr);
48570         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48572         this_ptr_conv.is_owned = false;
48573         LDKThirtyTwoBytes val_ref;
48574         CHECK(val->arr_len == 32);
48575         memcpy(val_ref.data, val->elems, 32); FREE(val);
48576         TxSignatures_set_tx_hash(&this_ptr_conv, val_ref);
48577 }
48578
48579 ptrArray  __attribute__((export_name("TS_TxSignatures_get_witnesses"))) TS_TxSignatures_get_witnesses(uint64_t this_ptr) {
48580         LDKTxSignatures this_ptr_conv;
48581         this_ptr_conv.inner = untag_ptr(this_ptr);
48582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48584         this_ptr_conv.is_owned = false;
48585         LDKCVec_WitnessZ ret_var = TxSignatures_get_witnesses(&this_ptr_conv);
48586         ptrArray ret_arr = NULL;
48587         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
48588         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
48589         for (size_t m = 0; m < ret_var.datalen; m++) {
48590                 LDKWitness ret_conv_12_var = ret_var.data[m];
48591                 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
48592                 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
48593                 Witness_free(ret_conv_12_var);
48594                 ret_arr_ptr[m] = ret_conv_12_arr;
48595         }
48596         
48597         FREE(ret_var.data);
48598         return ret_arr;
48599 }
48600
48601 void  __attribute__((export_name("TS_TxSignatures_set_witnesses"))) TS_TxSignatures_set_witnesses(uint64_t this_ptr, ptrArray val) {
48602         LDKTxSignatures 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         LDKCVec_WitnessZ val_constr;
48608         val_constr.datalen = val->arr_len;
48609         if (val_constr.datalen > 0)
48610                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
48611         else
48612                 val_constr.data = NULL;
48613         int8_tArray* val_vals = (void*) val->elems;
48614         for (size_t m = 0; m < val_constr.datalen; m++) {
48615                 int8_tArray val_conv_12 = val_vals[m];
48616                 LDKWitness val_conv_12_ref;
48617                 val_conv_12_ref.datalen = val_conv_12->arr_len;
48618                 val_conv_12_ref.data = MALLOC(val_conv_12_ref.datalen, "LDKWitness Bytes");
48619                 memcpy(val_conv_12_ref.data, val_conv_12->elems, val_conv_12_ref.datalen); FREE(val_conv_12);
48620                 val_conv_12_ref.data_is_owned = true;
48621                 val_constr.data[m] = val_conv_12_ref;
48622         }
48623         FREE(val);
48624         TxSignatures_set_witnesses(&this_ptr_conv, val_constr);
48625 }
48626
48627 uint64_t  __attribute__((export_name("TS_TxSignatures_get_funding_outpoint_sig"))) TS_TxSignatures_get_funding_outpoint_sig(uint64_t this_ptr) {
48628         LDKTxSignatures this_ptr_conv;
48629         this_ptr_conv.inner = untag_ptr(this_ptr);
48630         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48632         this_ptr_conv.is_owned = false;
48633         LDKCOption_ECDSASignatureZ *ret_copy = MALLOC(sizeof(LDKCOption_ECDSASignatureZ), "LDKCOption_ECDSASignatureZ");
48634         *ret_copy = TxSignatures_get_funding_outpoint_sig(&this_ptr_conv);
48635         uint64_t ret_ref = tag_ptr(ret_copy, true);
48636         return ret_ref;
48637 }
48638
48639 void  __attribute__((export_name("TS_TxSignatures_set_funding_outpoint_sig"))) TS_TxSignatures_set_funding_outpoint_sig(uint64_t this_ptr, uint64_t val) {
48640         LDKTxSignatures this_ptr_conv;
48641         this_ptr_conv.inner = untag_ptr(this_ptr);
48642         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48644         this_ptr_conv.is_owned = false;
48645         void* val_ptr = untag_ptr(val);
48646         CHECK_ACCESS(val_ptr);
48647         LDKCOption_ECDSASignatureZ val_conv = *(LDKCOption_ECDSASignatureZ*)(val_ptr);
48648         val_conv = COption_ECDSASignatureZ_clone((LDKCOption_ECDSASignatureZ*)untag_ptr(val));
48649         TxSignatures_set_funding_outpoint_sig(&this_ptr_conv, val_conv);
48650 }
48651
48652 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) {
48653         LDKChannelId channel_id_arg_conv;
48654         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
48655         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
48656         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
48657         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
48658         LDKThirtyTwoBytes tx_hash_arg_ref;
48659         CHECK(tx_hash_arg->arr_len == 32);
48660         memcpy(tx_hash_arg_ref.data, tx_hash_arg->elems, 32); FREE(tx_hash_arg);
48661         LDKCVec_WitnessZ witnesses_arg_constr;
48662         witnesses_arg_constr.datalen = witnesses_arg->arr_len;
48663         if (witnesses_arg_constr.datalen > 0)
48664                 witnesses_arg_constr.data = MALLOC(witnesses_arg_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
48665         else
48666                 witnesses_arg_constr.data = NULL;
48667         int8_tArray* witnesses_arg_vals = (void*) witnesses_arg->elems;
48668         for (size_t m = 0; m < witnesses_arg_constr.datalen; m++) {
48669                 int8_tArray witnesses_arg_conv_12 = witnesses_arg_vals[m];
48670                 LDKWitness witnesses_arg_conv_12_ref;
48671                 witnesses_arg_conv_12_ref.datalen = witnesses_arg_conv_12->arr_len;
48672                 witnesses_arg_conv_12_ref.data = MALLOC(witnesses_arg_conv_12_ref.datalen, "LDKWitness Bytes");
48673                 memcpy(witnesses_arg_conv_12_ref.data, witnesses_arg_conv_12->elems, witnesses_arg_conv_12_ref.datalen); FREE(witnesses_arg_conv_12);
48674                 witnesses_arg_conv_12_ref.data_is_owned = true;
48675                 witnesses_arg_constr.data[m] = witnesses_arg_conv_12_ref;
48676         }
48677         FREE(witnesses_arg);
48678         void* funding_outpoint_sig_arg_ptr = untag_ptr(funding_outpoint_sig_arg);
48679         CHECK_ACCESS(funding_outpoint_sig_arg_ptr);
48680         LDKCOption_ECDSASignatureZ funding_outpoint_sig_arg_conv = *(LDKCOption_ECDSASignatureZ*)(funding_outpoint_sig_arg_ptr);
48681         funding_outpoint_sig_arg_conv = COption_ECDSASignatureZ_clone((LDKCOption_ECDSASignatureZ*)untag_ptr(funding_outpoint_sig_arg));
48682         LDKTxSignatures ret_var = TxSignatures_new(channel_id_arg_conv, tx_hash_arg_ref, witnesses_arg_constr, funding_outpoint_sig_arg_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 static inline uint64_t TxSignatures_clone_ptr(LDKTxSignatures *NONNULL_PTR arg) {
48690         LDKTxSignatures ret_var = TxSignatures_clone(arg);
48691         uint64_t ret_ref = 0;
48692         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48693         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48694         return ret_ref;
48695 }
48696 int64_t  __attribute__((export_name("TS_TxSignatures_clone_ptr"))) TS_TxSignatures_clone_ptr(uint64_t arg) {
48697         LDKTxSignatures arg_conv;
48698         arg_conv.inner = untag_ptr(arg);
48699         arg_conv.is_owned = ptr_is_owned(arg);
48700         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48701         arg_conv.is_owned = false;
48702         int64_t ret_conv = TxSignatures_clone_ptr(&arg_conv);
48703         return ret_conv;
48704 }
48705
48706 uint64_t  __attribute__((export_name("TS_TxSignatures_clone"))) TS_TxSignatures_clone(uint64_t orig) {
48707         LDKTxSignatures orig_conv;
48708         orig_conv.inner = untag_ptr(orig);
48709         orig_conv.is_owned = ptr_is_owned(orig);
48710         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48711         orig_conv.is_owned = false;
48712         LDKTxSignatures ret_var = TxSignatures_clone(&orig_conv);
48713         uint64_t ret_ref = 0;
48714         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48715         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48716         return ret_ref;
48717 }
48718
48719 int64_t  __attribute__((export_name("TS_TxSignatures_hash"))) TS_TxSignatures_hash(uint64_t o) {
48720         LDKTxSignatures o_conv;
48721         o_conv.inner = untag_ptr(o);
48722         o_conv.is_owned = ptr_is_owned(o);
48723         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48724         o_conv.is_owned = false;
48725         int64_t ret_conv = TxSignatures_hash(&o_conv);
48726         return ret_conv;
48727 }
48728
48729 jboolean  __attribute__((export_name("TS_TxSignatures_eq"))) TS_TxSignatures_eq(uint64_t a, uint64_t b) {
48730         LDKTxSignatures a_conv;
48731         a_conv.inner = untag_ptr(a);
48732         a_conv.is_owned = ptr_is_owned(a);
48733         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48734         a_conv.is_owned = false;
48735         LDKTxSignatures b_conv;
48736         b_conv.inner = untag_ptr(b);
48737         b_conv.is_owned = ptr_is_owned(b);
48738         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48739         b_conv.is_owned = false;
48740         jboolean ret_conv = TxSignatures_eq(&a_conv, &b_conv);
48741         return ret_conv;
48742 }
48743
48744 void  __attribute__((export_name("TS_TxInitRbf_free"))) TS_TxInitRbf_free(uint64_t this_obj) {
48745         LDKTxInitRbf this_obj_conv;
48746         this_obj_conv.inner = untag_ptr(this_obj);
48747         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48749         TxInitRbf_free(this_obj_conv);
48750 }
48751
48752 uint64_t  __attribute__((export_name("TS_TxInitRbf_get_channel_id"))) TS_TxInitRbf_get_channel_id(uint64_t this_ptr) {
48753         LDKTxInitRbf this_ptr_conv;
48754         this_ptr_conv.inner = untag_ptr(this_ptr);
48755         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48757         this_ptr_conv.is_owned = false;
48758         LDKChannelId ret_var = TxInitRbf_get_channel_id(&this_ptr_conv);
48759         uint64_t ret_ref = 0;
48760         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48761         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48762         return ret_ref;
48763 }
48764
48765 void  __attribute__((export_name("TS_TxInitRbf_set_channel_id"))) TS_TxInitRbf_set_channel_id(uint64_t this_ptr, uint64_t val) {
48766         LDKTxInitRbf this_ptr_conv;
48767         this_ptr_conv.inner = untag_ptr(this_ptr);
48768         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48770         this_ptr_conv.is_owned = false;
48771         LDKChannelId val_conv;
48772         val_conv.inner = untag_ptr(val);
48773         val_conv.is_owned = ptr_is_owned(val);
48774         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48775         val_conv = ChannelId_clone(&val_conv);
48776         TxInitRbf_set_channel_id(&this_ptr_conv, val_conv);
48777 }
48778
48779 int32_t  __attribute__((export_name("TS_TxInitRbf_get_locktime"))) TS_TxInitRbf_get_locktime(uint64_t this_ptr) {
48780         LDKTxInitRbf this_ptr_conv;
48781         this_ptr_conv.inner = untag_ptr(this_ptr);
48782         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48784         this_ptr_conv.is_owned = false;
48785         int32_t ret_conv = TxInitRbf_get_locktime(&this_ptr_conv);
48786         return ret_conv;
48787 }
48788
48789 void  __attribute__((export_name("TS_TxInitRbf_set_locktime"))) TS_TxInitRbf_set_locktime(uint64_t this_ptr, int32_t val) {
48790         LDKTxInitRbf this_ptr_conv;
48791         this_ptr_conv.inner = untag_ptr(this_ptr);
48792         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48794         this_ptr_conv.is_owned = false;
48795         TxInitRbf_set_locktime(&this_ptr_conv, val);
48796 }
48797
48798 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) {
48799         LDKTxInitRbf this_ptr_conv;
48800         this_ptr_conv.inner = untag_ptr(this_ptr);
48801         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48803         this_ptr_conv.is_owned = false;
48804         int32_t ret_conv = TxInitRbf_get_feerate_sat_per_1000_weight(&this_ptr_conv);
48805         return ret_conv;
48806 }
48807
48808 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) {
48809         LDKTxInitRbf this_ptr_conv;
48810         this_ptr_conv.inner = untag_ptr(this_ptr);
48811         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48813         this_ptr_conv.is_owned = false;
48814         TxInitRbf_set_feerate_sat_per_1000_weight(&this_ptr_conv, val);
48815 }
48816
48817 uint64_t  __attribute__((export_name("TS_TxInitRbf_get_funding_output_contribution"))) TS_TxInitRbf_get_funding_output_contribution(uint64_t this_ptr) {
48818         LDKTxInitRbf this_ptr_conv;
48819         this_ptr_conv.inner = untag_ptr(this_ptr);
48820         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48822         this_ptr_conv.is_owned = false;
48823         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
48824         *ret_copy = TxInitRbf_get_funding_output_contribution(&this_ptr_conv);
48825         uint64_t ret_ref = tag_ptr(ret_copy, true);
48826         return ret_ref;
48827 }
48828
48829 void  __attribute__((export_name("TS_TxInitRbf_set_funding_output_contribution"))) TS_TxInitRbf_set_funding_output_contribution(uint64_t this_ptr, uint64_t val) {
48830         LDKTxInitRbf this_ptr_conv;
48831         this_ptr_conv.inner = untag_ptr(this_ptr);
48832         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48834         this_ptr_conv.is_owned = false;
48835         void* val_ptr = untag_ptr(val);
48836         CHECK_ACCESS(val_ptr);
48837         LDKCOption_i64Z val_conv = *(LDKCOption_i64Z*)(val_ptr);
48838         val_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(val));
48839         TxInitRbf_set_funding_output_contribution(&this_ptr_conv, val_conv);
48840 }
48841
48842 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) {
48843         LDKChannelId channel_id_arg_conv;
48844         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
48845         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
48846         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
48847         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
48848         void* funding_output_contribution_arg_ptr = untag_ptr(funding_output_contribution_arg);
48849         CHECK_ACCESS(funding_output_contribution_arg_ptr);
48850         LDKCOption_i64Z funding_output_contribution_arg_conv = *(LDKCOption_i64Z*)(funding_output_contribution_arg_ptr);
48851         funding_output_contribution_arg_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(funding_output_contribution_arg));
48852         LDKTxInitRbf ret_var = TxInitRbf_new(channel_id_arg_conv, locktime_arg, feerate_sat_per_1000_weight_arg, funding_output_contribution_arg_conv);
48853         uint64_t ret_ref = 0;
48854         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48855         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48856         return ret_ref;
48857 }
48858
48859 static inline uint64_t TxInitRbf_clone_ptr(LDKTxInitRbf *NONNULL_PTR arg) {
48860         LDKTxInitRbf ret_var = TxInitRbf_clone(arg);
48861         uint64_t ret_ref = 0;
48862         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48863         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48864         return ret_ref;
48865 }
48866 int64_t  __attribute__((export_name("TS_TxInitRbf_clone_ptr"))) TS_TxInitRbf_clone_ptr(uint64_t arg) {
48867         LDKTxInitRbf arg_conv;
48868         arg_conv.inner = untag_ptr(arg);
48869         arg_conv.is_owned = ptr_is_owned(arg);
48870         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48871         arg_conv.is_owned = false;
48872         int64_t ret_conv = TxInitRbf_clone_ptr(&arg_conv);
48873         return ret_conv;
48874 }
48875
48876 uint64_t  __attribute__((export_name("TS_TxInitRbf_clone"))) TS_TxInitRbf_clone(uint64_t orig) {
48877         LDKTxInitRbf orig_conv;
48878         orig_conv.inner = untag_ptr(orig);
48879         orig_conv.is_owned = ptr_is_owned(orig);
48880         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48881         orig_conv.is_owned = false;
48882         LDKTxInitRbf ret_var = TxInitRbf_clone(&orig_conv);
48883         uint64_t ret_ref = 0;
48884         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48885         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48886         return ret_ref;
48887 }
48888
48889 int64_t  __attribute__((export_name("TS_TxInitRbf_hash"))) TS_TxInitRbf_hash(uint64_t o) {
48890         LDKTxInitRbf o_conv;
48891         o_conv.inner = untag_ptr(o);
48892         o_conv.is_owned = ptr_is_owned(o);
48893         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48894         o_conv.is_owned = false;
48895         int64_t ret_conv = TxInitRbf_hash(&o_conv);
48896         return ret_conv;
48897 }
48898
48899 jboolean  __attribute__((export_name("TS_TxInitRbf_eq"))) TS_TxInitRbf_eq(uint64_t a, uint64_t b) {
48900         LDKTxInitRbf a_conv;
48901         a_conv.inner = untag_ptr(a);
48902         a_conv.is_owned = ptr_is_owned(a);
48903         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48904         a_conv.is_owned = false;
48905         LDKTxInitRbf b_conv;
48906         b_conv.inner = untag_ptr(b);
48907         b_conv.is_owned = ptr_is_owned(b);
48908         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48909         b_conv.is_owned = false;
48910         jboolean ret_conv = TxInitRbf_eq(&a_conv, &b_conv);
48911         return ret_conv;
48912 }
48913
48914 void  __attribute__((export_name("TS_TxAckRbf_free"))) TS_TxAckRbf_free(uint64_t this_obj) {
48915         LDKTxAckRbf this_obj_conv;
48916         this_obj_conv.inner = untag_ptr(this_obj);
48917         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48919         TxAckRbf_free(this_obj_conv);
48920 }
48921
48922 uint64_t  __attribute__((export_name("TS_TxAckRbf_get_channel_id"))) TS_TxAckRbf_get_channel_id(uint64_t this_ptr) {
48923         LDKTxAckRbf this_ptr_conv;
48924         this_ptr_conv.inner = untag_ptr(this_ptr);
48925         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48927         this_ptr_conv.is_owned = false;
48928         LDKChannelId ret_var = TxAckRbf_get_channel_id(&this_ptr_conv);
48929         uint64_t ret_ref = 0;
48930         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48931         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48932         return ret_ref;
48933 }
48934
48935 void  __attribute__((export_name("TS_TxAckRbf_set_channel_id"))) TS_TxAckRbf_set_channel_id(uint64_t this_ptr, uint64_t val) {
48936         LDKTxAckRbf this_ptr_conv;
48937         this_ptr_conv.inner = untag_ptr(this_ptr);
48938         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48940         this_ptr_conv.is_owned = false;
48941         LDKChannelId val_conv;
48942         val_conv.inner = untag_ptr(val);
48943         val_conv.is_owned = ptr_is_owned(val);
48944         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48945         val_conv = ChannelId_clone(&val_conv);
48946         TxAckRbf_set_channel_id(&this_ptr_conv, val_conv);
48947 }
48948
48949 uint64_t  __attribute__((export_name("TS_TxAckRbf_get_funding_output_contribution"))) TS_TxAckRbf_get_funding_output_contribution(uint64_t this_ptr) {
48950         LDKTxAckRbf this_ptr_conv;
48951         this_ptr_conv.inner = untag_ptr(this_ptr);
48952         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48954         this_ptr_conv.is_owned = false;
48955         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
48956         *ret_copy = TxAckRbf_get_funding_output_contribution(&this_ptr_conv);
48957         uint64_t ret_ref = tag_ptr(ret_copy, true);
48958         return ret_ref;
48959 }
48960
48961 void  __attribute__((export_name("TS_TxAckRbf_set_funding_output_contribution"))) TS_TxAckRbf_set_funding_output_contribution(uint64_t this_ptr, uint64_t val) {
48962         LDKTxAckRbf this_ptr_conv;
48963         this_ptr_conv.inner = untag_ptr(this_ptr);
48964         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48966         this_ptr_conv.is_owned = false;
48967         void* val_ptr = untag_ptr(val);
48968         CHECK_ACCESS(val_ptr);
48969         LDKCOption_i64Z val_conv = *(LDKCOption_i64Z*)(val_ptr);
48970         val_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(val));
48971         TxAckRbf_set_funding_output_contribution(&this_ptr_conv, val_conv);
48972 }
48973
48974 uint64_t  __attribute__((export_name("TS_TxAckRbf_new"))) TS_TxAckRbf_new(uint64_t channel_id_arg, uint64_t funding_output_contribution_arg) {
48975         LDKChannelId channel_id_arg_conv;
48976         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
48977         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
48978         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
48979         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
48980         void* funding_output_contribution_arg_ptr = untag_ptr(funding_output_contribution_arg);
48981         CHECK_ACCESS(funding_output_contribution_arg_ptr);
48982         LDKCOption_i64Z funding_output_contribution_arg_conv = *(LDKCOption_i64Z*)(funding_output_contribution_arg_ptr);
48983         funding_output_contribution_arg_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(funding_output_contribution_arg));
48984         LDKTxAckRbf ret_var = TxAckRbf_new(channel_id_arg_conv, funding_output_contribution_arg_conv);
48985         uint64_t ret_ref = 0;
48986         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48987         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48988         return ret_ref;
48989 }
48990
48991 static inline uint64_t TxAckRbf_clone_ptr(LDKTxAckRbf *NONNULL_PTR arg) {
48992         LDKTxAckRbf ret_var = TxAckRbf_clone(arg);
48993         uint64_t ret_ref = 0;
48994         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48995         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48996         return ret_ref;
48997 }
48998 int64_t  __attribute__((export_name("TS_TxAckRbf_clone_ptr"))) TS_TxAckRbf_clone_ptr(uint64_t arg) {
48999         LDKTxAckRbf arg_conv;
49000         arg_conv.inner = untag_ptr(arg);
49001         arg_conv.is_owned = ptr_is_owned(arg);
49002         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49003         arg_conv.is_owned = false;
49004         int64_t ret_conv = TxAckRbf_clone_ptr(&arg_conv);
49005         return ret_conv;
49006 }
49007
49008 uint64_t  __attribute__((export_name("TS_TxAckRbf_clone"))) TS_TxAckRbf_clone(uint64_t orig) {
49009         LDKTxAckRbf orig_conv;
49010         orig_conv.inner = untag_ptr(orig);
49011         orig_conv.is_owned = ptr_is_owned(orig);
49012         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49013         orig_conv.is_owned = false;
49014         LDKTxAckRbf ret_var = TxAckRbf_clone(&orig_conv);
49015         uint64_t ret_ref = 0;
49016         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49017         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49018         return ret_ref;
49019 }
49020
49021 int64_t  __attribute__((export_name("TS_TxAckRbf_hash"))) TS_TxAckRbf_hash(uint64_t o) {
49022         LDKTxAckRbf o_conv;
49023         o_conv.inner = untag_ptr(o);
49024         o_conv.is_owned = ptr_is_owned(o);
49025         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49026         o_conv.is_owned = false;
49027         int64_t ret_conv = TxAckRbf_hash(&o_conv);
49028         return ret_conv;
49029 }
49030
49031 jboolean  __attribute__((export_name("TS_TxAckRbf_eq"))) TS_TxAckRbf_eq(uint64_t a, uint64_t b) {
49032         LDKTxAckRbf a_conv;
49033         a_conv.inner = untag_ptr(a);
49034         a_conv.is_owned = ptr_is_owned(a);
49035         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49036         a_conv.is_owned = false;
49037         LDKTxAckRbf b_conv;
49038         b_conv.inner = untag_ptr(b);
49039         b_conv.is_owned = ptr_is_owned(b);
49040         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49041         b_conv.is_owned = false;
49042         jboolean ret_conv = TxAckRbf_eq(&a_conv, &b_conv);
49043         return ret_conv;
49044 }
49045
49046 void  __attribute__((export_name("TS_TxAbort_free"))) TS_TxAbort_free(uint64_t this_obj) {
49047         LDKTxAbort this_obj_conv;
49048         this_obj_conv.inner = untag_ptr(this_obj);
49049         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49051         TxAbort_free(this_obj_conv);
49052 }
49053
49054 uint64_t  __attribute__((export_name("TS_TxAbort_get_channel_id"))) TS_TxAbort_get_channel_id(uint64_t this_ptr) {
49055         LDKTxAbort this_ptr_conv;
49056         this_ptr_conv.inner = untag_ptr(this_ptr);
49057         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49059         this_ptr_conv.is_owned = false;
49060         LDKChannelId ret_var = TxAbort_get_channel_id(&this_ptr_conv);
49061         uint64_t ret_ref = 0;
49062         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49063         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49064         return ret_ref;
49065 }
49066
49067 void  __attribute__((export_name("TS_TxAbort_set_channel_id"))) TS_TxAbort_set_channel_id(uint64_t this_ptr, uint64_t val) {
49068         LDKTxAbort this_ptr_conv;
49069         this_ptr_conv.inner = untag_ptr(this_ptr);
49070         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49072         this_ptr_conv.is_owned = false;
49073         LDKChannelId val_conv;
49074         val_conv.inner = untag_ptr(val);
49075         val_conv.is_owned = ptr_is_owned(val);
49076         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49077         val_conv = ChannelId_clone(&val_conv);
49078         TxAbort_set_channel_id(&this_ptr_conv, val_conv);
49079 }
49080
49081 int8_tArray  __attribute__((export_name("TS_TxAbort_get_data"))) TS_TxAbort_get_data(uint64_t this_ptr) {
49082         LDKTxAbort this_ptr_conv;
49083         this_ptr_conv.inner = untag_ptr(this_ptr);
49084         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49086         this_ptr_conv.is_owned = false;
49087         LDKCVec_u8Z ret_var = TxAbort_get_data(&this_ptr_conv);
49088         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49089         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49090         CVec_u8Z_free(ret_var);
49091         return ret_arr;
49092 }
49093
49094 void  __attribute__((export_name("TS_TxAbort_set_data"))) TS_TxAbort_set_data(uint64_t this_ptr, int8_tArray val) {
49095         LDKTxAbort this_ptr_conv;
49096         this_ptr_conv.inner = untag_ptr(this_ptr);
49097         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49099         this_ptr_conv.is_owned = false;
49100         LDKCVec_u8Z val_ref;
49101         val_ref.datalen = val->arr_len;
49102         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
49103         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
49104         TxAbort_set_data(&this_ptr_conv, val_ref);
49105 }
49106
49107 uint64_t  __attribute__((export_name("TS_TxAbort_new"))) TS_TxAbort_new(uint64_t channel_id_arg, int8_tArray data_arg) {
49108         LDKChannelId channel_id_arg_conv;
49109         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
49110         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
49111         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
49112         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
49113         LDKCVec_u8Z data_arg_ref;
49114         data_arg_ref.datalen = data_arg->arr_len;
49115         data_arg_ref.data = MALLOC(data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
49116         memcpy(data_arg_ref.data, data_arg->elems, data_arg_ref.datalen); FREE(data_arg);
49117         LDKTxAbort ret_var = TxAbort_new(channel_id_arg_conv, data_arg_ref);
49118         uint64_t ret_ref = 0;
49119         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49120         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49121         return ret_ref;
49122 }
49123
49124 static inline uint64_t TxAbort_clone_ptr(LDKTxAbort *NONNULL_PTR arg) {
49125         LDKTxAbort ret_var = TxAbort_clone(arg);
49126         uint64_t ret_ref = 0;
49127         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49128         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49129         return ret_ref;
49130 }
49131 int64_t  __attribute__((export_name("TS_TxAbort_clone_ptr"))) TS_TxAbort_clone_ptr(uint64_t arg) {
49132         LDKTxAbort arg_conv;
49133         arg_conv.inner = untag_ptr(arg);
49134         arg_conv.is_owned = ptr_is_owned(arg);
49135         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49136         arg_conv.is_owned = false;
49137         int64_t ret_conv = TxAbort_clone_ptr(&arg_conv);
49138         return ret_conv;
49139 }
49140
49141 uint64_t  __attribute__((export_name("TS_TxAbort_clone"))) TS_TxAbort_clone(uint64_t orig) {
49142         LDKTxAbort orig_conv;
49143         orig_conv.inner = untag_ptr(orig);
49144         orig_conv.is_owned = ptr_is_owned(orig);
49145         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49146         orig_conv.is_owned = false;
49147         LDKTxAbort ret_var = TxAbort_clone(&orig_conv);
49148         uint64_t ret_ref = 0;
49149         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49150         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49151         return ret_ref;
49152 }
49153
49154 int64_t  __attribute__((export_name("TS_TxAbort_hash"))) TS_TxAbort_hash(uint64_t o) {
49155         LDKTxAbort o_conv;
49156         o_conv.inner = untag_ptr(o);
49157         o_conv.is_owned = ptr_is_owned(o);
49158         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49159         o_conv.is_owned = false;
49160         int64_t ret_conv = TxAbort_hash(&o_conv);
49161         return ret_conv;
49162 }
49163
49164 jboolean  __attribute__((export_name("TS_TxAbort_eq"))) TS_TxAbort_eq(uint64_t a, uint64_t b) {
49165         LDKTxAbort a_conv;
49166         a_conv.inner = untag_ptr(a);
49167         a_conv.is_owned = ptr_is_owned(a);
49168         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49169         a_conv.is_owned = false;
49170         LDKTxAbort b_conv;
49171         b_conv.inner = untag_ptr(b);
49172         b_conv.is_owned = ptr_is_owned(b);
49173         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49174         b_conv.is_owned = false;
49175         jboolean ret_conv = TxAbort_eq(&a_conv, &b_conv);
49176         return ret_conv;
49177 }
49178
49179 void  __attribute__((export_name("TS_Shutdown_free"))) TS_Shutdown_free(uint64_t this_obj) {
49180         LDKShutdown this_obj_conv;
49181         this_obj_conv.inner = untag_ptr(this_obj);
49182         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49184         Shutdown_free(this_obj_conv);
49185 }
49186
49187 uint64_t  __attribute__((export_name("TS_Shutdown_get_channel_id"))) TS_Shutdown_get_channel_id(uint64_t this_ptr) {
49188         LDKShutdown this_ptr_conv;
49189         this_ptr_conv.inner = untag_ptr(this_ptr);
49190         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49192         this_ptr_conv.is_owned = false;
49193         LDKChannelId ret_var = Shutdown_get_channel_id(&this_ptr_conv);
49194         uint64_t ret_ref = 0;
49195         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49196         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49197         return ret_ref;
49198 }
49199
49200 void  __attribute__((export_name("TS_Shutdown_set_channel_id"))) TS_Shutdown_set_channel_id(uint64_t this_ptr, uint64_t val) {
49201         LDKShutdown this_ptr_conv;
49202         this_ptr_conv.inner = untag_ptr(this_ptr);
49203         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49205         this_ptr_conv.is_owned = false;
49206         LDKChannelId val_conv;
49207         val_conv.inner = untag_ptr(val);
49208         val_conv.is_owned = ptr_is_owned(val);
49209         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49210         val_conv = ChannelId_clone(&val_conv);
49211         Shutdown_set_channel_id(&this_ptr_conv, val_conv);
49212 }
49213
49214 int8_tArray  __attribute__((export_name("TS_Shutdown_get_scriptpubkey"))) TS_Shutdown_get_scriptpubkey(uint64_t this_ptr) {
49215         LDKShutdown this_ptr_conv;
49216         this_ptr_conv.inner = untag_ptr(this_ptr);
49217         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49219         this_ptr_conv.is_owned = false;
49220         LDKCVec_u8Z ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
49221         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49222         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49223         CVec_u8Z_free(ret_var);
49224         return ret_arr;
49225 }
49226
49227 void  __attribute__((export_name("TS_Shutdown_set_scriptpubkey"))) TS_Shutdown_set_scriptpubkey(uint64_t this_ptr, int8_tArray val) {
49228         LDKShutdown 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         LDKCVec_u8Z val_ref;
49234         val_ref.datalen = val->arr_len;
49235         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
49236         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
49237         Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
49238 }
49239
49240 uint64_t  __attribute__((export_name("TS_Shutdown_new"))) TS_Shutdown_new(uint64_t channel_id_arg, int8_tArray scriptpubkey_arg) {
49241         LDKChannelId channel_id_arg_conv;
49242         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
49243         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
49244         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
49245         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
49246         LDKCVec_u8Z scriptpubkey_arg_ref;
49247         scriptpubkey_arg_ref.datalen = scriptpubkey_arg->arr_len;
49248         scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
49249         memcpy(scriptpubkey_arg_ref.data, scriptpubkey_arg->elems, scriptpubkey_arg_ref.datalen); FREE(scriptpubkey_arg);
49250         LDKShutdown ret_var = Shutdown_new(channel_id_arg_conv, scriptpubkey_arg_ref);
49251         uint64_t ret_ref = 0;
49252         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49253         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49254         return ret_ref;
49255 }
49256
49257 static inline uint64_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
49258         LDKShutdown ret_var = Shutdown_clone(arg);
49259         uint64_t ret_ref = 0;
49260         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49261         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49262         return ret_ref;
49263 }
49264 int64_t  __attribute__((export_name("TS_Shutdown_clone_ptr"))) TS_Shutdown_clone_ptr(uint64_t arg) {
49265         LDKShutdown arg_conv;
49266         arg_conv.inner = untag_ptr(arg);
49267         arg_conv.is_owned = ptr_is_owned(arg);
49268         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49269         arg_conv.is_owned = false;
49270         int64_t ret_conv = Shutdown_clone_ptr(&arg_conv);
49271         return ret_conv;
49272 }
49273
49274 uint64_t  __attribute__((export_name("TS_Shutdown_clone"))) TS_Shutdown_clone(uint64_t orig) {
49275         LDKShutdown orig_conv;
49276         orig_conv.inner = untag_ptr(orig);
49277         orig_conv.is_owned = ptr_is_owned(orig);
49278         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49279         orig_conv.is_owned = false;
49280         LDKShutdown ret_var = Shutdown_clone(&orig_conv);
49281         uint64_t ret_ref = 0;
49282         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49283         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49284         return ret_ref;
49285 }
49286
49287 int64_t  __attribute__((export_name("TS_Shutdown_hash"))) TS_Shutdown_hash(uint64_t o) {
49288         LDKShutdown o_conv;
49289         o_conv.inner = untag_ptr(o);
49290         o_conv.is_owned = ptr_is_owned(o);
49291         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49292         o_conv.is_owned = false;
49293         int64_t ret_conv = Shutdown_hash(&o_conv);
49294         return ret_conv;
49295 }
49296
49297 jboolean  __attribute__((export_name("TS_Shutdown_eq"))) TS_Shutdown_eq(uint64_t a, uint64_t b) {
49298         LDKShutdown a_conv;
49299         a_conv.inner = untag_ptr(a);
49300         a_conv.is_owned = ptr_is_owned(a);
49301         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49302         a_conv.is_owned = false;
49303         LDKShutdown b_conv;
49304         b_conv.inner = untag_ptr(b);
49305         b_conv.is_owned = ptr_is_owned(b);
49306         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49307         b_conv.is_owned = false;
49308         jboolean ret_conv = Shutdown_eq(&a_conv, &b_conv);
49309         return ret_conv;
49310 }
49311
49312 void  __attribute__((export_name("TS_ClosingSignedFeeRange_free"))) TS_ClosingSignedFeeRange_free(uint64_t this_obj) {
49313         LDKClosingSignedFeeRange this_obj_conv;
49314         this_obj_conv.inner = untag_ptr(this_obj);
49315         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49317         ClosingSignedFeeRange_free(this_obj_conv);
49318 }
49319
49320 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_get_min_fee_satoshis"))) TS_ClosingSignedFeeRange_get_min_fee_satoshis(uint64_t this_ptr) {
49321         LDKClosingSignedFeeRange this_ptr_conv;
49322         this_ptr_conv.inner = untag_ptr(this_ptr);
49323         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49325         this_ptr_conv.is_owned = false;
49326         int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
49327         return ret_conv;
49328 }
49329
49330 void  __attribute__((export_name("TS_ClosingSignedFeeRange_set_min_fee_satoshis"))) TS_ClosingSignedFeeRange_set_min_fee_satoshis(uint64_t this_ptr, int64_t val) {
49331         LDKClosingSignedFeeRange this_ptr_conv;
49332         this_ptr_conv.inner = untag_ptr(this_ptr);
49333         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49335         this_ptr_conv.is_owned = false;
49336         ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
49337 }
49338
49339 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_get_max_fee_satoshis"))) TS_ClosingSignedFeeRange_get_max_fee_satoshis(uint64_t this_ptr) {
49340         LDKClosingSignedFeeRange this_ptr_conv;
49341         this_ptr_conv.inner = untag_ptr(this_ptr);
49342         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49344         this_ptr_conv.is_owned = false;
49345         int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
49346         return ret_conv;
49347 }
49348
49349 void  __attribute__((export_name("TS_ClosingSignedFeeRange_set_max_fee_satoshis"))) TS_ClosingSignedFeeRange_set_max_fee_satoshis(uint64_t this_ptr, int64_t val) {
49350         LDKClosingSignedFeeRange this_ptr_conv;
49351         this_ptr_conv.inner = untag_ptr(this_ptr);
49352         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49354         this_ptr_conv.is_owned = false;
49355         ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
49356 }
49357
49358 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_new"))) TS_ClosingSignedFeeRange_new(int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
49359         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
49360         uint64_t ret_ref = 0;
49361         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49362         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49363         return ret_ref;
49364 }
49365
49366 static inline uint64_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
49367         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
49368         uint64_t ret_ref = 0;
49369         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49370         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49371         return ret_ref;
49372 }
49373 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_clone_ptr"))) TS_ClosingSignedFeeRange_clone_ptr(uint64_t arg) {
49374         LDKClosingSignedFeeRange arg_conv;
49375         arg_conv.inner = untag_ptr(arg);
49376         arg_conv.is_owned = ptr_is_owned(arg);
49377         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49378         arg_conv.is_owned = false;
49379         int64_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
49380         return ret_conv;
49381 }
49382
49383 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_clone"))) TS_ClosingSignedFeeRange_clone(uint64_t orig) {
49384         LDKClosingSignedFeeRange orig_conv;
49385         orig_conv.inner = untag_ptr(orig);
49386         orig_conv.is_owned = ptr_is_owned(orig);
49387         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49388         orig_conv.is_owned = false;
49389         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
49390         uint64_t ret_ref = 0;
49391         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49392         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49393         return ret_ref;
49394 }
49395
49396 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_hash"))) TS_ClosingSignedFeeRange_hash(uint64_t o) {
49397         LDKClosingSignedFeeRange o_conv;
49398         o_conv.inner = untag_ptr(o);
49399         o_conv.is_owned = ptr_is_owned(o);
49400         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49401         o_conv.is_owned = false;
49402         int64_t ret_conv = ClosingSignedFeeRange_hash(&o_conv);
49403         return ret_conv;
49404 }
49405
49406 jboolean  __attribute__((export_name("TS_ClosingSignedFeeRange_eq"))) TS_ClosingSignedFeeRange_eq(uint64_t a, uint64_t b) {
49407         LDKClosingSignedFeeRange a_conv;
49408         a_conv.inner = untag_ptr(a);
49409         a_conv.is_owned = ptr_is_owned(a);
49410         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49411         a_conv.is_owned = false;
49412         LDKClosingSignedFeeRange b_conv;
49413         b_conv.inner = untag_ptr(b);
49414         b_conv.is_owned = ptr_is_owned(b);
49415         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49416         b_conv.is_owned = false;
49417         jboolean ret_conv = ClosingSignedFeeRange_eq(&a_conv, &b_conv);
49418         return ret_conv;
49419 }
49420
49421 void  __attribute__((export_name("TS_ClosingSigned_free"))) TS_ClosingSigned_free(uint64_t this_obj) {
49422         LDKClosingSigned this_obj_conv;
49423         this_obj_conv.inner = untag_ptr(this_obj);
49424         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49426         ClosingSigned_free(this_obj_conv);
49427 }
49428
49429 uint64_t  __attribute__((export_name("TS_ClosingSigned_get_channel_id"))) TS_ClosingSigned_get_channel_id(uint64_t this_ptr) {
49430         LDKClosingSigned this_ptr_conv;
49431         this_ptr_conv.inner = untag_ptr(this_ptr);
49432         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49434         this_ptr_conv.is_owned = false;
49435         LDKChannelId ret_var = ClosingSigned_get_channel_id(&this_ptr_conv);
49436         uint64_t ret_ref = 0;
49437         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49438         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49439         return ret_ref;
49440 }
49441
49442 void  __attribute__((export_name("TS_ClosingSigned_set_channel_id"))) TS_ClosingSigned_set_channel_id(uint64_t this_ptr, uint64_t val) {
49443         LDKClosingSigned this_ptr_conv;
49444         this_ptr_conv.inner = untag_ptr(this_ptr);
49445         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49447         this_ptr_conv.is_owned = false;
49448         LDKChannelId val_conv;
49449         val_conv.inner = untag_ptr(val);
49450         val_conv.is_owned = ptr_is_owned(val);
49451         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49452         val_conv = ChannelId_clone(&val_conv);
49453         ClosingSigned_set_channel_id(&this_ptr_conv, val_conv);
49454 }
49455
49456 int64_t  __attribute__((export_name("TS_ClosingSigned_get_fee_satoshis"))) TS_ClosingSigned_get_fee_satoshis(uint64_t this_ptr) {
49457         LDKClosingSigned this_ptr_conv;
49458         this_ptr_conv.inner = untag_ptr(this_ptr);
49459         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49461         this_ptr_conv.is_owned = false;
49462         int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
49463         return ret_conv;
49464 }
49465
49466 void  __attribute__((export_name("TS_ClosingSigned_set_fee_satoshis"))) TS_ClosingSigned_set_fee_satoshis(uint64_t this_ptr, int64_t val) {
49467         LDKClosingSigned this_ptr_conv;
49468         this_ptr_conv.inner = untag_ptr(this_ptr);
49469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49471         this_ptr_conv.is_owned = false;
49472         ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
49473 }
49474
49475 int8_tArray  __attribute__((export_name("TS_ClosingSigned_get_signature"))) TS_ClosingSigned_get_signature(uint64_t this_ptr) {
49476         LDKClosingSigned this_ptr_conv;
49477         this_ptr_conv.inner = untag_ptr(this_ptr);
49478         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49480         this_ptr_conv.is_owned = false;
49481         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
49482         memcpy(ret_arr->elems, ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
49483         return ret_arr;
49484 }
49485
49486 void  __attribute__((export_name("TS_ClosingSigned_set_signature"))) TS_ClosingSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
49487         LDKClosingSigned this_ptr_conv;
49488         this_ptr_conv.inner = untag_ptr(this_ptr);
49489         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49491         this_ptr_conv.is_owned = false;
49492         LDKECDSASignature val_ref;
49493         CHECK(val->arr_len == 64);
49494         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
49495         ClosingSigned_set_signature(&this_ptr_conv, val_ref);
49496 }
49497
49498 uint64_t  __attribute__((export_name("TS_ClosingSigned_get_fee_range"))) TS_ClosingSigned_get_fee_range(uint64_t this_ptr) {
49499         LDKClosingSigned 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         LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&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_ClosingSigned_set_fee_range"))) TS_ClosingSigned_set_fee_range(uint64_t this_ptr, uint64_t val) {
49512         LDKClosingSigned 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         LDKClosingSignedFeeRange 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 = ClosingSignedFeeRange_clone(&val_conv);
49522         ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
49523 }
49524
49525 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) {
49526         LDKChannelId channel_id_arg_conv;
49527         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
49528         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
49529         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
49530         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
49531         LDKECDSASignature signature_arg_ref;
49532         CHECK(signature_arg->arr_len == 64);
49533         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
49534         LDKClosingSignedFeeRange fee_range_arg_conv;
49535         fee_range_arg_conv.inner = untag_ptr(fee_range_arg);
49536         fee_range_arg_conv.is_owned = ptr_is_owned(fee_range_arg);
49537         CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
49538         fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
49539         LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_conv, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
49540         uint64_t ret_ref = 0;
49541         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49542         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49543         return ret_ref;
49544 }
49545
49546 static inline uint64_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
49547         LDKClosingSigned ret_var = ClosingSigned_clone(arg);
49548         uint64_t ret_ref = 0;
49549         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49550         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49551         return ret_ref;
49552 }
49553 int64_t  __attribute__((export_name("TS_ClosingSigned_clone_ptr"))) TS_ClosingSigned_clone_ptr(uint64_t arg) {
49554         LDKClosingSigned arg_conv;
49555         arg_conv.inner = untag_ptr(arg);
49556         arg_conv.is_owned = ptr_is_owned(arg);
49557         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49558         arg_conv.is_owned = false;
49559         int64_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
49560         return ret_conv;
49561 }
49562
49563 uint64_t  __attribute__((export_name("TS_ClosingSigned_clone"))) TS_ClosingSigned_clone(uint64_t orig) {
49564         LDKClosingSigned orig_conv;
49565         orig_conv.inner = untag_ptr(orig);
49566         orig_conv.is_owned = ptr_is_owned(orig);
49567         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49568         orig_conv.is_owned = false;
49569         LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
49570         uint64_t ret_ref = 0;
49571         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49572         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49573         return ret_ref;
49574 }
49575
49576 int64_t  __attribute__((export_name("TS_ClosingSigned_hash"))) TS_ClosingSigned_hash(uint64_t o) {
49577         LDKClosingSigned o_conv;
49578         o_conv.inner = untag_ptr(o);
49579         o_conv.is_owned = ptr_is_owned(o);
49580         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49581         o_conv.is_owned = false;
49582         int64_t ret_conv = ClosingSigned_hash(&o_conv);
49583         return ret_conv;
49584 }
49585
49586 jboolean  __attribute__((export_name("TS_ClosingSigned_eq"))) TS_ClosingSigned_eq(uint64_t a, uint64_t b) {
49587         LDKClosingSigned a_conv;
49588         a_conv.inner = untag_ptr(a);
49589         a_conv.is_owned = ptr_is_owned(a);
49590         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49591         a_conv.is_owned = false;
49592         LDKClosingSigned b_conv;
49593         b_conv.inner = untag_ptr(b);
49594         b_conv.is_owned = ptr_is_owned(b);
49595         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49596         b_conv.is_owned = false;
49597         jboolean ret_conv = ClosingSigned_eq(&a_conv, &b_conv);
49598         return ret_conv;
49599 }
49600
49601 void  __attribute__((export_name("TS_UpdateAddHTLC_free"))) TS_UpdateAddHTLC_free(uint64_t this_obj) {
49602         LDKUpdateAddHTLC this_obj_conv;
49603         this_obj_conv.inner = untag_ptr(this_obj);
49604         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49606         UpdateAddHTLC_free(this_obj_conv);
49607 }
49608
49609 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_channel_id"))) TS_UpdateAddHTLC_get_channel_id(uint64_t this_ptr) {
49610         LDKUpdateAddHTLC this_ptr_conv;
49611         this_ptr_conv.inner = untag_ptr(this_ptr);
49612         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49614         this_ptr_conv.is_owned = false;
49615         LDKChannelId ret_var = UpdateAddHTLC_get_channel_id(&this_ptr_conv);
49616         uint64_t ret_ref = 0;
49617         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49618         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49619         return ret_ref;
49620 }
49621
49622 void  __attribute__((export_name("TS_UpdateAddHTLC_set_channel_id"))) TS_UpdateAddHTLC_set_channel_id(uint64_t this_ptr, uint64_t val) {
49623         LDKUpdateAddHTLC this_ptr_conv;
49624         this_ptr_conv.inner = untag_ptr(this_ptr);
49625         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49627         this_ptr_conv.is_owned = false;
49628         LDKChannelId val_conv;
49629         val_conv.inner = untag_ptr(val);
49630         val_conv.is_owned = ptr_is_owned(val);
49631         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49632         val_conv = ChannelId_clone(&val_conv);
49633         UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_conv);
49634 }
49635
49636 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_htlc_id"))) TS_UpdateAddHTLC_get_htlc_id(uint64_t this_ptr) {
49637         LDKUpdateAddHTLC this_ptr_conv;
49638         this_ptr_conv.inner = untag_ptr(this_ptr);
49639         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49641         this_ptr_conv.is_owned = false;
49642         int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
49643         return ret_conv;
49644 }
49645
49646 void  __attribute__((export_name("TS_UpdateAddHTLC_set_htlc_id"))) TS_UpdateAddHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
49647         LDKUpdateAddHTLC this_ptr_conv;
49648         this_ptr_conv.inner = untag_ptr(this_ptr);
49649         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49651         this_ptr_conv.is_owned = false;
49652         UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
49653 }
49654
49655 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_amount_msat"))) TS_UpdateAddHTLC_get_amount_msat(uint64_t this_ptr) {
49656         LDKUpdateAddHTLC this_ptr_conv;
49657         this_ptr_conv.inner = untag_ptr(this_ptr);
49658         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49660         this_ptr_conv.is_owned = false;
49661         int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
49662         return ret_conv;
49663 }
49664
49665 void  __attribute__((export_name("TS_UpdateAddHTLC_set_amount_msat"))) TS_UpdateAddHTLC_set_amount_msat(uint64_t this_ptr, int64_t val) {
49666         LDKUpdateAddHTLC this_ptr_conv;
49667         this_ptr_conv.inner = untag_ptr(this_ptr);
49668         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49670         this_ptr_conv.is_owned = false;
49671         UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
49672 }
49673
49674 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_get_payment_hash"))) TS_UpdateAddHTLC_get_payment_hash(uint64_t this_ptr) {
49675         LDKUpdateAddHTLC this_ptr_conv;
49676         this_ptr_conv.inner = untag_ptr(this_ptr);
49677         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49679         this_ptr_conv.is_owned = false;
49680         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
49681         memcpy(ret_arr->elems, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
49682         return ret_arr;
49683 }
49684
49685 void  __attribute__((export_name("TS_UpdateAddHTLC_set_payment_hash"))) TS_UpdateAddHTLC_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
49686         LDKUpdateAddHTLC this_ptr_conv;
49687         this_ptr_conv.inner = untag_ptr(this_ptr);
49688         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49690         this_ptr_conv.is_owned = false;
49691         LDKThirtyTwoBytes val_ref;
49692         CHECK(val->arr_len == 32);
49693         memcpy(val_ref.data, val->elems, 32); FREE(val);
49694         UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
49695 }
49696
49697 int32_t  __attribute__((export_name("TS_UpdateAddHTLC_get_cltv_expiry"))) TS_UpdateAddHTLC_get_cltv_expiry(uint64_t this_ptr) {
49698         LDKUpdateAddHTLC this_ptr_conv;
49699         this_ptr_conv.inner = untag_ptr(this_ptr);
49700         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49702         this_ptr_conv.is_owned = false;
49703         int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
49704         return ret_conv;
49705 }
49706
49707 void  __attribute__((export_name("TS_UpdateAddHTLC_set_cltv_expiry"))) TS_UpdateAddHTLC_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
49708         LDKUpdateAddHTLC this_ptr_conv;
49709         this_ptr_conv.inner = untag_ptr(this_ptr);
49710         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49712         this_ptr_conv.is_owned = false;
49713         UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
49714 }
49715
49716 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_skimmed_fee_msat"))) TS_UpdateAddHTLC_get_skimmed_fee_msat(uint64_t this_ptr) {
49717         LDKUpdateAddHTLC this_ptr_conv;
49718         this_ptr_conv.inner = untag_ptr(this_ptr);
49719         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49721         this_ptr_conv.is_owned = false;
49722         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
49723         *ret_copy = UpdateAddHTLC_get_skimmed_fee_msat(&this_ptr_conv);
49724         uint64_t ret_ref = tag_ptr(ret_copy, true);
49725         return ret_ref;
49726 }
49727
49728 void  __attribute__((export_name("TS_UpdateAddHTLC_set_skimmed_fee_msat"))) TS_UpdateAddHTLC_set_skimmed_fee_msat(uint64_t this_ptr, uint64_t val) {
49729         LDKUpdateAddHTLC this_ptr_conv;
49730         this_ptr_conv.inner = untag_ptr(this_ptr);
49731         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49733         this_ptr_conv.is_owned = false;
49734         void* val_ptr = untag_ptr(val);
49735         CHECK_ACCESS(val_ptr);
49736         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
49737         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
49738         UpdateAddHTLC_set_skimmed_fee_msat(&this_ptr_conv, val_conv);
49739 }
49740
49741 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_onion_routing_packet"))) TS_UpdateAddHTLC_get_onion_routing_packet(uint64_t this_ptr) {
49742         LDKUpdateAddHTLC this_ptr_conv;
49743         this_ptr_conv.inner = untag_ptr(this_ptr);
49744         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49746         this_ptr_conv.is_owned = false;
49747         LDKOnionPacket ret_var = UpdateAddHTLC_get_onion_routing_packet(&this_ptr_conv);
49748         uint64_t ret_ref = 0;
49749         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49750         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49751         return ret_ref;
49752 }
49753
49754 void  __attribute__((export_name("TS_UpdateAddHTLC_set_onion_routing_packet"))) TS_UpdateAddHTLC_set_onion_routing_packet(uint64_t this_ptr, uint64_t val) {
49755         LDKUpdateAddHTLC this_ptr_conv;
49756         this_ptr_conv.inner = untag_ptr(this_ptr);
49757         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49759         this_ptr_conv.is_owned = false;
49760         LDKOnionPacket val_conv;
49761         val_conv.inner = untag_ptr(val);
49762         val_conv.is_owned = ptr_is_owned(val);
49763         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49764         val_conv = OnionPacket_clone(&val_conv);
49765         UpdateAddHTLC_set_onion_routing_packet(&this_ptr_conv, val_conv);
49766 }
49767
49768 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_get_blinding_point"))) TS_UpdateAddHTLC_get_blinding_point(uint64_t this_ptr) {
49769         LDKUpdateAddHTLC this_ptr_conv;
49770         this_ptr_conv.inner = untag_ptr(this_ptr);
49771         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49773         this_ptr_conv.is_owned = false;
49774         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
49775         memcpy(ret_arr->elems, UpdateAddHTLC_get_blinding_point(&this_ptr_conv).compressed_form, 33);
49776         return ret_arr;
49777 }
49778
49779 void  __attribute__((export_name("TS_UpdateAddHTLC_set_blinding_point"))) TS_UpdateAddHTLC_set_blinding_point(uint64_t this_ptr, int8_tArray val) {
49780         LDKUpdateAddHTLC this_ptr_conv;
49781         this_ptr_conv.inner = untag_ptr(this_ptr);
49782         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49784         this_ptr_conv.is_owned = false;
49785         LDKPublicKey val_ref;
49786         CHECK(val->arr_len == 33);
49787         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
49788         UpdateAddHTLC_set_blinding_point(&this_ptr_conv, val_ref);
49789 }
49790
49791 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) {
49792         LDKChannelId channel_id_arg_conv;
49793         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
49794         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
49795         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
49796         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
49797         LDKThirtyTwoBytes payment_hash_arg_ref;
49798         CHECK(payment_hash_arg->arr_len == 32);
49799         memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
49800         void* skimmed_fee_msat_arg_ptr = untag_ptr(skimmed_fee_msat_arg);
49801         CHECK_ACCESS(skimmed_fee_msat_arg_ptr);
49802         LDKCOption_u64Z skimmed_fee_msat_arg_conv = *(LDKCOption_u64Z*)(skimmed_fee_msat_arg_ptr);
49803         skimmed_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(skimmed_fee_msat_arg));
49804         LDKOnionPacket onion_routing_packet_arg_conv;
49805         onion_routing_packet_arg_conv.inner = untag_ptr(onion_routing_packet_arg);
49806         onion_routing_packet_arg_conv.is_owned = ptr_is_owned(onion_routing_packet_arg);
49807         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_routing_packet_arg_conv);
49808         onion_routing_packet_arg_conv = OnionPacket_clone(&onion_routing_packet_arg_conv);
49809         LDKPublicKey blinding_point_arg_ref;
49810         CHECK(blinding_point_arg->arr_len == 33);
49811         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
49812         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);
49813         uint64_t ret_ref = 0;
49814         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49815         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49816         return ret_ref;
49817 }
49818
49819 static inline uint64_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
49820         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
49821         uint64_t ret_ref = 0;
49822         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49823         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49824         return ret_ref;
49825 }
49826 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_clone_ptr"))) TS_UpdateAddHTLC_clone_ptr(uint64_t arg) {
49827         LDKUpdateAddHTLC arg_conv;
49828         arg_conv.inner = untag_ptr(arg);
49829         arg_conv.is_owned = ptr_is_owned(arg);
49830         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49831         arg_conv.is_owned = false;
49832         int64_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
49833         return ret_conv;
49834 }
49835
49836 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_clone"))) TS_UpdateAddHTLC_clone(uint64_t orig) {
49837         LDKUpdateAddHTLC orig_conv;
49838         orig_conv.inner = untag_ptr(orig);
49839         orig_conv.is_owned = ptr_is_owned(orig);
49840         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49841         orig_conv.is_owned = false;
49842         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
49843         uint64_t ret_ref = 0;
49844         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49845         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49846         return ret_ref;
49847 }
49848
49849 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_hash"))) TS_UpdateAddHTLC_hash(uint64_t o) {
49850         LDKUpdateAddHTLC o_conv;
49851         o_conv.inner = untag_ptr(o);
49852         o_conv.is_owned = ptr_is_owned(o);
49853         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49854         o_conv.is_owned = false;
49855         int64_t ret_conv = UpdateAddHTLC_hash(&o_conv);
49856         return ret_conv;
49857 }
49858
49859 jboolean  __attribute__((export_name("TS_UpdateAddHTLC_eq"))) TS_UpdateAddHTLC_eq(uint64_t a, uint64_t b) {
49860         LDKUpdateAddHTLC a_conv;
49861         a_conv.inner = untag_ptr(a);
49862         a_conv.is_owned = ptr_is_owned(a);
49863         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49864         a_conv.is_owned = false;
49865         LDKUpdateAddHTLC b_conv;
49866         b_conv.inner = untag_ptr(b);
49867         b_conv.is_owned = ptr_is_owned(b);
49868         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49869         b_conv.is_owned = false;
49870         jboolean ret_conv = UpdateAddHTLC_eq(&a_conv, &b_conv);
49871         return ret_conv;
49872 }
49873
49874 void  __attribute__((export_name("TS_OnionMessage_free"))) TS_OnionMessage_free(uint64_t this_obj) {
49875         LDKOnionMessage this_obj_conv;
49876         this_obj_conv.inner = untag_ptr(this_obj);
49877         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49879         OnionMessage_free(this_obj_conv);
49880 }
49881
49882 int8_tArray  __attribute__((export_name("TS_OnionMessage_get_blinding_point"))) TS_OnionMessage_get_blinding_point(uint64_t this_ptr) {
49883         LDKOnionMessage this_ptr_conv;
49884         this_ptr_conv.inner = untag_ptr(this_ptr);
49885         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49887         this_ptr_conv.is_owned = false;
49888         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
49889         memcpy(ret_arr->elems, OnionMessage_get_blinding_point(&this_ptr_conv).compressed_form, 33);
49890         return ret_arr;
49891 }
49892
49893 void  __attribute__((export_name("TS_OnionMessage_set_blinding_point"))) TS_OnionMessage_set_blinding_point(uint64_t this_ptr, int8_tArray val) {
49894         LDKOnionMessage this_ptr_conv;
49895         this_ptr_conv.inner = untag_ptr(this_ptr);
49896         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49898         this_ptr_conv.is_owned = false;
49899         LDKPublicKey val_ref;
49900         CHECK(val->arr_len == 33);
49901         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
49902         OnionMessage_set_blinding_point(&this_ptr_conv, val_ref);
49903 }
49904
49905 uint64_t  __attribute__((export_name("TS_OnionMessage_get_onion_routing_packet"))) TS_OnionMessage_get_onion_routing_packet(uint64_t this_ptr) {
49906         LDKOnionMessage this_ptr_conv;
49907         this_ptr_conv.inner = untag_ptr(this_ptr);
49908         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49910         this_ptr_conv.is_owned = false;
49911         LDKPacket ret_var = OnionMessage_get_onion_routing_packet(&this_ptr_conv);
49912         uint64_t ret_ref = 0;
49913         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49914         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49915         return ret_ref;
49916 }
49917
49918 void  __attribute__((export_name("TS_OnionMessage_set_onion_routing_packet"))) TS_OnionMessage_set_onion_routing_packet(uint64_t this_ptr, uint64_t val) {
49919         LDKOnionMessage this_ptr_conv;
49920         this_ptr_conv.inner = untag_ptr(this_ptr);
49921         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49923         this_ptr_conv.is_owned = false;
49924         LDKPacket val_conv;
49925         val_conv.inner = untag_ptr(val);
49926         val_conv.is_owned = ptr_is_owned(val);
49927         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49928         val_conv = Packet_clone(&val_conv);
49929         OnionMessage_set_onion_routing_packet(&this_ptr_conv, val_conv);
49930 }
49931
49932 uint64_t  __attribute__((export_name("TS_OnionMessage_new"))) TS_OnionMessage_new(int8_tArray blinding_point_arg, uint64_t onion_routing_packet_arg) {
49933         LDKPublicKey blinding_point_arg_ref;
49934         CHECK(blinding_point_arg->arr_len == 33);
49935         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
49936         LDKPacket onion_routing_packet_arg_conv;
49937         onion_routing_packet_arg_conv.inner = untag_ptr(onion_routing_packet_arg);
49938         onion_routing_packet_arg_conv.is_owned = ptr_is_owned(onion_routing_packet_arg);
49939         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_routing_packet_arg_conv);
49940         onion_routing_packet_arg_conv = Packet_clone(&onion_routing_packet_arg_conv);
49941         LDKOnionMessage ret_var = OnionMessage_new(blinding_point_arg_ref, onion_routing_packet_arg_conv);
49942         uint64_t ret_ref = 0;
49943         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49944         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49945         return ret_ref;
49946 }
49947
49948 static inline uint64_t OnionMessage_clone_ptr(LDKOnionMessage *NONNULL_PTR arg) {
49949         LDKOnionMessage ret_var = OnionMessage_clone(arg);
49950         uint64_t ret_ref = 0;
49951         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49952         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49953         return ret_ref;
49954 }
49955 int64_t  __attribute__((export_name("TS_OnionMessage_clone_ptr"))) TS_OnionMessage_clone_ptr(uint64_t arg) {
49956         LDKOnionMessage arg_conv;
49957         arg_conv.inner = untag_ptr(arg);
49958         arg_conv.is_owned = ptr_is_owned(arg);
49959         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49960         arg_conv.is_owned = false;
49961         int64_t ret_conv = OnionMessage_clone_ptr(&arg_conv);
49962         return ret_conv;
49963 }
49964
49965 uint64_t  __attribute__((export_name("TS_OnionMessage_clone"))) TS_OnionMessage_clone(uint64_t orig) {
49966         LDKOnionMessage orig_conv;
49967         orig_conv.inner = untag_ptr(orig);
49968         orig_conv.is_owned = ptr_is_owned(orig);
49969         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49970         orig_conv.is_owned = false;
49971         LDKOnionMessage ret_var = OnionMessage_clone(&orig_conv);
49972         uint64_t ret_ref = 0;
49973         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49974         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49975         return ret_ref;
49976 }
49977
49978 int64_t  __attribute__((export_name("TS_OnionMessage_hash"))) TS_OnionMessage_hash(uint64_t o) {
49979         LDKOnionMessage o_conv;
49980         o_conv.inner = untag_ptr(o);
49981         o_conv.is_owned = ptr_is_owned(o);
49982         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49983         o_conv.is_owned = false;
49984         int64_t ret_conv = OnionMessage_hash(&o_conv);
49985         return ret_conv;
49986 }
49987
49988 jboolean  __attribute__((export_name("TS_OnionMessage_eq"))) TS_OnionMessage_eq(uint64_t a, uint64_t b) {
49989         LDKOnionMessage a_conv;
49990         a_conv.inner = untag_ptr(a);
49991         a_conv.is_owned = ptr_is_owned(a);
49992         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49993         a_conv.is_owned = false;
49994         LDKOnionMessage b_conv;
49995         b_conv.inner = untag_ptr(b);
49996         b_conv.is_owned = ptr_is_owned(b);
49997         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49998         b_conv.is_owned = false;
49999         jboolean ret_conv = OnionMessage_eq(&a_conv, &b_conv);
50000         return ret_conv;
50001 }
50002
50003 void  __attribute__((export_name("TS_UpdateFulfillHTLC_free"))) TS_UpdateFulfillHTLC_free(uint64_t this_obj) {
50004         LDKUpdateFulfillHTLC this_obj_conv;
50005         this_obj_conv.inner = untag_ptr(this_obj);
50006         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50008         UpdateFulfillHTLC_free(this_obj_conv);
50009 }
50010
50011 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_get_channel_id"))) TS_UpdateFulfillHTLC_get_channel_id(uint64_t this_ptr) {
50012         LDKUpdateFulfillHTLC this_ptr_conv;
50013         this_ptr_conv.inner = untag_ptr(this_ptr);
50014         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50016         this_ptr_conv.is_owned = false;
50017         LDKChannelId ret_var = UpdateFulfillHTLC_get_channel_id(&this_ptr_conv);
50018         uint64_t ret_ref = 0;
50019         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50020         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50021         return ret_ref;
50022 }
50023
50024 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_channel_id"))) TS_UpdateFulfillHTLC_set_channel_id(uint64_t this_ptr, uint64_t val) {
50025         LDKUpdateFulfillHTLC this_ptr_conv;
50026         this_ptr_conv.inner = untag_ptr(this_ptr);
50027         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50029         this_ptr_conv.is_owned = false;
50030         LDKChannelId val_conv;
50031         val_conv.inner = untag_ptr(val);
50032         val_conv.is_owned = ptr_is_owned(val);
50033         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50034         val_conv = ChannelId_clone(&val_conv);
50035         UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_conv);
50036 }
50037
50038 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_get_htlc_id"))) TS_UpdateFulfillHTLC_get_htlc_id(uint64_t this_ptr) {
50039         LDKUpdateFulfillHTLC this_ptr_conv;
50040         this_ptr_conv.inner = untag_ptr(this_ptr);
50041         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50043         this_ptr_conv.is_owned = false;
50044         int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
50045         return ret_conv;
50046 }
50047
50048 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_htlc_id"))) TS_UpdateFulfillHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
50049         LDKUpdateFulfillHTLC this_ptr_conv;
50050         this_ptr_conv.inner = untag_ptr(this_ptr);
50051         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50053         this_ptr_conv.is_owned = false;
50054         UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
50055 }
50056
50057 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_get_payment_preimage"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint64_t this_ptr) {
50058         LDKUpdateFulfillHTLC this_ptr_conv;
50059         this_ptr_conv.inner = untag_ptr(this_ptr);
50060         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50062         this_ptr_conv.is_owned = false;
50063         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
50064         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
50065         return ret_arr;
50066 }
50067
50068 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_payment_preimage"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint64_t this_ptr, int8_tArray val) {
50069         LDKUpdateFulfillHTLC 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         LDKThirtyTwoBytes val_ref;
50075         CHECK(val->arr_len == 32);
50076         memcpy(val_ref.data, val->elems, 32); FREE(val);
50077         UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
50078 }
50079
50080 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) {
50081         LDKChannelId channel_id_arg_conv;
50082         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
50083         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
50084         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
50085         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
50086         LDKThirtyTwoBytes payment_preimage_arg_ref;
50087         CHECK(payment_preimage_arg->arr_len == 32);
50088         memcpy(payment_preimage_arg_ref.data, payment_preimage_arg->elems, 32); FREE(payment_preimage_arg);
50089         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_conv, htlc_id_arg, payment_preimage_arg_ref);
50090         uint64_t ret_ref = 0;
50091         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50092         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50093         return ret_ref;
50094 }
50095
50096 static inline uint64_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
50097         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
50098         uint64_t ret_ref = 0;
50099         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50100         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50101         return ret_ref;
50102 }
50103 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_clone_ptr"))) TS_UpdateFulfillHTLC_clone_ptr(uint64_t arg) {
50104         LDKUpdateFulfillHTLC arg_conv;
50105         arg_conv.inner = untag_ptr(arg);
50106         arg_conv.is_owned = ptr_is_owned(arg);
50107         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50108         arg_conv.is_owned = false;
50109         int64_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
50110         return ret_conv;
50111 }
50112
50113 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_clone"))) TS_UpdateFulfillHTLC_clone(uint64_t orig) {
50114         LDKUpdateFulfillHTLC orig_conv;
50115         orig_conv.inner = untag_ptr(orig);
50116         orig_conv.is_owned = ptr_is_owned(orig);
50117         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50118         orig_conv.is_owned = false;
50119         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
50120         uint64_t ret_ref = 0;
50121         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50122         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50123         return ret_ref;
50124 }
50125
50126 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_hash"))) TS_UpdateFulfillHTLC_hash(uint64_t o) {
50127         LDKUpdateFulfillHTLC o_conv;
50128         o_conv.inner = untag_ptr(o);
50129         o_conv.is_owned = ptr_is_owned(o);
50130         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50131         o_conv.is_owned = false;
50132         int64_t ret_conv = UpdateFulfillHTLC_hash(&o_conv);
50133         return ret_conv;
50134 }
50135
50136 jboolean  __attribute__((export_name("TS_UpdateFulfillHTLC_eq"))) TS_UpdateFulfillHTLC_eq(uint64_t a, uint64_t b) {
50137         LDKUpdateFulfillHTLC a_conv;
50138         a_conv.inner = untag_ptr(a);
50139         a_conv.is_owned = ptr_is_owned(a);
50140         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50141         a_conv.is_owned = false;
50142         LDKUpdateFulfillHTLC b_conv;
50143         b_conv.inner = untag_ptr(b);
50144         b_conv.is_owned = ptr_is_owned(b);
50145         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50146         b_conv.is_owned = false;
50147         jboolean ret_conv = UpdateFulfillHTLC_eq(&a_conv, &b_conv);
50148         return ret_conv;
50149 }
50150
50151 void  __attribute__((export_name("TS_UpdateFailHTLC_free"))) TS_UpdateFailHTLC_free(uint64_t this_obj) {
50152         LDKUpdateFailHTLC this_obj_conv;
50153         this_obj_conv.inner = untag_ptr(this_obj);
50154         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50156         UpdateFailHTLC_free(this_obj_conv);
50157 }
50158
50159 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_get_channel_id"))) TS_UpdateFailHTLC_get_channel_id(uint64_t this_ptr) {
50160         LDKUpdateFailHTLC this_ptr_conv;
50161         this_ptr_conv.inner = untag_ptr(this_ptr);
50162         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50164         this_ptr_conv.is_owned = false;
50165         LDKChannelId ret_var = UpdateFailHTLC_get_channel_id(&this_ptr_conv);
50166         uint64_t ret_ref = 0;
50167         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50168         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50169         return ret_ref;
50170 }
50171
50172 void  __attribute__((export_name("TS_UpdateFailHTLC_set_channel_id"))) TS_UpdateFailHTLC_set_channel_id(uint64_t this_ptr, uint64_t val) {
50173         LDKUpdateFailHTLC this_ptr_conv;
50174         this_ptr_conv.inner = untag_ptr(this_ptr);
50175         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50177         this_ptr_conv.is_owned = false;
50178         LDKChannelId val_conv;
50179         val_conv.inner = untag_ptr(val);
50180         val_conv.is_owned = ptr_is_owned(val);
50181         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50182         val_conv = ChannelId_clone(&val_conv);
50183         UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_conv);
50184 }
50185
50186 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_get_htlc_id"))) TS_UpdateFailHTLC_get_htlc_id(uint64_t this_ptr) {
50187         LDKUpdateFailHTLC this_ptr_conv;
50188         this_ptr_conv.inner = untag_ptr(this_ptr);
50189         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50191         this_ptr_conv.is_owned = false;
50192         int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
50193         return ret_conv;
50194 }
50195
50196 void  __attribute__((export_name("TS_UpdateFailHTLC_set_htlc_id"))) TS_UpdateFailHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
50197         LDKUpdateFailHTLC this_ptr_conv;
50198         this_ptr_conv.inner = untag_ptr(this_ptr);
50199         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50201         this_ptr_conv.is_owned = false;
50202         UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
50203 }
50204
50205 static inline uint64_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
50206         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
50207         uint64_t ret_ref = 0;
50208         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50209         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50210         return ret_ref;
50211 }
50212 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_clone_ptr"))) TS_UpdateFailHTLC_clone_ptr(uint64_t arg) {
50213         LDKUpdateFailHTLC arg_conv;
50214         arg_conv.inner = untag_ptr(arg);
50215         arg_conv.is_owned = ptr_is_owned(arg);
50216         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50217         arg_conv.is_owned = false;
50218         int64_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
50219         return ret_conv;
50220 }
50221
50222 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_clone"))) TS_UpdateFailHTLC_clone(uint64_t orig) {
50223         LDKUpdateFailHTLC orig_conv;
50224         orig_conv.inner = untag_ptr(orig);
50225         orig_conv.is_owned = ptr_is_owned(orig);
50226         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50227         orig_conv.is_owned = false;
50228         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
50229         uint64_t ret_ref = 0;
50230         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50231         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50232         return ret_ref;
50233 }
50234
50235 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_hash"))) TS_UpdateFailHTLC_hash(uint64_t o) {
50236         LDKUpdateFailHTLC o_conv;
50237         o_conv.inner = untag_ptr(o);
50238         o_conv.is_owned = ptr_is_owned(o);
50239         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50240         o_conv.is_owned = false;
50241         int64_t ret_conv = UpdateFailHTLC_hash(&o_conv);
50242         return ret_conv;
50243 }
50244
50245 jboolean  __attribute__((export_name("TS_UpdateFailHTLC_eq"))) TS_UpdateFailHTLC_eq(uint64_t a, uint64_t b) {
50246         LDKUpdateFailHTLC a_conv;
50247         a_conv.inner = untag_ptr(a);
50248         a_conv.is_owned = ptr_is_owned(a);
50249         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50250         a_conv.is_owned = false;
50251         LDKUpdateFailHTLC b_conv;
50252         b_conv.inner = untag_ptr(b);
50253         b_conv.is_owned = ptr_is_owned(b);
50254         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50255         b_conv.is_owned = false;
50256         jboolean ret_conv = UpdateFailHTLC_eq(&a_conv, &b_conv);
50257         return ret_conv;
50258 }
50259
50260 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_free"))) TS_UpdateFailMalformedHTLC_free(uint64_t this_obj) {
50261         LDKUpdateFailMalformedHTLC this_obj_conv;
50262         this_obj_conv.inner = untag_ptr(this_obj);
50263         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50265         UpdateFailMalformedHTLC_free(this_obj_conv);
50266 }
50267
50268 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_channel_id"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint64_t this_ptr) {
50269         LDKUpdateFailMalformedHTLC this_ptr_conv;
50270         this_ptr_conv.inner = untag_ptr(this_ptr);
50271         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50273         this_ptr_conv.is_owned = false;
50274         LDKChannelId ret_var = UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv);
50275         uint64_t ret_ref = 0;
50276         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50277         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50278         return ret_ref;
50279 }
50280
50281 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_channel_id"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint64_t this_ptr, uint64_t val) {
50282         LDKUpdateFailMalformedHTLC this_ptr_conv;
50283         this_ptr_conv.inner = untag_ptr(this_ptr);
50284         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50286         this_ptr_conv.is_owned = false;
50287         LDKChannelId val_conv;
50288         val_conv.inner = untag_ptr(val);
50289         val_conv.is_owned = ptr_is_owned(val);
50290         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50291         val_conv = ChannelId_clone(&val_conv);
50292         UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_conv);
50293 }
50294
50295 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_htlc_id"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint64_t this_ptr) {
50296         LDKUpdateFailMalformedHTLC this_ptr_conv;
50297         this_ptr_conv.inner = untag_ptr(this_ptr);
50298         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50300         this_ptr_conv.is_owned = false;
50301         int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
50302         return ret_conv;
50303 }
50304
50305 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_htlc_id"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
50306         LDKUpdateFailMalformedHTLC this_ptr_conv;
50307         this_ptr_conv.inner = untag_ptr(this_ptr);
50308         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50310         this_ptr_conv.is_owned = false;
50311         UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
50312 }
50313
50314 int16_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_failure_code"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint64_t this_ptr) {
50315         LDKUpdateFailMalformedHTLC this_ptr_conv;
50316         this_ptr_conv.inner = untag_ptr(this_ptr);
50317         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50319         this_ptr_conv.is_owned = false;
50320         int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
50321         return ret_conv;
50322 }
50323
50324 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_failure_code"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint64_t this_ptr, int16_t val) {
50325         LDKUpdateFailMalformedHTLC this_ptr_conv;
50326         this_ptr_conv.inner = untag_ptr(this_ptr);
50327         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50329         this_ptr_conv.is_owned = false;
50330         UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
50331 }
50332
50333 static inline uint64_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
50334         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
50335         uint64_t ret_ref = 0;
50336         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50337         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50338         return ret_ref;
50339 }
50340 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone_ptr"))) TS_UpdateFailMalformedHTLC_clone_ptr(uint64_t arg) {
50341         LDKUpdateFailMalformedHTLC arg_conv;
50342         arg_conv.inner = untag_ptr(arg);
50343         arg_conv.is_owned = ptr_is_owned(arg);
50344         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50345         arg_conv.is_owned = false;
50346         int64_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
50347         return ret_conv;
50348 }
50349
50350 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone"))) TS_UpdateFailMalformedHTLC_clone(uint64_t orig) {
50351         LDKUpdateFailMalformedHTLC orig_conv;
50352         orig_conv.inner = untag_ptr(orig);
50353         orig_conv.is_owned = ptr_is_owned(orig);
50354         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50355         orig_conv.is_owned = false;
50356         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
50357         uint64_t ret_ref = 0;
50358         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50359         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50360         return ret_ref;
50361 }
50362
50363 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_hash"))) TS_UpdateFailMalformedHTLC_hash(uint64_t o) {
50364         LDKUpdateFailMalformedHTLC o_conv;
50365         o_conv.inner = untag_ptr(o);
50366         o_conv.is_owned = ptr_is_owned(o);
50367         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50368         o_conv.is_owned = false;
50369         int64_t ret_conv = UpdateFailMalformedHTLC_hash(&o_conv);
50370         return ret_conv;
50371 }
50372
50373 jboolean  __attribute__((export_name("TS_UpdateFailMalformedHTLC_eq"))) TS_UpdateFailMalformedHTLC_eq(uint64_t a, uint64_t b) {
50374         LDKUpdateFailMalformedHTLC a_conv;
50375         a_conv.inner = untag_ptr(a);
50376         a_conv.is_owned = ptr_is_owned(a);
50377         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50378         a_conv.is_owned = false;
50379         LDKUpdateFailMalformedHTLC b_conv;
50380         b_conv.inner = untag_ptr(b);
50381         b_conv.is_owned = ptr_is_owned(b);
50382         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50383         b_conv.is_owned = false;
50384         jboolean ret_conv = UpdateFailMalformedHTLC_eq(&a_conv, &b_conv);
50385         return ret_conv;
50386 }
50387
50388 void  __attribute__((export_name("TS_CommitmentSigned_free"))) TS_CommitmentSigned_free(uint64_t this_obj) {
50389         LDKCommitmentSigned this_obj_conv;
50390         this_obj_conv.inner = untag_ptr(this_obj);
50391         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50393         CommitmentSigned_free(this_obj_conv);
50394 }
50395
50396 uint64_t  __attribute__((export_name("TS_CommitmentSigned_get_channel_id"))) TS_CommitmentSigned_get_channel_id(uint64_t this_ptr) {
50397         LDKCommitmentSigned this_ptr_conv;
50398         this_ptr_conv.inner = untag_ptr(this_ptr);
50399         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50401         this_ptr_conv.is_owned = false;
50402         LDKChannelId ret_var = CommitmentSigned_get_channel_id(&this_ptr_conv);
50403         uint64_t ret_ref = 0;
50404         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50405         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50406         return ret_ref;
50407 }
50408
50409 void  __attribute__((export_name("TS_CommitmentSigned_set_channel_id"))) TS_CommitmentSigned_set_channel_id(uint64_t this_ptr, uint64_t val) {
50410         LDKCommitmentSigned this_ptr_conv;
50411         this_ptr_conv.inner = untag_ptr(this_ptr);
50412         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50414         this_ptr_conv.is_owned = false;
50415         LDKChannelId val_conv;
50416         val_conv.inner = untag_ptr(val);
50417         val_conv.is_owned = ptr_is_owned(val);
50418         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50419         val_conv = ChannelId_clone(&val_conv);
50420         CommitmentSigned_set_channel_id(&this_ptr_conv, val_conv);
50421 }
50422
50423 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_get_signature"))) TS_CommitmentSigned_get_signature(uint64_t this_ptr) {
50424         LDKCommitmentSigned this_ptr_conv;
50425         this_ptr_conv.inner = untag_ptr(this_ptr);
50426         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50428         this_ptr_conv.is_owned = false;
50429         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
50430         memcpy(ret_arr->elems, CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
50431         return ret_arr;
50432 }
50433
50434 void  __attribute__((export_name("TS_CommitmentSigned_set_signature"))) TS_CommitmentSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
50435         LDKCommitmentSigned this_ptr_conv;
50436         this_ptr_conv.inner = untag_ptr(this_ptr);
50437         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50439         this_ptr_conv.is_owned = false;
50440         LDKECDSASignature val_ref;
50441         CHECK(val->arr_len == 64);
50442         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
50443         CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
50444 }
50445
50446 ptrArray  __attribute__((export_name("TS_CommitmentSigned_get_htlc_signatures"))) TS_CommitmentSigned_get_htlc_signatures(uint64_t this_ptr) {
50447         LDKCommitmentSigned this_ptr_conv;
50448         this_ptr_conv.inner = untag_ptr(this_ptr);
50449         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50451         this_ptr_conv.is_owned = false;
50452         LDKCVec_ECDSASignatureZ ret_var = CommitmentSigned_get_htlc_signatures(&this_ptr_conv);
50453         ptrArray ret_arr = NULL;
50454         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
50455         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
50456         for (size_t m = 0; m < ret_var.datalen; m++) {
50457                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
50458                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
50459                 ret_arr_ptr[m] = ret_conv_12_arr;
50460         }
50461         
50462         FREE(ret_var.data);
50463         return ret_arr;
50464 }
50465
50466 void  __attribute__((export_name("TS_CommitmentSigned_set_htlc_signatures"))) TS_CommitmentSigned_set_htlc_signatures(uint64_t this_ptr, ptrArray val) {
50467         LDKCommitmentSigned this_ptr_conv;
50468         this_ptr_conv.inner = untag_ptr(this_ptr);
50469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50471         this_ptr_conv.is_owned = false;
50472         LDKCVec_ECDSASignatureZ val_constr;
50473         val_constr.datalen = val->arr_len;
50474         if (val_constr.datalen > 0)
50475                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
50476         else
50477                 val_constr.data = NULL;
50478         int8_tArray* val_vals = (void*) val->elems;
50479         for (size_t m = 0; m < val_constr.datalen; m++) {
50480                 int8_tArray val_conv_12 = val_vals[m];
50481                 LDKECDSASignature val_conv_12_ref;
50482                 CHECK(val_conv_12->arr_len == 64);
50483                 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
50484                 val_constr.data[m] = val_conv_12_ref;
50485         }
50486         FREE(val);
50487         CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
50488 }
50489
50490 uint64_t  __attribute__((export_name("TS_CommitmentSigned_new"))) TS_CommitmentSigned_new(uint64_t channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
50491         LDKChannelId channel_id_arg_conv;
50492         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
50493         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
50494         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
50495         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
50496         LDKECDSASignature signature_arg_ref;
50497         CHECK(signature_arg->arr_len == 64);
50498         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
50499         LDKCVec_ECDSASignatureZ htlc_signatures_arg_constr;
50500         htlc_signatures_arg_constr.datalen = htlc_signatures_arg->arr_len;
50501         if (htlc_signatures_arg_constr.datalen > 0)
50502                 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
50503         else
50504                 htlc_signatures_arg_constr.data = NULL;
50505         int8_tArray* htlc_signatures_arg_vals = (void*) htlc_signatures_arg->elems;
50506         for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
50507                 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
50508                 LDKECDSASignature htlc_signatures_arg_conv_12_ref;
50509                 CHECK(htlc_signatures_arg_conv_12->arr_len == 64);
50510                 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, htlc_signatures_arg_conv_12->elems, 64); FREE(htlc_signatures_arg_conv_12);
50511                 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
50512         }
50513         FREE(htlc_signatures_arg);
50514         LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_conv, signature_arg_ref, htlc_signatures_arg_constr);
50515         uint64_t ret_ref = 0;
50516         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50517         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50518         return ret_ref;
50519 }
50520
50521 static inline uint64_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
50522         LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
50523         uint64_t ret_ref = 0;
50524         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50525         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50526         return ret_ref;
50527 }
50528 int64_t  __attribute__((export_name("TS_CommitmentSigned_clone_ptr"))) TS_CommitmentSigned_clone_ptr(uint64_t arg) {
50529         LDKCommitmentSigned arg_conv;
50530         arg_conv.inner = untag_ptr(arg);
50531         arg_conv.is_owned = ptr_is_owned(arg);
50532         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50533         arg_conv.is_owned = false;
50534         int64_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
50535         return ret_conv;
50536 }
50537
50538 uint64_t  __attribute__((export_name("TS_CommitmentSigned_clone"))) TS_CommitmentSigned_clone(uint64_t orig) {
50539         LDKCommitmentSigned orig_conv;
50540         orig_conv.inner = untag_ptr(orig);
50541         orig_conv.is_owned = ptr_is_owned(orig);
50542         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50543         orig_conv.is_owned = false;
50544         LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
50545         uint64_t ret_ref = 0;
50546         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50547         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50548         return ret_ref;
50549 }
50550
50551 int64_t  __attribute__((export_name("TS_CommitmentSigned_hash"))) TS_CommitmentSigned_hash(uint64_t o) {
50552         LDKCommitmentSigned o_conv;
50553         o_conv.inner = untag_ptr(o);
50554         o_conv.is_owned = ptr_is_owned(o);
50555         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50556         o_conv.is_owned = false;
50557         int64_t ret_conv = CommitmentSigned_hash(&o_conv);
50558         return ret_conv;
50559 }
50560
50561 jboolean  __attribute__((export_name("TS_CommitmentSigned_eq"))) TS_CommitmentSigned_eq(uint64_t a, uint64_t b) {
50562         LDKCommitmentSigned a_conv;
50563         a_conv.inner = untag_ptr(a);
50564         a_conv.is_owned = ptr_is_owned(a);
50565         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50566         a_conv.is_owned = false;
50567         LDKCommitmentSigned b_conv;
50568         b_conv.inner = untag_ptr(b);
50569         b_conv.is_owned = ptr_is_owned(b);
50570         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50571         b_conv.is_owned = false;
50572         jboolean ret_conv = CommitmentSigned_eq(&a_conv, &b_conv);
50573         return ret_conv;
50574 }
50575
50576 void  __attribute__((export_name("TS_RevokeAndACK_free"))) TS_RevokeAndACK_free(uint64_t this_obj) {
50577         LDKRevokeAndACK this_obj_conv;
50578         this_obj_conv.inner = untag_ptr(this_obj);
50579         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50581         RevokeAndACK_free(this_obj_conv);
50582 }
50583
50584 uint64_t  __attribute__((export_name("TS_RevokeAndACK_get_channel_id"))) TS_RevokeAndACK_get_channel_id(uint64_t this_ptr) {
50585         LDKRevokeAndACK this_ptr_conv;
50586         this_ptr_conv.inner = untag_ptr(this_ptr);
50587         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50589         this_ptr_conv.is_owned = false;
50590         LDKChannelId ret_var = RevokeAndACK_get_channel_id(&this_ptr_conv);
50591         uint64_t ret_ref = 0;
50592         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50593         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50594         return ret_ref;
50595 }
50596
50597 void  __attribute__((export_name("TS_RevokeAndACK_set_channel_id"))) TS_RevokeAndACK_set_channel_id(uint64_t this_ptr, uint64_t val) {
50598         LDKRevokeAndACK this_ptr_conv;
50599         this_ptr_conv.inner = untag_ptr(this_ptr);
50600         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50602         this_ptr_conv.is_owned = false;
50603         LDKChannelId val_conv;
50604         val_conv.inner = untag_ptr(val);
50605         val_conv.is_owned = ptr_is_owned(val);
50606         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50607         val_conv = ChannelId_clone(&val_conv);
50608         RevokeAndACK_set_channel_id(&this_ptr_conv, val_conv);
50609 }
50610
50611 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_per_commitment_secret"))) TS_RevokeAndACK_get_per_commitment_secret(uint64_t this_ptr) {
50612         LDKRevokeAndACK this_ptr_conv;
50613         this_ptr_conv.inner = untag_ptr(this_ptr);
50614         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50616         this_ptr_conv.is_owned = false;
50617         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
50618         memcpy(ret_arr->elems, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
50619         return ret_arr;
50620 }
50621
50622 void  __attribute__((export_name("TS_RevokeAndACK_set_per_commitment_secret"))) TS_RevokeAndACK_set_per_commitment_secret(uint64_t this_ptr, int8_tArray val) {
50623         LDKRevokeAndACK this_ptr_conv;
50624         this_ptr_conv.inner = untag_ptr(this_ptr);
50625         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50627         this_ptr_conv.is_owned = false;
50628         LDKThirtyTwoBytes val_ref;
50629         CHECK(val->arr_len == 32);
50630         memcpy(val_ref.data, val->elems, 32); FREE(val);
50631         RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
50632 }
50633
50634 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_next_per_commitment_point"))) TS_RevokeAndACK_get_next_per_commitment_point(uint64_t this_ptr) {
50635         LDKRevokeAndACK this_ptr_conv;
50636         this_ptr_conv.inner = untag_ptr(this_ptr);
50637         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50639         this_ptr_conv.is_owned = false;
50640         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
50641         memcpy(ret_arr->elems, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
50642         return ret_arr;
50643 }
50644
50645 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) {
50646         LDKRevokeAndACK this_ptr_conv;
50647         this_ptr_conv.inner = untag_ptr(this_ptr);
50648         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50650         this_ptr_conv.is_owned = false;
50651         LDKPublicKey val_ref;
50652         CHECK(val->arr_len == 33);
50653         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
50654         RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
50655 }
50656
50657 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) {
50658         LDKChannelId channel_id_arg_conv;
50659         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
50660         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
50661         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
50662         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
50663         LDKThirtyTwoBytes per_commitment_secret_arg_ref;
50664         CHECK(per_commitment_secret_arg->arr_len == 32);
50665         memcpy(per_commitment_secret_arg_ref.data, per_commitment_secret_arg->elems, 32); FREE(per_commitment_secret_arg);
50666         LDKPublicKey next_per_commitment_point_arg_ref;
50667         CHECK(next_per_commitment_point_arg->arr_len == 33);
50668         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
50669         LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_conv, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
50670         uint64_t ret_ref = 0;
50671         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50672         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50673         return ret_ref;
50674 }
50675
50676 static inline uint64_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
50677         LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
50678         uint64_t ret_ref = 0;
50679         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50680         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50681         return ret_ref;
50682 }
50683 int64_t  __attribute__((export_name("TS_RevokeAndACK_clone_ptr"))) TS_RevokeAndACK_clone_ptr(uint64_t arg) {
50684         LDKRevokeAndACK arg_conv;
50685         arg_conv.inner = untag_ptr(arg);
50686         arg_conv.is_owned = ptr_is_owned(arg);
50687         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50688         arg_conv.is_owned = false;
50689         int64_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
50690         return ret_conv;
50691 }
50692
50693 uint64_t  __attribute__((export_name("TS_RevokeAndACK_clone"))) TS_RevokeAndACK_clone(uint64_t orig) {
50694         LDKRevokeAndACK orig_conv;
50695         orig_conv.inner = untag_ptr(orig);
50696         orig_conv.is_owned = ptr_is_owned(orig);
50697         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50698         orig_conv.is_owned = false;
50699         LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
50700         uint64_t ret_ref = 0;
50701         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50702         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50703         return ret_ref;
50704 }
50705
50706 int64_t  __attribute__((export_name("TS_RevokeAndACK_hash"))) TS_RevokeAndACK_hash(uint64_t o) {
50707         LDKRevokeAndACK o_conv;
50708         o_conv.inner = untag_ptr(o);
50709         o_conv.is_owned = ptr_is_owned(o);
50710         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50711         o_conv.is_owned = false;
50712         int64_t ret_conv = RevokeAndACK_hash(&o_conv);
50713         return ret_conv;
50714 }
50715
50716 jboolean  __attribute__((export_name("TS_RevokeAndACK_eq"))) TS_RevokeAndACK_eq(uint64_t a, uint64_t b) {
50717         LDKRevokeAndACK a_conv;
50718         a_conv.inner = untag_ptr(a);
50719         a_conv.is_owned = ptr_is_owned(a);
50720         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50721         a_conv.is_owned = false;
50722         LDKRevokeAndACK b_conv;
50723         b_conv.inner = untag_ptr(b);
50724         b_conv.is_owned = ptr_is_owned(b);
50725         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50726         b_conv.is_owned = false;
50727         jboolean ret_conv = RevokeAndACK_eq(&a_conv, &b_conv);
50728         return ret_conv;
50729 }
50730
50731 void  __attribute__((export_name("TS_UpdateFee_free"))) TS_UpdateFee_free(uint64_t this_obj) {
50732         LDKUpdateFee this_obj_conv;
50733         this_obj_conv.inner = untag_ptr(this_obj);
50734         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50736         UpdateFee_free(this_obj_conv);
50737 }
50738
50739 uint64_t  __attribute__((export_name("TS_UpdateFee_get_channel_id"))) TS_UpdateFee_get_channel_id(uint64_t this_ptr) {
50740         LDKUpdateFee this_ptr_conv;
50741         this_ptr_conv.inner = untag_ptr(this_ptr);
50742         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50744         this_ptr_conv.is_owned = false;
50745         LDKChannelId ret_var = UpdateFee_get_channel_id(&this_ptr_conv);
50746         uint64_t ret_ref = 0;
50747         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50748         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50749         return ret_ref;
50750 }
50751
50752 void  __attribute__((export_name("TS_UpdateFee_set_channel_id"))) TS_UpdateFee_set_channel_id(uint64_t this_ptr, uint64_t val) {
50753         LDKUpdateFee this_ptr_conv;
50754         this_ptr_conv.inner = untag_ptr(this_ptr);
50755         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50757         this_ptr_conv.is_owned = false;
50758         LDKChannelId val_conv;
50759         val_conv.inner = untag_ptr(val);
50760         val_conv.is_owned = ptr_is_owned(val);
50761         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50762         val_conv = ChannelId_clone(&val_conv);
50763         UpdateFee_set_channel_id(&this_ptr_conv, val_conv);
50764 }
50765
50766 int32_t  __attribute__((export_name("TS_UpdateFee_get_feerate_per_kw"))) TS_UpdateFee_get_feerate_per_kw(uint64_t this_ptr) {
50767         LDKUpdateFee this_ptr_conv;
50768         this_ptr_conv.inner = untag_ptr(this_ptr);
50769         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50771         this_ptr_conv.is_owned = false;
50772         int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
50773         return ret_conv;
50774 }
50775
50776 void  __attribute__((export_name("TS_UpdateFee_set_feerate_per_kw"))) TS_UpdateFee_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
50777         LDKUpdateFee this_ptr_conv;
50778         this_ptr_conv.inner = untag_ptr(this_ptr);
50779         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50781         this_ptr_conv.is_owned = false;
50782         UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
50783 }
50784
50785 uint64_t  __attribute__((export_name("TS_UpdateFee_new"))) TS_UpdateFee_new(uint64_t channel_id_arg, int32_t feerate_per_kw_arg) {
50786         LDKChannelId channel_id_arg_conv;
50787         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
50788         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
50789         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
50790         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
50791         LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_conv, feerate_per_kw_arg);
50792         uint64_t ret_ref = 0;
50793         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50794         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50795         return ret_ref;
50796 }
50797
50798 static inline uint64_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
50799         LDKUpdateFee ret_var = UpdateFee_clone(arg);
50800         uint64_t ret_ref = 0;
50801         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50802         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50803         return ret_ref;
50804 }
50805 int64_t  __attribute__((export_name("TS_UpdateFee_clone_ptr"))) TS_UpdateFee_clone_ptr(uint64_t arg) {
50806         LDKUpdateFee arg_conv;
50807         arg_conv.inner = untag_ptr(arg);
50808         arg_conv.is_owned = ptr_is_owned(arg);
50809         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50810         arg_conv.is_owned = false;
50811         int64_t ret_conv = UpdateFee_clone_ptr(&arg_conv);
50812         return ret_conv;
50813 }
50814
50815 uint64_t  __attribute__((export_name("TS_UpdateFee_clone"))) TS_UpdateFee_clone(uint64_t orig) {
50816         LDKUpdateFee orig_conv;
50817         orig_conv.inner = untag_ptr(orig);
50818         orig_conv.is_owned = ptr_is_owned(orig);
50819         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50820         orig_conv.is_owned = false;
50821         LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
50822         uint64_t ret_ref = 0;
50823         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50824         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50825         return ret_ref;
50826 }
50827
50828 int64_t  __attribute__((export_name("TS_UpdateFee_hash"))) TS_UpdateFee_hash(uint64_t o) {
50829         LDKUpdateFee o_conv;
50830         o_conv.inner = untag_ptr(o);
50831         o_conv.is_owned = ptr_is_owned(o);
50832         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50833         o_conv.is_owned = false;
50834         int64_t ret_conv = UpdateFee_hash(&o_conv);
50835         return ret_conv;
50836 }
50837
50838 jboolean  __attribute__((export_name("TS_UpdateFee_eq"))) TS_UpdateFee_eq(uint64_t a, uint64_t b) {
50839         LDKUpdateFee a_conv;
50840         a_conv.inner = untag_ptr(a);
50841         a_conv.is_owned = ptr_is_owned(a);
50842         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50843         a_conv.is_owned = false;
50844         LDKUpdateFee b_conv;
50845         b_conv.inner = untag_ptr(b);
50846         b_conv.is_owned = ptr_is_owned(b);
50847         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50848         b_conv.is_owned = false;
50849         jboolean ret_conv = UpdateFee_eq(&a_conv, &b_conv);
50850         return ret_conv;
50851 }
50852
50853 void  __attribute__((export_name("TS_ChannelReestablish_free"))) TS_ChannelReestablish_free(uint64_t this_obj) {
50854         LDKChannelReestablish this_obj_conv;
50855         this_obj_conv.inner = untag_ptr(this_obj);
50856         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50858         ChannelReestablish_free(this_obj_conv);
50859 }
50860
50861 uint64_t  __attribute__((export_name("TS_ChannelReestablish_get_channel_id"))) TS_ChannelReestablish_get_channel_id(uint64_t this_ptr) {
50862         LDKChannelReestablish this_ptr_conv;
50863         this_ptr_conv.inner = untag_ptr(this_ptr);
50864         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50866         this_ptr_conv.is_owned = false;
50867         LDKChannelId ret_var = ChannelReestablish_get_channel_id(&this_ptr_conv);
50868         uint64_t ret_ref = 0;
50869         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50870         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50871         return ret_ref;
50872 }
50873
50874 void  __attribute__((export_name("TS_ChannelReestablish_set_channel_id"))) TS_ChannelReestablish_set_channel_id(uint64_t this_ptr, uint64_t val) {
50875         LDKChannelReestablish this_ptr_conv;
50876         this_ptr_conv.inner = untag_ptr(this_ptr);
50877         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50879         this_ptr_conv.is_owned = false;
50880         LDKChannelId val_conv;
50881         val_conv.inner = untag_ptr(val);
50882         val_conv.is_owned = ptr_is_owned(val);
50883         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50884         val_conv = ChannelId_clone(&val_conv);
50885         ChannelReestablish_set_channel_id(&this_ptr_conv, val_conv);
50886 }
50887
50888 int64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_local_commitment_number"))) TS_ChannelReestablish_get_next_local_commitment_number(uint64_t this_ptr) {
50889         LDKChannelReestablish this_ptr_conv;
50890         this_ptr_conv.inner = untag_ptr(this_ptr);
50891         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50893         this_ptr_conv.is_owned = false;
50894         int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
50895         return ret_conv;
50896 }
50897
50898 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) {
50899         LDKChannelReestablish this_ptr_conv;
50900         this_ptr_conv.inner = untag_ptr(this_ptr);
50901         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50903         this_ptr_conv.is_owned = false;
50904         ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
50905 }
50906
50907 int64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_remote_commitment_number"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint64_t this_ptr) {
50908         LDKChannelReestablish this_ptr_conv;
50909         this_ptr_conv.inner = untag_ptr(this_ptr);
50910         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50912         this_ptr_conv.is_owned = false;
50913         int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
50914         return ret_conv;
50915 }
50916
50917 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) {
50918         LDKChannelReestablish this_ptr_conv;
50919         this_ptr_conv.inner = untag_ptr(this_ptr);
50920         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50922         this_ptr_conv.is_owned = false;
50923         ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
50924 }
50925
50926 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) {
50927         LDKChannelReestablish this_ptr_conv;
50928         this_ptr_conv.inner = untag_ptr(this_ptr);
50929         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50931         this_ptr_conv.is_owned = false;
50932         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
50933         memcpy(ret_arr->elems, *ChannelReestablish_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
50934         return ret_arr;
50935 }
50936
50937 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) {
50938         LDKChannelReestablish this_ptr_conv;
50939         this_ptr_conv.inner = untag_ptr(this_ptr);
50940         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50942         this_ptr_conv.is_owned = false;
50943         LDKThirtyTwoBytes val_ref;
50944         CHECK(val->arr_len == 32);
50945         memcpy(val_ref.data, val->elems, 32); FREE(val);
50946         ChannelReestablish_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
50947 }
50948
50949 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) {
50950         LDKChannelReestablish this_ptr_conv;
50951         this_ptr_conv.inner = untag_ptr(this_ptr);
50952         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50954         this_ptr_conv.is_owned = false;
50955         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
50956         memcpy(ret_arr->elems, ChannelReestablish_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
50957         return ret_arr;
50958 }
50959
50960 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) {
50961         LDKChannelReestablish this_ptr_conv;
50962         this_ptr_conv.inner = untag_ptr(this_ptr);
50963         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50965         this_ptr_conv.is_owned = false;
50966         LDKPublicKey val_ref;
50967         CHECK(val->arr_len == 33);
50968         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
50969         ChannelReestablish_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
50970 }
50971
50972 uint64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_funding_txid"))) TS_ChannelReestablish_get_next_funding_txid(uint64_t this_ptr) {
50973         LDKChannelReestablish this_ptr_conv;
50974         this_ptr_conv.inner = untag_ptr(this_ptr);
50975         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50977         this_ptr_conv.is_owned = false;
50978         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
50979         *ret_copy = ChannelReestablish_get_next_funding_txid(&this_ptr_conv);
50980         uint64_t ret_ref = tag_ptr(ret_copy, true);
50981         return ret_ref;
50982 }
50983
50984 void  __attribute__((export_name("TS_ChannelReestablish_set_next_funding_txid"))) TS_ChannelReestablish_set_next_funding_txid(uint64_t this_ptr, uint64_t val) {
50985         LDKChannelReestablish this_ptr_conv;
50986         this_ptr_conv.inner = untag_ptr(this_ptr);
50987         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50989         this_ptr_conv.is_owned = false;
50990         void* val_ptr = untag_ptr(val);
50991         CHECK_ACCESS(val_ptr);
50992         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
50993         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
50994         ChannelReestablish_set_next_funding_txid(&this_ptr_conv, val_conv);
50995 }
50996
50997 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) {
50998         LDKChannelId channel_id_arg_conv;
50999         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
51000         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
51001         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
51002         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
51003         LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
51004         CHECK(your_last_per_commitment_secret_arg->arr_len == 32);
51005         memcpy(your_last_per_commitment_secret_arg_ref.data, your_last_per_commitment_secret_arg->elems, 32); FREE(your_last_per_commitment_secret_arg);
51006         LDKPublicKey my_current_per_commitment_point_arg_ref;
51007         CHECK(my_current_per_commitment_point_arg->arr_len == 33);
51008         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);
51009         void* next_funding_txid_arg_ptr = untag_ptr(next_funding_txid_arg);
51010         CHECK_ACCESS(next_funding_txid_arg_ptr);
51011         LDKCOption_ThirtyTwoBytesZ next_funding_txid_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(next_funding_txid_arg_ptr);
51012         next_funding_txid_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(next_funding_txid_arg));
51013         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);
51014         uint64_t ret_ref = 0;
51015         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51016         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51017         return ret_ref;
51018 }
51019
51020 static inline uint64_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
51021         LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
51022         uint64_t ret_ref = 0;
51023         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51024         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51025         return ret_ref;
51026 }
51027 int64_t  __attribute__((export_name("TS_ChannelReestablish_clone_ptr"))) TS_ChannelReestablish_clone_ptr(uint64_t arg) {
51028         LDKChannelReestablish arg_conv;
51029         arg_conv.inner = untag_ptr(arg);
51030         arg_conv.is_owned = ptr_is_owned(arg);
51031         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51032         arg_conv.is_owned = false;
51033         int64_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
51034         return ret_conv;
51035 }
51036
51037 uint64_t  __attribute__((export_name("TS_ChannelReestablish_clone"))) TS_ChannelReestablish_clone(uint64_t orig) {
51038         LDKChannelReestablish orig_conv;
51039         orig_conv.inner = untag_ptr(orig);
51040         orig_conv.is_owned = ptr_is_owned(orig);
51041         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51042         orig_conv.is_owned = false;
51043         LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
51044         uint64_t ret_ref = 0;
51045         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51046         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51047         return ret_ref;
51048 }
51049
51050 int64_t  __attribute__((export_name("TS_ChannelReestablish_hash"))) TS_ChannelReestablish_hash(uint64_t o) {
51051         LDKChannelReestablish o_conv;
51052         o_conv.inner = untag_ptr(o);
51053         o_conv.is_owned = ptr_is_owned(o);
51054         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51055         o_conv.is_owned = false;
51056         int64_t ret_conv = ChannelReestablish_hash(&o_conv);
51057         return ret_conv;
51058 }
51059
51060 jboolean  __attribute__((export_name("TS_ChannelReestablish_eq"))) TS_ChannelReestablish_eq(uint64_t a, uint64_t b) {
51061         LDKChannelReestablish a_conv;
51062         a_conv.inner = untag_ptr(a);
51063         a_conv.is_owned = ptr_is_owned(a);
51064         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51065         a_conv.is_owned = false;
51066         LDKChannelReestablish b_conv;
51067         b_conv.inner = untag_ptr(b);
51068         b_conv.is_owned = ptr_is_owned(b);
51069         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51070         b_conv.is_owned = false;
51071         jboolean ret_conv = ChannelReestablish_eq(&a_conv, &b_conv);
51072         return ret_conv;
51073 }
51074
51075 void  __attribute__((export_name("TS_AnnouncementSignatures_free"))) TS_AnnouncementSignatures_free(uint64_t this_obj) {
51076         LDKAnnouncementSignatures this_obj_conv;
51077         this_obj_conv.inner = untag_ptr(this_obj);
51078         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51080         AnnouncementSignatures_free(this_obj_conv);
51081 }
51082
51083 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_get_channel_id"))) TS_AnnouncementSignatures_get_channel_id(uint64_t this_ptr) {
51084         LDKAnnouncementSignatures this_ptr_conv;
51085         this_ptr_conv.inner = untag_ptr(this_ptr);
51086         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51088         this_ptr_conv.is_owned = false;
51089         LDKChannelId ret_var = AnnouncementSignatures_get_channel_id(&this_ptr_conv);
51090         uint64_t ret_ref = 0;
51091         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51092         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51093         return ret_ref;
51094 }
51095
51096 void  __attribute__((export_name("TS_AnnouncementSignatures_set_channel_id"))) TS_AnnouncementSignatures_set_channel_id(uint64_t this_ptr, uint64_t val) {
51097         LDKAnnouncementSignatures this_ptr_conv;
51098         this_ptr_conv.inner = untag_ptr(this_ptr);
51099         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51101         this_ptr_conv.is_owned = false;
51102         LDKChannelId val_conv;
51103         val_conv.inner = untag_ptr(val);
51104         val_conv.is_owned = ptr_is_owned(val);
51105         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51106         val_conv = ChannelId_clone(&val_conv);
51107         AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_conv);
51108 }
51109
51110 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_get_short_channel_id"))) TS_AnnouncementSignatures_get_short_channel_id(uint64_t this_ptr) {
51111         LDKAnnouncementSignatures this_ptr_conv;
51112         this_ptr_conv.inner = untag_ptr(this_ptr);
51113         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51115         this_ptr_conv.is_owned = false;
51116         int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
51117         return ret_conv;
51118 }
51119
51120 void  __attribute__((export_name("TS_AnnouncementSignatures_set_short_channel_id"))) TS_AnnouncementSignatures_set_short_channel_id(uint64_t this_ptr, int64_t val) {
51121         LDKAnnouncementSignatures this_ptr_conv;
51122         this_ptr_conv.inner = untag_ptr(this_ptr);
51123         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51125         this_ptr_conv.is_owned = false;
51126         AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
51127 }
51128
51129 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_node_signature"))) TS_AnnouncementSignatures_get_node_signature(uint64_t this_ptr) {
51130         LDKAnnouncementSignatures this_ptr_conv;
51131         this_ptr_conv.inner = untag_ptr(this_ptr);
51132         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51134         this_ptr_conv.is_owned = false;
51135         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
51136         memcpy(ret_arr->elems, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
51137         return ret_arr;
51138 }
51139
51140 void  __attribute__((export_name("TS_AnnouncementSignatures_set_node_signature"))) TS_AnnouncementSignatures_set_node_signature(uint64_t this_ptr, int8_tArray val) {
51141         LDKAnnouncementSignatures this_ptr_conv;
51142         this_ptr_conv.inner = untag_ptr(this_ptr);
51143         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51145         this_ptr_conv.is_owned = false;
51146         LDKECDSASignature val_ref;
51147         CHECK(val->arr_len == 64);
51148         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
51149         AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
51150 }
51151
51152 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_bitcoin_signature"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint64_t this_ptr) {
51153         LDKAnnouncementSignatures this_ptr_conv;
51154         this_ptr_conv.inner = untag_ptr(this_ptr);
51155         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51157         this_ptr_conv.is_owned = false;
51158         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
51159         memcpy(ret_arr->elems, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
51160         return ret_arr;
51161 }
51162
51163 void  __attribute__((export_name("TS_AnnouncementSignatures_set_bitcoin_signature"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint64_t this_ptr, int8_tArray val) {
51164         LDKAnnouncementSignatures this_ptr_conv;
51165         this_ptr_conv.inner = untag_ptr(this_ptr);
51166         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51168         this_ptr_conv.is_owned = false;
51169         LDKECDSASignature val_ref;
51170         CHECK(val->arr_len == 64);
51171         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
51172         AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
51173 }
51174
51175 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) {
51176         LDKChannelId channel_id_arg_conv;
51177         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
51178         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
51179         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
51180         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
51181         LDKECDSASignature node_signature_arg_ref;
51182         CHECK(node_signature_arg->arr_len == 64);
51183         memcpy(node_signature_arg_ref.compact_form, node_signature_arg->elems, 64); FREE(node_signature_arg);
51184         LDKECDSASignature bitcoin_signature_arg_ref;
51185         CHECK(bitcoin_signature_arg->arr_len == 64);
51186         memcpy(bitcoin_signature_arg_ref.compact_form, bitcoin_signature_arg->elems, 64); FREE(bitcoin_signature_arg);
51187         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_conv, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
51188         uint64_t ret_ref = 0;
51189         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51190         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51191         return ret_ref;
51192 }
51193
51194 static inline uint64_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
51195         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
51196         uint64_t ret_ref = 0;
51197         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51198         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51199         return ret_ref;
51200 }
51201 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_clone_ptr"))) TS_AnnouncementSignatures_clone_ptr(uint64_t arg) {
51202         LDKAnnouncementSignatures arg_conv;
51203         arg_conv.inner = untag_ptr(arg);
51204         arg_conv.is_owned = ptr_is_owned(arg);
51205         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51206         arg_conv.is_owned = false;
51207         int64_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
51208         return ret_conv;
51209 }
51210
51211 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_clone"))) TS_AnnouncementSignatures_clone(uint64_t orig) {
51212         LDKAnnouncementSignatures orig_conv;
51213         orig_conv.inner = untag_ptr(orig);
51214         orig_conv.is_owned = ptr_is_owned(orig);
51215         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51216         orig_conv.is_owned = false;
51217         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
51218         uint64_t ret_ref = 0;
51219         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51220         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51221         return ret_ref;
51222 }
51223
51224 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_hash"))) TS_AnnouncementSignatures_hash(uint64_t o) {
51225         LDKAnnouncementSignatures o_conv;
51226         o_conv.inner = untag_ptr(o);
51227         o_conv.is_owned = ptr_is_owned(o);
51228         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51229         o_conv.is_owned = false;
51230         int64_t ret_conv = AnnouncementSignatures_hash(&o_conv);
51231         return ret_conv;
51232 }
51233
51234 jboolean  __attribute__((export_name("TS_AnnouncementSignatures_eq"))) TS_AnnouncementSignatures_eq(uint64_t a, uint64_t b) {
51235         LDKAnnouncementSignatures a_conv;
51236         a_conv.inner = untag_ptr(a);
51237         a_conv.is_owned = ptr_is_owned(a);
51238         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51239         a_conv.is_owned = false;
51240         LDKAnnouncementSignatures b_conv;
51241         b_conv.inner = untag_ptr(b);
51242         b_conv.is_owned = ptr_is_owned(b);
51243         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51244         b_conv.is_owned = false;
51245         jboolean ret_conv = AnnouncementSignatures_eq(&a_conv, &b_conv);
51246         return ret_conv;
51247 }
51248
51249 void  __attribute__((export_name("TS_SocketAddress_free"))) TS_SocketAddress_free(uint64_t this_ptr) {
51250         if (!ptr_is_owned(this_ptr)) return;
51251         void* this_ptr_ptr = untag_ptr(this_ptr);
51252         CHECK_ACCESS(this_ptr_ptr);
51253         LDKSocketAddress this_ptr_conv = *(LDKSocketAddress*)(this_ptr_ptr);
51254         FREE(untag_ptr(this_ptr));
51255         SocketAddress_free(this_ptr_conv);
51256 }
51257
51258 static inline uint64_t SocketAddress_clone_ptr(LDKSocketAddress *NONNULL_PTR arg) {
51259         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
51260         *ret_copy = SocketAddress_clone(arg);
51261         uint64_t ret_ref = tag_ptr(ret_copy, true);
51262         return ret_ref;
51263 }
51264 int64_t  __attribute__((export_name("TS_SocketAddress_clone_ptr"))) TS_SocketAddress_clone_ptr(uint64_t arg) {
51265         LDKSocketAddress* arg_conv = (LDKSocketAddress*)untag_ptr(arg);
51266         int64_t ret_conv = SocketAddress_clone_ptr(arg_conv);
51267         return ret_conv;
51268 }
51269
51270 uint64_t  __attribute__((export_name("TS_SocketAddress_clone"))) TS_SocketAddress_clone(uint64_t orig) {
51271         LDKSocketAddress* orig_conv = (LDKSocketAddress*)untag_ptr(orig);
51272         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
51273         *ret_copy = SocketAddress_clone(orig_conv);
51274         uint64_t ret_ref = tag_ptr(ret_copy, true);
51275         return ret_ref;
51276 }
51277
51278 uint64_t  __attribute__((export_name("TS_SocketAddress_tcp_ip_v4"))) TS_SocketAddress_tcp_ip_v4(int8_tArray addr, int16_t port) {
51279         LDKFourBytes addr_ref;
51280         CHECK(addr->arr_len == 4);
51281         memcpy(addr_ref.data, addr->elems, 4); FREE(addr);
51282         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
51283         *ret_copy = SocketAddress_tcp_ip_v4(addr_ref, port);
51284         uint64_t ret_ref = tag_ptr(ret_copy, true);
51285         return ret_ref;
51286 }
51287
51288 uint64_t  __attribute__((export_name("TS_SocketAddress_tcp_ip_v6"))) TS_SocketAddress_tcp_ip_v6(int8_tArray addr, int16_t port) {
51289         LDKSixteenBytes addr_ref;
51290         CHECK(addr->arr_len == 16);
51291         memcpy(addr_ref.data, addr->elems, 16); FREE(addr);
51292         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
51293         *ret_copy = SocketAddress_tcp_ip_v6(addr_ref, port);
51294         uint64_t ret_ref = tag_ptr(ret_copy, true);
51295         return ret_ref;
51296 }
51297
51298 uint64_t  __attribute__((export_name("TS_SocketAddress_onion_v2"))) TS_SocketAddress_onion_v2(int8_tArray a) {
51299         LDKTwelveBytes a_ref;
51300         CHECK(a->arr_len == 12);
51301         memcpy(a_ref.data, a->elems, 12); FREE(a);
51302         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
51303         *ret_copy = SocketAddress_onion_v2(a_ref);
51304         uint64_t ret_ref = tag_ptr(ret_copy, true);
51305         return ret_ref;
51306 }
51307
51308 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) {
51309         LDKThirtyTwoBytes ed25519_pubkey_ref;
51310         CHECK(ed25519_pubkey->arr_len == 32);
51311         memcpy(ed25519_pubkey_ref.data, ed25519_pubkey->elems, 32); FREE(ed25519_pubkey);
51312         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
51313         *ret_copy = SocketAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
51314         uint64_t ret_ref = tag_ptr(ret_copy, true);
51315         return ret_ref;
51316 }
51317
51318 uint64_t  __attribute__((export_name("TS_SocketAddress_hostname"))) TS_SocketAddress_hostname(uint64_t hostname, int16_t port) {
51319         LDKHostname hostname_conv;
51320         hostname_conv.inner = untag_ptr(hostname);
51321         hostname_conv.is_owned = ptr_is_owned(hostname);
51322         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_conv);
51323         hostname_conv = Hostname_clone(&hostname_conv);
51324         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
51325         *ret_copy = SocketAddress_hostname(hostname_conv, port);
51326         uint64_t ret_ref = tag_ptr(ret_copy, true);
51327         return ret_ref;
51328 }
51329
51330 int64_t  __attribute__((export_name("TS_SocketAddress_hash"))) TS_SocketAddress_hash(uint64_t o) {
51331         LDKSocketAddress* o_conv = (LDKSocketAddress*)untag_ptr(o);
51332         int64_t ret_conv = SocketAddress_hash(o_conv);
51333         return ret_conv;
51334 }
51335
51336 jboolean  __attribute__((export_name("TS_SocketAddress_eq"))) TS_SocketAddress_eq(uint64_t a, uint64_t b) {
51337         LDKSocketAddress* a_conv = (LDKSocketAddress*)untag_ptr(a);
51338         LDKSocketAddress* b_conv = (LDKSocketAddress*)untag_ptr(b);
51339         jboolean ret_conv = SocketAddress_eq(a_conv, b_conv);
51340         return ret_conv;
51341 }
51342
51343 int8_tArray  __attribute__((export_name("TS_SocketAddress_write"))) TS_SocketAddress_write(uint64_t obj) {
51344         LDKSocketAddress* obj_conv = (LDKSocketAddress*)untag_ptr(obj);
51345         LDKCVec_u8Z ret_var = SocketAddress_write(obj_conv);
51346         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51347         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51348         CVec_u8Z_free(ret_var);
51349         return ret_arr;
51350 }
51351
51352 uint64_t  __attribute__((export_name("TS_SocketAddress_read"))) TS_SocketAddress_read(int8_tArray ser) {
51353         LDKu8slice ser_ref;
51354         ser_ref.datalen = ser->arr_len;
51355         ser_ref.data = ser->elems;
51356         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
51357         *ret_conv = SocketAddress_read(ser_ref);
51358         FREE(ser);
51359         return tag_ptr(ret_conv, true);
51360 }
51361
51362 uint32_t  __attribute__((export_name("TS_SocketAddressParseError_clone"))) TS_SocketAddressParseError_clone(uint64_t orig) {
51363         LDKSocketAddressParseError* orig_conv = (LDKSocketAddressParseError*)untag_ptr(orig);
51364         uint32_t ret_conv = LDKSocketAddressParseError_to_js(SocketAddressParseError_clone(orig_conv));
51365         return ret_conv;
51366 }
51367
51368 uint32_t  __attribute__((export_name("TS_SocketAddressParseError_socket_addr_parse"))) TS_SocketAddressParseError_socket_addr_parse() {
51369         uint32_t ret_conv = LDKSocketAddressParseError_to_js(SocketAddressParseError_socket_addr_parse());
51370         return ret_conv;
51371 }
51372
51373 uint32_t  __attribute__((export_name("TS_SocketAddressParseError_invalid_input"))) TS_SocketAddressParseError_invalid_input() {
51374         uint32_t ret_conv = LDKSocketAddressParseError_to_js(SocketAddressParseError_invalid_input());
51375         return ret_conv;
51376 }
51377
51378 uint32_t  __attribute__((export_name("TS_SocketAddressParseError_invalid_port"))) TS_SocketAddressParseError_invalid_port() {
51379         uint32_t ret_conv = LDKSocketAddressParseError_to_js(SocketAddressParseError_invalid_port());
51380         return ret_conv;
51381 }
51382
51383 uint32_t  __attribute__((export_name("TS_SocketAddressParseError_invalid_onion_v3"))) TS_SocketAddressParseError_invalid_onion_v3() {
51384         uint32_t ret_conv = LDKSocketAddressParseError_to_js(SocketAddressParseError_invalid_onion_v3());
51385         return ret_conv;
51386 }
51387
51388 int64_t  __attribute__((export_name("TS_SocketAddressParseError_hash"))) TS_SocketAddressParseError_hash(uint64_t o) {
51389         LDKSocketAddressParseError* o_conv = (LDKSocketAddressParseError*)untag_ptr(o);
51390         int64_t ret_conv = SocketAddressParseError_hash(o_conv);
51391         return ret_conv;
51392 }
51393
51394 jboolean  __attribute__((export_name("TS_SocketAddressParseError_eq"))) TS_SocketAddressParseError_eq(uint64_t a, uint64_t b) {
51395         LDKSocketAddressParseError* a_conv = (LDKSocketAddressParseError*)untag_ptr(a);
51396         LDKSocketAddressParseError* b_conv = (LDKSocketAddressParseError*)untag_ptr(b);
51397         jboolean ret_conv = SocketAddressParseError_eq(a_conv, b_conv);
51398         return ret_conv;
51399 }
51400
51401 uint64_t  __attribute__((export_name("TS_parse_onion_address"))) TS_parse_onion_address(jstring host, int16_t port) {
51402         LDKStr host_conv = str_ref_to_owned_c(host);
51403         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
51404         *ret_conv = parse_onion_address(host_conv, port);
51405         return tag_ptr(ret_conv, true);
51406 }
51407
51408 jstring  __attribute__((export_name("TS_SocketAddress_to_str"))) TS_SocketAddress_to_str(uint64_t o) {
51409         LDKSocketAddress* o_conv = (LDKSocketAddress*)untag_ptr(o);
51410         LDKStr ret_str = SocketAddress_to_str(o_conv);
51411         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
51412         Str_free(ret_str);
51413         return ret_conv;
51414 }
51415
51416 void  __attribute__((export_name("TS_UnsignedGossipMessage_free"))) TS_UnsignedGossipMessage_free(uint64_t this_ptr) {
51417         if (!ptr_is_owned(this_ptr)) return;
51418         void* this_ptr_ptr = untag_ptr(this_ptr);
51419         CHECK_ACCESS(this_ptr_ptr);
51420         LDKUnsignedGossipMessage this_ptr_conv = *(LDKUnsignedGossipMessage*)(this_ptr_ptr);
51421         FREE(untag_ptr(this_ptr));
51422         UnsignedGossipMessage_free(this_ptr_conv);
51423 }
51424
51425 static inline uint64_t UnsignedGossipMessage_clone_ptr(LDKUnsignedGossipMessage *NONNULL_PTR arg) {
51426         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
51427         *ret_copy = UnsignedGossipMessage_clone(arg);
51428         uint64_t ret_ref = tag_ptr(ret_copy, true);
51429         return ret_ref;
51430 }
51431 int64_t  __attribute__((export_name("TS_UnsignedGossipMessage_clone_ptr"))) TS_UnsignedGossipMessage_clone_ptr(uint64_t arg) {
51432         LDKUnsignedGossipMessage* arg_conv = (LDKUnsignedGossipMessage*)untag_ptr(arg);
51433         int64_t ret_conv = UnsignedGossipMessage_clone_ptr(arg_conv);
51434         return ret_conv;
51435 }
51436
51437 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_clone"))) TS_UnsignedGossipMessage_clone(uint64_t orig) {
51438         LDKUnsignedGossipMessage* orig_conv = (LDKUnsignedGossipMessage*)untag_ptr(orig);
51439         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
51440         *ret_copy = UnsignedGossipMessage_clone(orig_conv);
51441         uint64_t ret_ref = tag_ptr(ret_copy, true);
51442         return ret_ref;
51443 }
51444
51445 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_channel_announcement"))) TS_UnsignedGossipMessage_channel_announcement(uint64_t a) {
51446         LDKUnsignedChannelAnnouncement a_conv;
51447         a_conv.inner = untag_ptr(a);
51448         a_conv.is_owned = ptr_is_owned(a);
51449         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51450         a_conv = UnsignedChannelAnnouncement_clone(&a_conv);
51451         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
51452         *ret_copy = UnsignedGossipMessage_channel_announcement(a_conv);
51453         uint64_t ret_ref = tag_ptr(ret_copy, true);
51454         return ret_ref;
51455 }
51456
51457 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_channel_update"))) TS_UnsignedGossipMessage_channel_update(uint64_t a) {
51458         LDKUnsignedChannelUpdate a_conv;
51459         a_conv.inner = untag_ptr(a);
51460         a_conv.is_owned = ptr_is_owned(a);
51461         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51462         a_conv = UnsignedChannelUpdate_clone(&a_conv);
51463         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
51464         *ret_copy = UnsignedGossipMessage_channel_update(a_conv);
51465         uint64_t ret_ref = tag_ptr(ret_copy, true);
51466         return ret_ref;
51467 }
51468
51469 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_node_announcement"))) TS_UnsignedGossipMessage_node_announcement(uint64_t a) {
51470         LDKUnsignedNodeAnnouncement a_conv;
51471         a_conv.inner = untag_ptr(a);
51472         a_conv.is_owned = ptr_is_owned(a);
51473         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51474         a_conv = UnsignedNodeAnnouncement_clone(&a_conv);
51475         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
51476         *ret_copy = UnsignedGossipMessage_node_announcement(a_conv);
51477         uint64_t ret_ref = tag_ptr(ret_copy, true);
51478         return ret_ref;
51479 }
51480
51481 int8_tArray  __attribute__((export_name("TS_UnsignedGossipMessage_write"))) TS_UnsignedGossipMessage_write(uint64_t obj) {
51482         LDKUnsignedGossipMessage* obj_conv = (LDKUnsignedGossipMessage*)untag_ptr(obj);
51483         LDKCVec_u8Z ret_var = UnsignedGossipMessage_write(obj_conv);
51484         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51485         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51486         CVec_u8Z_free(ret_var);
51487         return ret_arr;
51488 }
51489
51490 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_free"))) TS_UnsignedNodeAnnouncement_free(uint64_t this_obj) {
51491         LDKUnsignedNodeAnnouncement this_obj_conv;
51492         this_obj_conv.inner = untag_ptr(this_obj);
51493         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51495         UnsignedNodeAnnouncement_free(this_obj_conv);
51496 }
51497
51498 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_features"))) TS_UnsignedNodeAnnouncement_get_features(uint64_t this_ptr) {
51499         LDKUnsignedNodeAnnouncement this_ptr_conv;
51500         this_ptr_conv.inner = untag_ptr(this_ptr);
51501         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51503         this_ptr_conv.is_owned = false;
51504         LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
51505         uint64_t ret_ref = 0;
51506         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51507         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51508         return ret_ref;
51509 }
51510
51511 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_features"))) TS_UnsignedNodeAnnouncement_set_features(uint64_t this_ptr, uint64_t val) {
51512         LDKUnsignedNodeAnnouncement this_ptr_conv;
51513         this_ptr_conv.inner = untag_ptr(this_ptr);
51514         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51516         this_ptr_conv.is_owned = false;
51517         LDKNodeFeatures val_conv;
51518         val_conv.inner = untag_ptr(val);
51519         val_conv.is_owned = ptr_is_owned(val);
51520         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51521         val_conv = NodeFeatures_clone(&val_conv);
51522         UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
51523 }
51524
51525 int32_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_timestamp"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint64_t this_ptr) {
51526         LDKUnsignedNodeAnnouncement this_ptr_conv;
51527         this_ptr_conv.inner = untag_ptr(this_ptr);
51528         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51530         this_ptr_conv.is_owned = false;
51531         int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
51532         return ret_conv;
51533 }
51534
51535 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_timestamp"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint64_t this_ptr, int32_t val) {
51536         LDKUnsignedNodeAnnouncement this_ptr_conv;
51537         this_ptr_conv.inner = untag_ptr(this_ptr);
51538         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51540         this_ptr_conv.is_owned = false;
51541         UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
51542 }
51543
51544 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_node_id"))) TS_UnsignedNodeAnnouncement_get_node_id(uint64_t this_ptr) {
51545         LDKUnsignedNodeAnnouncement this_ptr_conv;
51546         this_ptr_conv.inner = untag_ptr(this_ptr);
51547         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51549         this_ptr_conv.is_owned = false;
51550         LDKNodeId ret_var = UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv);
51551         uint64_t ret_ref = 0;
51552         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51553         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51554         return ret_ref;
51555 }
51556
51557 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_node_id"))) TS_UnsignedNodeAnnouncement_set_node_id(uint64_t this_ptr, uint64_t val) {
51558         LDKUnsignedNodeAnnouncement this_ptr_conv;
51559         this_ptr_conv.inner = untag_ptr(this_ptr);
51560         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51562         this_ptr_conv.is_owned = false;
51563         LDKNodeId val_conv;
51564         val_conv.inner = untag_ptr(val);
51565         val_conv.is_owned = ptr_is_owned(val);
51566         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51567         val_conv = NodeId_clone(&val_conv);
51568         UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_conv);
51569 }
51570
51571 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_rgb"))) TS_UnsignedNodeAnnouncement_get_rgb(uint64_t this_ptr) {
51572         LDKUnsignedNodeAnnouncement this_ptr_conv;
51573         this_ptr_conv.inner = untag_ptr(this_ptr);
51574         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51576         this_ptr_conv.is_owned = false;
51577         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
51578         memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
51579         return ret_arr;
51580 }
51581
51582 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_rgb"))) TS_UnsignedNodeAnnouncement_set_rgb(uint64_t this_ptr, int8_tArray val) {
51583         LDKUnsignedNodeAnnouncement this_ptr_conv;
51584         this_ptr_conv.inner = untag_ptr(this_ptr);
51585         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51587         this_ptr_conv.is_owned = false;
51588         LDKThreeBytes val_ref;
51589         CHECK(val->arr_len == 3);
51590         memcpy(val_ref.data, val->elems, 3); FREE(val);
51591         UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
51592 }
51593
51594 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_alias"))) TS_UnsignedNodeAnnouncement_get_alias(uint64_t this_ptr) {
51595         LDKUnsignedNodeAnnouncement this_ptr_conv;
51596         this_ptr_conv.inner = untag_ptr(this_ptr);
51597         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51599         this_ptr_conv.is_owned = false;
51600         LDKNodeAlias ret_var = UnsignedNodeAnnouncement_get_alias(&this_ptr_conv);
51601         uint64_t ret_ref = 0;
51602         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51603         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51604         return ret_ref;
51605 }
51606
51607 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_alias"))) TS_UnsignedNodeAnnouncement_set_alias(uint64_t this_ptr, uint64_t val) {
51608         LDKUnsignedNodeAnnouncement this_ptr_conv;
51609         this_ptr_conv.inner = untag_ptr(this_ptr);
51610         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51612         this_ptr_conv.is_owned = false;
51613         LDKNodeAlias val_conv;
51614         val_conv.inner = untag_ptr(val);
51615         val_conv.is_owned = ptr_is_owned(val);
51616         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51617         val_conv = NodeAlias_clone(&val_conv);
51618         UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_conv);
51619 }
51620
51621 uint64_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_addresses"))) TS_UnsignedNodeAnnouncement_get_addresses(uint64_t this_ptr) {
51622         LDKUnsignedNodeAnnouncement 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         LDKCVec_SocketAddressZ ret_var = UnsignedNodeAnnouncement_get_addresses(&this_ptr_conv);
51628         uint64_tArray ret_arr = NULL;
51629         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
51630         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
51631         for (size_t p = 0; p < ret_var.datalen; p++) {
51632                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
51633                 *ret_conv_15_copy = ret_var.data[p];
51634                 uint64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
51635                 ret_arr_ptr[p] = ret_conv_15_ref;
51636         }
51637         
51638         FREE(ret_var.data);
51639         return ret_arr;
51640 }
51641
51642 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_addresses"))) TS_UnsignedNodeAnnouncement_set_addresses(uint64_t this_ptr, uint64_tArray val) {
51643         LDKUnsignedNodeAnnouncement this_ptr_conv;
51644         this_ptr_conv.inner = untag_ptr(this_ptr);
51645         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51647         this_ptr_conv.is_owned = false;
51648         LDKCVec_SocketAddressZ val_constr;
51649         val_constr.datalen = val->arr_len;
51650         if (val_constr.datalen > 0)
51651                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
51652         else
51653                 val_constr.data = NULL;
51654         uint64_t* val_vals = val->elems;
51655         for (size_t p = 0; p < val_constr.datalen; p++) {
51656                 uint64_t val_conv_15 = val_vals[p];
51657                 void* val_conv_15_ptr = untag_ptr(val_conv_15);
51658                 CHECK_ACCESS(val_conv_15_ptr);
51659                 LDKSocketAddress val_conv_15_conv = *(LDKSocketAddress*)(val_conv_15_ptr);
51660                 val_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(val_conv_15));
51661                 val_constr.data[p] = val_conv_15_conv;
51662         }
51663         FREE(val);
51664         UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
51665 }
51666
51667 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_excess_address_data"))) TS_UnsignedNodeAnnouncement_get_excess_address_data(uint64_t this_ptr) {
51668         LDKUnsignedNodeAnnouncement this_ptr_conv;
51669         this_ptr_conv.inner = untag_ptr(this_ptr);
51670         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51672         this_ptr_conv.is_owned = false;
51673         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_get_excess_address_data(&this_ptr_conv);
51674         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51675         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51676         CVec_u8Z_free(ret_var);
51677         return ret_arr;
51678 }
51679
51680 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_excess_address_data"))) TS_UnsignedNodeAnnouncement_set_excess_address_data(uint64_t this_ptr, int8_tArray val) {
51681         LDKUnsignedNodeAnnouncement this_ptr_conv;
51682         this_ptr_conv.inner = untag_ptr(this_ptr);
51683         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51685         this_ptr_conv.is_owned = false;
51686         LDKCVec_u8Z val_ref;
51687         val_ref.datalen = val->arr_len;
51688         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
51689         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
51690         UnsignedNodeAnnouncement_set_excess_address_data(&this_ptr_conv, val_ref);
51691 }
51692
51693 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_excess_data"))) TS_UnsignedNodeAnnouncement_get_excess_data(uint64_t this_ptr) {
51694         LDKUnsignedNodeAnnouncement this_ptr_conv;
51695         this_ptr_conv.inner = untag_ptr(this_ptr);
51696         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51698         this_ptr_conv.is_owned = false;
51699         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_get_excess_data(&this_ptr_conv);
51700         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51701         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51702         CVec_u8Z_free(ret_var);
51703         return ret_arr;
51704 }
51705
51706 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_excess_data"))) TS_UnsignedNodeAnnouncement_set_excess_data(uint64_t this_ptr, int8_tArray val) {
51707         LDKUnsignedNodeAnnouncement this_ptr_conv;
51708         this_ptr_conv.inner = untag_ptr(this_ptr);
51709         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51711         this_ptr_conv.is_owned = false;
51712         LDKCVec_u8Z val_ref;
51713         val_ref.datalen = val->arr_len;
51714         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
51715         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
51716         UnsignedNodeAnnouncement_set_excess_data(&this_ptr_conv, val_ref);
51717 }
51718
51719 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) {
51720         LDKNodeFeatures features_arg_conv;
51721         features_arg_conv.inner = untag_ptr(features_arg);
51722         features_arg_conv.is_owned = ptr_is_owned(features_arg);
51723         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
51724         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
51725         LDKNodeId node_id_arg_conv;
51726         node_id_arg_conv.inner = untag_ptr(node_id_arg);
51727         node_id_arg_conv.is_owned = ptr_is_owned(node_id_arg);
51728         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_arg_conv);
51729         node_id_arg_conv = NodeId_clone(&node_id_arg_conv);
51730         LDKThreeBytes rgb_arg_ref;
51731         CHECK(rgb_arg->arr_len == 3);
51732         memcpy(rgb_arg_ref.data, rgb_arg->elems, 3); FREE(rgb_arg);
51733         LDKNodeAlias alias_arg_conv;
51734         alias_arg_conv.inner = untag_ptr(alias_arg);
51735         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
51736         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
51737         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
51738         LDKCVec_SocketAddressZ addresses_arg_constr;
51739         addresses_arg_constr.datalen = addresses_arg->arr_len;
51740         if (addresses_arg_constr.datalen > 0)
51741                 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
51742         else
51743                 addresses_arg_constr.data = NULL;
51744         uint64_t* addresses_arg_vals = addresses_arg->elems;
51745         for (size_t p = 0; p < addresses_arg_constr.datalen; p++) {
51746                 uint64_t addresses_arg_conv_15 = addresses_arg_vals[p];
51747                 void* addresses_arg_conv_15_ptr = untag_ptr(addresses_arg_conv_15);
51748                 CHECK_ACCESS(addresses_arg_conv_15_ptr);
51749                 LDKSocketAddress addresses_arg_conv_15_conv = *(LDKSocketAddress*)(addresses_arg_conv_15_ptr);
51750                 addresses_arg_constr.data[p] = addresses_arg_conv_15_conv;
51751         }
51752         FREE(addresses_arg);
51753         LDKCVec_u8Z excess_address_data_arg_ref;
51754         excess_address_data_arg_ref.datalen = excess_address_data_arg->arr_len;
51755         excess_address_data_arg_ref.data = MALLOC(excess_address_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
51756         memcpy(excess_address_data_arg_ref.data, excess_address_data_arg->elems, excess_address_data_arg_ref.datalen); FREE(excess_address_data_arg);
51757         LDKCVec_u8Z excess_data_arg_ref;
51758         excess_data_arg_ref.datalen = excess_data_arg->arr_len;
51759         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
51760         memcpy(excess_data_arg_ref.data, excess_data_arg->elems, excess_data_arg_ref.datalen); FREE(excess_data_arg);
51761         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);
51762         uint64_t ret_ref = 0;
51763         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51764         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51765         return ret_ref;
51766 }
51767
51768 static inline uint64_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
51769         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
51770         uint64_t ret_ref = 0;
51771         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51772         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51773         return ret_ref;
51774 }
51775 int64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone_ptr"))) TS_UnsignedNodeAnnouncement_clone_ptr(uint64_t arg) {
51776         LDKUnsignedNodeAnnouncement arg_conv;
51777         arg_conv.inner = untag_ptr(arg);
51778         arg_conv.is_owned = ptr_is_owned(arg);
51779         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51780         arg_conv.is_owned = false;
51781         int64_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
51782         return ret_conv;
51783 }
51784
51785 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone"))) TS_UnsignedNodeAnnouncement_clone(uint64_t orig) {
51786         LDKUnsignedNodeAnnouncement orig_conv;
51787         orig_conv.inner = untag_ptr(orig);
51788         orig_conv.is_owned = ptr_is_owned(orig);
51789         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51790         orig_conv.is_owned = false;
51791         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
51792         uint64_t ret_ref = 0;
51793         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51794         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51795         return ret_ref;
51796 }
51797
51798 int64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_hash"))) TS_UnsignedNodeAnnouncement_hash(uint64_t o) {
51799         LDKUnsignedNodeAnnouncement o_conv;
51800         o_conv.inner = untag_ptr(o);
51801         o_conv.is_owned = ptr_is_owned(o);
51802         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51803         o_conv.is_owned = false;
51804         int64_t ret_conv = UnsignedNodeAnnouncement_hash(&o_conv);
51805         return ret_conv;
51806 }
51807
51808 jboolean  __attribute__((export_name("TS_UnsignedNodeAnnouncement_eq"))) TS_UnsignedNodeAnnouncement_eq(uint64_t a, uint64_t b) {
51809         LDKUnsignedNodeAnnouncement a_conv;
51810         a_conv.inner = untag_ptr(a);
51811         a_conv.is_owned = ptr_is_owned(a);
51812         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51813         a_conv.is_owned = false;
51814         LDKUnsignedNodeAnnouncement b_conv;
51815         b_conv.inner = untag_ptr(b);
51816         b_conv.is_owned = ptr_is_owned(b);
51817         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51818         b_conv.is_owned = false;
51819         jboolean ret_conv = UnsignedNodeAnnouncement_eq(&a_conv, &b_conv);
51820         return ret_conv;
51821 }
51822
51823 void  __attribute__((export_name("TS_NodeAnnouncement_free"))) TS_NodeAnnouncement_free(uint64_t this_obj) {
51824         LDKNodeAnnouncement this_obj_conv;
51825         this_obj_conv.inner = untag_ptr(this_obj);
51826         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51828         NodeAnnouncement_free(this_obj_conv);
51829 }
51830
51831 int8_tArray  __attribute__((export_name("TS_NodeAnnouncement_get_signature"))) TS_NodeAnnouncement_get_signature(uint64_t this_ptr) {
51832         LDKNodeAnnouncement this_ptr_conv;
51833         this_ptr_conv.inner = untag_ptr(this_ptr);
51834         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51836         this_ptr_conv.is_owned = false;
51837         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
51838         memcpy(ret_arr->elems, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
51839         return ret_arr;
51840 }
51841
51842 void  __attribute__((export_name("TS_NodeAnnouncement_set_signature"))) TS_NodeAnnouncement_set_signature(uint64_t this_ptr, int8_tArray val) {
51843         LDKNodeAnnouncement this_ptr_conv;
51844         this_ptr_conv.inner = untag_ptr(this_ptr);
51845         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51847         this_ptr_conv.is_owned = false;
51848         LDKECDSASignature val_ref;
51849         CHECK(val->arr_len == 64);
51850         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
51851         NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
51852 }
51853
51854 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_get_contents"))) TS_NodeAnnouncement_get_contents(uint64_t this_ptr) {
51855         LDKNodeAnnouncement this_ptr_conv;
51856         this_ptr_conv.inner = untag_ptr(this_ptr);
51857         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51859         this_ptr_conv.is_owned = false;
51860         LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_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 void  __attribute__((export_name("TS_NodeAnnouncement_set_contents"))) TS_NodeAnnouncement_set_contents(uint64_t this_ptr, uint64_t val) {
51868         LDKNodeAnnouncement this_ptr_conv;
51869         this_ptr_conv.inner = untag_ptr(this_ptr);
51870         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51872         this_ptr_conv.is_owned = false;
51873         LDKUnsignedNodeAnnouncement val_conv;
51874         val_conv.inner = untag_ptr(val);
51875         val_conv.is_owned = ptr_is_owned(val);
51876         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51877         val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
51878         NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
51879 }
51880
51881 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_new"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint64_t contents_arg) {
51882         LDKECDSASignature signature_arg_ref;
51883         CHECK(signature_arg->arr_len == 64);
51884         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
51885         LDKUnsignedNodeAnnouncement contents_arg_conv;
51886         contents_arg_conv.inner = untag_ptr(contents_arg);
51887         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
51888         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
51889         contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
51890         LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
51891         uint64_t ret_ref = 0;
51892         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51893         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51894         return ret_ref;
51895 }
51896
51897 static inline uint64_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
51898         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
51899         uint64_t ret_ref = 0;
51900         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51901         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51902         return ret_ref;
51903 }
51904 int64_t  __attribute__((export_name("TS_NodeAnnouncement_clone_ptr"))) TS_NodeAnnouncement_clone_ptr(uint64_t arg) {
51905         LDKNodeAnnouncement arg_conv;
51906         arg_conv.inner = untag_ptr(arg);
51907         arg_conv.is_owned = ptr_is_owned(arg);
51908         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51909         arg_conv.is_owned = false;
51910         int64_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
51911         return ret_conv;
51912 }
51913
51914 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_clone"))) TS_NodeAnnouncement_clone(uint64_t orig) {
51915         LDKNodeAnnouncement orig_conv;
51916         orig_conv.inner = untag_ptr(orig);
51917         orig_conv.is_owned = ptr_is_owned(orig);
51918         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51919         orig_conv.is_owned = false;
51920         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
51921         uint64_t ret_ref = 0;
51922         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51923         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51924         return ret_ref;
51925 }
51926
51927 int64_t  __attribute__((export_name("TS_NodeAnnouncement_hash"))) TS_NodeAnnouncement_hash(uint64_t o) {
51928         LDKNodeAnnouncement o_conv;
51929         o_conv.inner = untag_ptr(o);
51930         o_conv.is_owned = ptr_is_owned(o);
51931         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51932         o_conv.is_owned = false;
51933         int64_t ret_conv = NodeAnnouncement_hash(&o_conv);
51934         return ret_conv;
51935 }
51936
51937 jboolean  __attribute__((export_name("TS_NodeAnnouncement_eq"))) TS_NodeAnnouncement_eq(uint64_t a, uint64_t b) {
51938         LDKNodeAnnouncement a_conv;
51939         a_conv.inner = untag_ptr(a);
51940         a_conv.is_owned = ptr_is_owned(a);
51941         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51942         a_conv.is_owned = false;
51943         LDKNodeAnnouncement b_conv;
51944         b_conv.inner = untag_ptr(b);
51945         b_conv.is_owned = ptr_is_owned(b);
51946         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51947         b_conv.is_owned = false;
51948         jboolean ret_conv = NodeAnnouncement_eq(&a_conv, &b_conv);
51949         return ret_conv;
51950 }
51951
51952 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_free"))) TS_UnsignedChannelAnnouncement_free(uint64_t this_obj) {
51953         LDKUnsignedChannelAnnouncement this_obj_conv;
51954         this_obj_conv.inner = untag_ptr(this_obj);
51955         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51957         UnsignedChannelAnnouncement_free(this_obj_conv);
51958 }
51959
51960 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_features"))) TS_UnsignedChannelAnnouncement_get_features(uint64_t this_ptr) {
51961         LDKUnsignedChannelAnnouncement this_ptr_conv;
51962         this_ptr_conv.inner = untag_ptr(this_ptr);
51963         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51965         this_ptr_conv.is_owned = false;
51966         LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
51967         uint64_t ret_ref = 0;
51968         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51969         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51970         return ret_ref;
51971 }
51972
51973 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_features"))) TS_UnsignedChannelAnnouncement_set_features(uint64_t this_ptr, uint64_t val) {
51974         LDKUnsignedChannelAnnouncement this_ptr_conv;
51975         this_ptr_conv.inner = untag_ptr(this_ptr);
51976         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51978         this_ptr_conv.is_owned = false;
51979         LDKChannelFeatures val_conv;
51980         val_conv.inner = untag_ptr(val);
51981         val_conv.is_owned = ptr_is_owned(val);
51982         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51983         val_conv = ChannelFeatures_clone(&val_conv);
51984         UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
51985 }
51986
51987 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_chain_hash"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint64_t this_ptr) {
51988         LDKUnsignedChannelAnnouncement this_ptr_conv;
51989         this_ptr_conv.inner = untag_ptr(this_ptr);
51990         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51992         this_ptr_conv.is_owned = false;
51993         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
51994         memcpy(ret_arr->elems, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
51995         return ret_arr;
51996 }
51997
51998 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_chain_hash"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
51999         LDKUnsignedChannelAnnouncement this_ptr_conv;
52000         this_ptr_conv.inner = untag_ptr(this_ptr);
52001         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52003         this_ptr_conv.is_owned = false;
52004         LDKThirtyTwoBytes val_ref;
52005         CHECK(val->arr_len == 32);
52006         memcpy(val_ref.data, val->elems, 32); FREE(val);
52007         UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
52008 }
52009
52010 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_short_channel_id"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint64_t this_ptr) {
52011         LDKUnsignedChannelAnnouncement this_ptr_conv;
52012         this_ptr_conv.inner = untag_ptr(this_ptr);
52013         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52015         this_ptr_conv.is_owned = false;
52016         int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
52017         return ret_conv;
52018 }
52019
52020 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_short_channel_id"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint64_t this_ptr, int64_t val) {
52021         LDKUnsignedChannelAnnouncement this_ptr_conv;
52022         this_ptr_conv.inner = untag_ptr(this_ptr);
52023         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52025         this_ptr_conv.is_owned = false;
52026         UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
52027 }
52028
52029 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_1"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint64_t this_ptr) {
52030         LDKUnsignedChannelAnnouncement this_ptr_conv;
52031         this_ptr_conv.inner = untag_ptr(this_ptr);
52032         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52034         this_ptr_conv.is_owned = false;
52035         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv);
52036         uint64_t ret_ref = 0;
52037         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52038         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52039         return ret_ref;
52040 }
52041
52042 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_1"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint64_t this_ptr, uint64_t val) {
52043         LDKUnsignedChannelAnnouncement this_ptr_conv;
52044         this_ptr_conv.inner = untag_ptr(this_ptr);
52045         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52047         this_ptr_conv.is_owned = false;
52048         LDKNodeId val_conv;
52049         val_conv.inner = untag_ptr(val);
52050         val_conv.is_owned = ptr_is_owned(val);
52051         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52052         val_conv = NodeId_clone(&val_conv);
52053         UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_conv);
52054 }
52055
52056 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_2"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint64_t this_ptr) {
52057         LDKUnsignedChannelAnnouncement this_ptr_conv;
52058         this_ptr_conv.inner = untag_ptr(this_ptr);
52059         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52061         this_ptr_conv.is_owned = false;
52062         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv);
52063         uint64_t ret_ref = 0;
52064         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52065         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52066         return ret_ref;
52067 }
52068
52069 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_2"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint64_t this_ptr, uint64_t val) {
52070         LDKUnsignedChannelAnnouncement this_ptr_conv;
52071         this_ptr_conv.inner = untag_ptr(this_ptr);
52072         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52074         this_ptr_conv.is_owned = false;
52075         LDKNodeId val_conv;
52076         val_conv.inner = untag_ptr(val);
52077         val_conv.is_owned = ptr_is_owned(val);
52078         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52079         val_conv = NodeId_clone(&val_conv);
52080         UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_conv);
52081 }
52082
52083 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint64_t this_ptr) {
52084         LDKUnsignedChannelAnnouncement this_ptr_conv;
52085         this_ptr_conv.inner = untag_ptr(this_ptr);
52086         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52088         this_ptr_conv.is_owned = false;
52089         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv);
52090         uint64_t ret_ref = 0;
52091         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52092         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52093         return ret_ref;
52094 }
52095
52096 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint64_t this_ptr, uint64_t val) {
52097         LDKUnsignedChannelAnnouncement this_ptr_conv;
52098         this_ptr_conv.inner = untag_ptr(this_ptr);
52099         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52101         this_ptr_conv.is_owned = false;
52102         LDKNodeId val_conv;
52103         val_conv.inner = untag_ptr(val);
52104         val_conv.is_owned = ptr_is_owned(val);
52105         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52106         val_conv = NodeId_clone(&val_conv);
52107         UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_conv);
52108 }
52109
52110 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint64_t this_ptr) {
52111         LDKUnsignedChannelAnnouncement this_ptr_conv;
52112         this_ptr_conv.inner = untag_ptr(this_ptr);
52113         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52115         this_ptr_conv.is_owned = false;
52116         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv);
52117         uint64_t ret_ref = 0;
52118         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52119         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52120         return ret_ref;
52121 }
52122
52123 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint64_t this_ptr, uint64_t val) {
52124         LDKUnsignedChannelAnnouncement this_ptr_conv;
52125         this_ptr_conv.inner = untag_ptr(this_ptr);
52126         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52128         this_ptr_conv.is_owned = false;
52129         LDKNodeId val_conv;
52130         val_conv.inner = untag_ptr(val);
52131         val_conv.is_owned = ptr_is_owned(val);
52132         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52133         val_conv = NodeId_clone(&val_conv);
52134         UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_conv);
52135 }
52136
52137 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_excess_data"))) TS_UnsignedChannelAnnouncement_get_excess_data(uint64_t this_ptr) {
52138         LDKUnsignedChannelAnnouncement this_ptr_conv;
52139         this_ptr_conv.inner = untag_ptr(this_ptr);
52140         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52142         this_ptr_conv.is_owned = false;
52143         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_get_excess_data(&this_ptr_conv);
52144         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52145         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52146         CVec_u8Z_free(ret_var);
52147         return ret_arr;
52148 }
52149
52150 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_excess_data"))) TS_UnsignedChannelAnnouncement_set_excess_data(uint64_t this_ptr, int8_tArray val) {
52151         LDKUnsignedChannelAnnouncement this_ptr_conv;
52152         this_ptr_conv.inner = untag_ptr(this_ptr);
52153         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52155         this_ptr_conv.is_owned = false;
52156         LDKCVec_u8Z val_ref;
52157         val_ref.datalen = val->arr_len;
52158         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
52159         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
52160         UnsignedChannelAnnouncement_set_excess_data(&this_ptr_conv, val_ref);
52161 }
52162
52163 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) {
52164         LDKChannelFeatures features_arg_conv;
52165         features_arg_conv.inner = untag_ptr(features_arg);
52166         features_arg_conv.is_owned = ptr_is_owned(features_arg);
52167         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
52168         features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
52169         LDKThirtyTwoBytes chain_hash_arg_ref;
52170         CHECK(chain_hash_arg->arr_len == 32);
52171         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
52172         LDKNodeId node_id_1_arg_conv;
52173         node_id_1_arg_conv.inner = untag_ptr(node_id_1_arg);
52174         node_id_1_arg_conv.is_owned = ptr_is_owned(node_id_1_arg);
52175         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_1_arg_conv);
52176         node_id_1_arg_conv = NodeId_clone(&node_id_1_arg_conv);
52177         LDKNodeId node_id_2_arg_conv;
52178         node_id_2_arg_conv.inner = untag_ptr(node_id_2_arg);
52179         node_id_2_arg_conv.is_owned = ptr_is_owned(node_id_2_arg);
52180         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_2_arg_conv);
52181         node_id_2_arg_conv = NodeId_clone(&node_id_2_arg_conv);
52182         LDKNodeId bitcoin_key_1_arg_conv;
52183         bitcoin_key_1_arg_conv.inner = untag_ptr(bitcoin_key_1_arg);
52184         bitcoin_key_1_arg_conv.is_owned = ptr_is_owned(bitcoin_key_1_arg);
52185         CHECK_INNER_FIELD_ACCESS_OR_NULL(bitcoin_key_1_arg_conv);
52186         bitcoin_key_1_arg_conv = NodeId_clone(&bitcoin_key_1_arg_conv);
52187         LDKNodeId bitcoin_key_2_arg_conv;
52188         bitcoin_key_2_arg_conv.inner = untag_ptr(bitcoin_key_2_arg);
52189         bitcoin_key_2_arg_conv.is_owned = ptr_is_owned(bitcoin_key_2_arg);
52190         CHECK_INNER_FIELD_ACCESS_OR_NULL(bitcoin_key_2_arg_conv);
52191         bitcoin_key_2_arg_conv = NodeId_clone(&bitcoin_key_2_arg_conv);
52192         LDKCVec_u8Z excess_data_arg_ref;
52193         excess_data_arg_ref.datalen = excess_data_arg->arr_len;
52194         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
52195         memcpy(excess_data_arg_ref.data, excess_data_arg->elems, excess_data_arg_ref.datalen); FREE(excess_data_arg);
52196         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);
52197         uint64_t ret_ref = 0;
52198         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52199         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52200         return ret_ref;
52201 }
52202
52203 static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
52204         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
52205         uint64_t ret_ref = 0;
52206         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52207         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52208         return ret_ref;
52209 }
52210 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone_ptr"))) TS_UnsignedChannelAnnouncement_clone_ptr(uint64_t arg) {
52211         LDKUnsignedChannelAnnouncement arg_conv;
52212         arg_conv.inner = untag_ptr(arg);
52213         arg_conv.is_owned = ptr_is_owned(arg);
52214         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52215         arg_conv.is_owned = false;
52216         int64_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
52217         return ret_conv;
52218 }
52219
52220 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone"))) TS_UnsignedChannelAnnouncement_clone(uint64_t orig) {
52221         LDKUnsignedChannelAnnouncement orig_conv;
52222         orig_conv.inner = untag_ptr(orig);
52223         orig_conv.is_owned = ptr_is_owned(orig);
52224         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52225         orig_conv.is_owned = false;
52226         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
52227         uint64_t ret_ref = 0;
52228         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52229         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52230         return ret_ref;
52231 }
52232
52233 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_hash"))) TS_UnsignedChannelAnnouncement_hash(uint64_t o) {
52234         LDKUnsignedChannelAnnouncement o_conv;
52235         o_conv.inner = untag_ptr(o);
52236         o_conv.is_owned = ptr_is_owned(o);
52237         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52238         o_conv.is_owned = false;
52239         int64_t ret_conv = UnsignedChannelAnnouncement_hash(&o_conv);
52240         return ret_conv;
52241 }
52242
52243 jboolean  __attribute__((export_name("TS_UnsignedChannelAnnouncement_eq"))) TS_UnsignedChannelAnnouncement_eq(uint64_t a, uint64_t b) {
52244         LDKUnsignedChannelAnnouncement a_conv;
52245         a_conv.inner = untag_ptr(a);
52246         a_conv.is_owned = ptr_is_owned(a);
52247         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52248         a_conv.is_owned = false;
52249         LDKUnsignedChannelAnnouncement b_conv;
52250         b_conv.inner = untag_ptr(b);
52251         b_conv.is_owned = ptr_is_owned(b);
52252         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52253         b_conv.is_owned = false;
52254         jboolean ret_conv = UnsignedChannelAnnouncement_eq(&a_conv, &b_conv);
52255         return ret_conv;
52256 }
52257
52258 void  __attribute__((export_name("TS_ChannelAnnouncement_free"))) TS_ChannelAnnouncement_free(uint64_t this_obj) {
52259         LDKChannelAnnouncement this_obj_conv;
52260         this_obj_conv.inner = untag_ptr(this_obj);
52261         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52263         ChannelAnnouncement_free(this_obj_conv);
52264 }
52265
52266 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_1"))) TS_ChannelAnnouncement_get_node_signature_1(uint64_t this_ptr) {
52267         LDKChannelAnnouncement this_ptr_conv;
52268         this_ptr_conv.inner = untag_ptr(this_ptr);
52269         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52271         this_ptr_conv.is_owned = false;
52272         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
52273         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
52274         return ret_arr;
52275 }
52276
52277 void  __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_1"))) TS_ChannelAnnouncement_set_node_signature_1(uint64_t this_ptr, int8_tArray val) {
52278         LDKChannelAnnouncement this_ptr_conv;
52279         this_ptr_conv.inner = untag_ptr(this_ptr);
52280         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52282         this_ptr_conv.is_owned = false;
52283         LDKECDSASignature val_ref;
52284         CHECK(val->arr_len == 64);
52285         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
52286         ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
52287 }
52288
52289 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_2"))) TS_ChannelAnnouncement_get_node_signature_2(uint64_t this_ptr) {
52290         LDKChannelAnnouncement this_ptr_conv;
52291         this_ptr_conv.inner = untag_ptr(this_ptr);
52292         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52294         this_ptr_conv.is_owned = false;
52295         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
52296         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
52297         return ret_arr;
52298 }
52299
52300 void  __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_2"))) TS_ChannelAnnouncement_set_node_signature_2(uint64_t this_ptr, int8_tArray val) {
52301         LDKChannelAnnouncement 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         LDKECDSASignature val_ref;
52307         CHECK(val->arr_len == 64);
52308         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
52309         ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
52310 }
52311
52312 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_1"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint64_t this_ptr) {
52313         LDKChannelAnnouncement this_ptr_conv;
52314         this_ptr_conv.inner = untag_ptr(this_ptr);
52315         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52317         this_ptr_conv.is_owned = false;
52318         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
52319         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
52320         return ret_arr;
52321 }
52322
52323 void  __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_1"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint64_t this_ptr, int8_tArray val) {
52324         LDKChannelAnnouncement this_ptr_conv;
52325         this_ptr_conv.inner = untag_ptr(this_ptr);
52326         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52328         this_ptr_conv.is_owned = false;
52329         LDKECDSASignature val_ref;
52330         CHECK(val->arr_len == 64);
52331         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
52332         ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
52333 }
52334
52335 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_2"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint64_t this_ptr) {
52336         LDKChannelAnnouncement this_ptr_conv;
52337         this_ptr_conv.inner = untag_ptr(this_ptr);
52338         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52340         this_ptr_conv.is_owned = false;
52341         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
52342         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
52343         return ret_arr;
52344 }
52345
52346 void  __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_2"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint64_t this_ptr, int8_tArray val) {
52347         LDKChannelAnnouncement this_ptr_conv;
52348         this_ptr_conv.inner = untag_ptr(this_ptr);
52349         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52351         this_ptr_conv.is_owned = false;
52352         LDKECDSASignature val_ref;
52353         CHECK(val->arr_len == 64);
52354         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
52355         ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
52356 }
52357
52358 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_get_contents"))) TS_ChannelAnnouncement_get_contents(uint64_t this_ptr) {
52359         LDKChannelAnnouncement this_ptr_conv;
52360         this_ptr_conv.inner = untag_ptr(this_ptr);
52361         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52363         this_ptr_conv.is_owned = false;
52364         LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
52365         uint64_t ret_ref = 0;
52366         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52367         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52368         return ret_ref;
52369 }
52370
52371 void  __attribute__((export_name("TS_ChannelAnnouncement_set_contents"))) TS_ChannelAnnouncement_set_contents(uint64_t this_ptr, uint64_t val) {
52372         LDKChannelAnnouncement this_ptr_conv;
52373         this_ptr_conv.inner = untag_ptr(this_ptr);
52374         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52376         this_ptr_conv.is_owned = false;
52377         LDKUnsignedChannelAnnouncement val_conv;
52378         val_conv.inner = untag_ptr(val);
52379         val_conv.is_owned = ptr_is_owned(val);
52380         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52381         val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
52382         ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
52383 }
52384
52385 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) {
52386         LDKECDSASignature node_signature_1_arg_ref;
52387         CHECK(node_signature_1_arg->arr_len == 64);
52388         memcpy(node_signature_1_arg_ref.compact_form, node_signature_1_arg->elems, 64); FREE(node_signature_1_arg);
52389         LDKECDSASignature node_signature_2_arg_ref;
52390         CHECK(node_signature_2_arg->arr_len == 64);
52391         memcpy(node_signature_2_arg_ref.compact_form, node_signature_2_arg->elems, 64); FREE(node_signature_2_arg);
52392         LDKECDSASignature bitcoin_signature_1_arg_ref;
52393         CHECK(bitcoin_signature_1_arg->arr_len == 64);
52394         memcpy(bitcoin_signature_1_arg_ref.compact_form, bitcoin_signature_1_arg->elems, 64); FREE(bitcoin_signature_1_arg);
52395         LDKECDSASignature bitcoin_signature_2_arg_ref;
52396         CHECK(bitcoin_signature_2_arg->arr_len == 64);
52397         memcpy(bitcoin_signature_2_arg_ref.compact_form, bitcoin_signature_2_arg->elems, 64); FREE(bitcoin_signature_2_arg);
52398         LDKUnsignedChannelAnnouncement contents_arg_conv;
52399         contents_arg_conv.inner = untag_ptr(contents_arg);
52400         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
52401         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
52402         contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
52403         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);
52404         uint64_t ret_ref = 0;
52405         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52406         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52407         return ret_ref;
52408 }
52409
52410 static inline uint64_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
52411         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
52412         uint64_t ret_ref = 0;
52413         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52414         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52415         return ret_ref;
52416 }
52417 int64_t  __attribute__((export_name("TS_ChannelAnnouncement_clone_ptr"))) TS_ChannelAnnouncement_clone_ptr(uint64_t arg) {
52418         LDKChannelAnnouncement arg_conv;
52419         arg_conv.inner = untag_ptr(arg);
52420         arg_conv.is_owned = ptr_is_owned(arg);
52421         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52422         arg_conv.is_owned = false;
52423         int64_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
52424         return ret_conv;
52425 }
52426
52427 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_clone"))) TS_ChannelAnnouncement_clone(uint64_t orig) {
52428         LDKChannelAnnouncement orig_conv;
52429         orig_conv.inner = untag_ptr(orig);
52430         orig_conv.is_owned = ptr_is_owned(orig);
52431         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52432         orig_conv.is_owned = false;
52433         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
52434         uint64_t ret_ref = 0;
52435         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52436         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52437         return ret_ref;
52438 }
52439
52440 int64_t  __attribute__((export_name("TS_ChannelAnnouncement_hash"))) TS_ChannelAnnouncement_hash(uint64_t o) {
52441         LDKChannelAnnouncement o_conv;
52442         o_conv.inner = untag_ptr(o);
52443         o_conv.is_owned = ptr_is_owned(o);
52444         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52445         o_conv.is_owned = false;
52446         int64_t ret_conv = ChannelAnnouncement_hash(&o_conv);
52447         return ret_conv;
52448 }
52449
52450 jboolean  __attribute__((export_name("TS_ChannelAnnouncement_eq"))) TS_ChannelAnnouncement_eq(uint64_t a, uint64_t b) {
52451         LDKChannelAnnouncement a_conv;
52452         a_conv.inner = untag_ptr(a);
52453         a_conv.is_owned = ptr_is_owned(a);
52454         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52455         a_conv.is_owned = false;
52456         LDKChannelAnnouncement b_conv;
52457         b_conv.inner = untag_ptr(b);
52458         b_conv.is_owned = ptr_is_owned(b);
52459         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52460         b_conv.is_owned = false;
52461         jboolean ret_conv = ChannelAnnouncement_eq(&a_conv, &b_conv);
52462         return ret_conv;
52463 }
52464
52465 void  __attribute__((export_name("TS_UnsignedChannelUpdate_free"))) TS_UnsignedChannelUpdate_free(uint64_t this_obj) {
52466         LDKUnsignedChannelUpdate this_obj_conv;
52467         this_obj_conv.inner = untag_ptr(this_obj);
52468         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52470         UnsignedChannelUpdate_free(this_obj_conv);
52471 }
52472
52473 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_get_chain_hash"))) TS_UnsignedChannelUpdate_get_chain_hash(uint64_t this_ptr) {
52474         LDKUnsignedChannelUpdate this_ptr_conv;
52475         this_ptr_conv.inner = untag_ptr(this_ptr);
52476         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52478         this_ptr_conv.is_owned = false;
52479         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
52480         memcpy(ret_arr->elems, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
52481         return ret_arr;
52482 }
52483
52484 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_chain_hash"))) TS_UnsignedChannelUpdate_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
52485         LDKUnsignedChannelUpdate this_ptr_conv;
52486         this_ptr_conv.inner = untag_ptr(this_ptr);
52487         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52489         this_ptr_conv.is_owned = false;
52490         LDKThirtyTwoBytes val_ref;
52491         CHECK(val->arr_len == 32);
52492         memcpy(val_ref.data, val->elems, 32); FREE(val);
52493         UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
52494 }
52495
52496 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_short_channel_id"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint64_t this_ptr) {
52497         LDKUnsignedChannelUpdate this_ptr_conv;
52498         this_ptr_conv.inner = untag_ptr(this_ptr);
52499         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52501         this_ptr_conv.is_owned = false;
52502         int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
52503         return ret_conv;
52504 }
52505
52506 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_short_channel_id"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint64_t this_ptr, int64_t val) {
52507         LDKUnsignedChannelUpdate this_ptr_conv;
52508         this_ptr_conv.inner = untag_ptr(this_ptr);
52509         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52511         this_ptr_conv.is_owned = false;
52512         UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
52513 }
52514
52515 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_timestamp"))) TS_UnsignedChannelUpdate_get_timestamp(uint64_t this_ptr) {
52516         LDKUnsignedChannelUpdate this_ptr_conv;
52517         this_ptr_conv.inner = untag_ptr(this_ptr);
52518         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52520         this_ptr_conv.is_owned = false;
52521         int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
52522         return ret_conv;
52523 }
52524
52525 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_timestamp"))) TS_UnsignedChannelUpdate_set_timestamp(uint64_t this_ptr, int32_t val) {
52526         LDKUnsignedChannelUpdate this_ptr_conv;
52527         this_ptr_conv.inner = untag_ptr(this_ptr);
52528         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52530         this_ptr_conv.is_owned = false;
52531         UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
52532 }
52533
52534 int8_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_flags"))) TS_UnsignedChannelUpdate_get_flags(uint64_t this_ptr) {
52535         LDKUnsignedChannelUpdate this_ptr_conv;
52536         this_ptr_conv.inner = untag_ptr(this_ptr);
52537         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52539         this_ptr_conv.is_owned = false;
52540         int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
52541         return ret_conv;
52542 }
52543
52544 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_flags"))) TS_UnsignedChannelUpdate_set_flags(uint64_t this_ptr, int8_t val) {
52545         LDKUnsignedChannelUpdate this_ptr_conv;
52546         this_ptr_conv.inner = untag_ptr(this_ptr);
52547         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52549         this_ptr_conv.is_owned = false;
52550         UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
52551 }
52552
52553 int16_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint64_t this_ptr) {
52554         LDKUnsignedChannelUpdate this_ptr_conv;
52555         this_ptr_conv.inner = untag_ptr(this_ptr);
52556         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52558         this_ptr_conv.is_owned = false;
52559         int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
52560         return ret_conv;
52561 }
52562
52563 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
52564         LDKUnsignedChannelUpdate this_ptr_conv;
52565         this_ptr_conv.inner = untag_ptr(this_ptr);
52566         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52568         this_ptr_conv.is_owned = false;
52569         UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
52570 }
52571
52572 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint64_t this_ptr) {
52573         LDKUnsignedChannelUpdate this_ptr_conv;
52574         this_ptr_conv.inner = untag_ptr(this_ptr);
52575         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52577         this_ptr_conv.is_owned = false;
52578         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
52579         return ret_conv;
52580 }
52581
52582 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
52583         LDKUnsignedChannelUpdate this_ptr_conv;
52584         this_ptr_conv.inner = untag_ptr(this_ptr);
52585         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52587         this_ptr_conv.is_owned = false;
52588         UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
52589 }
52590
52591 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_maximum_msat"))) TS_UnsignedChannelUpdate_get_htlc_maximum_msat(uint64_t this_ptr) {
52592         LDKUnsignedChannelUpdate this_ptr_conv;
52593         this_ptr_conv.inner = untag_ptr(this_ptr);
52594         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52596         this_ptr_conv.is_owned = false;
52597         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_maximum_msat(&this_ptr_conv);
52598         return ret_conv;
52599 }
52600
52601 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_maximum_msat"))) TS_UnsignedChannelUpdate_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
52602         LDKUnsignedChannelUpdate this_ptr_conv;
52603         this_ptr_conv.inner = untag_ptr(this_ptr);
52604         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52606         this_ptr_conv.is_owned = false;
52607         UnsignedChannelUpdate_set_htlc_maximum_msat(&this_ptr_conv, val);
52608 }
52609
52610 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_base_msat"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint64_t this_ptr) {
52611         LDKUnsignedChannelUpdate this_ptr_conv;
52612         this_ptr_conv.inner = untag_ptr(this_ptr);
52613         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52615         this_ptr_conv.is_owned = false;
52616         int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
52617         return ret_conv;
52618 }
52619
52620 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_base_msat"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
52621         LDKUnsignedChannelUpdate this_ptr_conv;
52622         this_ptr_conv.inner = untag_ptr(this_ptr);
52623         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52625         this_ptr_conv.is_owned = false;
52626         UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
52627 }
52628
52629 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint64_t this_ptr) {
52630         LDKUnsignedChannelUpdate this_ptr_conv;
52631         this_ptr_conv.inner = untag_ptr(this_ptr);
52632         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52634         this_ptr_conv.is_owned = false;
52635         int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
52636         return ret_conv;
52637 }
52638
52639 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
52640         LDKUnsignedChannelUpdate this_ptr_conv;
52641         this_ptr_conv.inner = untag_ptr(this_ptr);
52642         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52644         this_ptr_conv.is_owned = false;
52645         UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
52646 }
52647
52648 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_get_excess_data"))) TS_UnsignedChannelUpdate_get_excess_data(uint64_t this_ptr) {
52649         LDKUnsignedChannelUpdate this_ptr_conv;
52650         this_ptr_conv.inner = untag_ptr(this_ptr);
52651         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52653         this_ptr_conv.is_owned = false;
52654         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_get_excess_data(&this_ptr_conv);
52655         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52656         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52657         CVec_u8Z_free(ret_var);
52658         return ret_arr;
52659 }
52660
52661 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_excess_data"))) TS_UnsignedChannelUpdate_set_excess_data(uint64_t this_ptr, int8_tArray val) {
52662         LDKUnsignedChannelUpdate this_ptr_conv;
52663         this_ptr_conv.inner = untag_ptr(this_ptr);
52664         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52666         this_ptr_conv.is_owned = false;
52667         LDKCVec_u8Z val_ref;
52668         val_ref.datalen = val->arr_len;
52669         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
52670         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
52671         UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
52672 }
52673
52674 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) {
52675         LDKThirtyTwoBytes chain_hash_arg_ref;
52676         CHECK(chain_hash_arg->arr_len == 32);
52677         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
52678         LDKCVec_u8Z excess_data_arg_ref;
52679         excess_data_arg_ref.datalen = excess_data_arg->arr_len;
52680         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
52681         memcpy(excess_data_arg_ref.data, excess_data_arg->elems, excess_data_arg_ref.datalen); FREE(excess_data_arg);
52682         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);
52683         uint64_t ret_ref = 0;
52684         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52685         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52686         return ret_ref;
52687 }
52688
52689 static inline uint64_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
52690         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
52691         uint64_t ret_ref = 0;
52692         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52693         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52694         return ret_ref;
52695 }
52696 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_clone_ptr"))) TS_UnsignedChannelUpdate_clone_ptr(uint64_t arg) {
52697         LDKUnsignedChannelUpdate arg_conv;
52698         arg_conv.inner = untag_ptr(arg);
52699         arg_conv.is_owned = ptr_is_owned(arg);
52700         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52701         arg_conv.is_owned = false;
52702         int64_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
52703         return ret_conv;
52704 }
52705
52706 uint64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_clone"))) TS_UnsignedChannelUpdate_clone(uint64_t orig) {
52707         LDKUnsignedChannelUpdate orig_conv;
52708         orig_conv.inner = untag_ptr(orig);
52709         orig_conv.is_owned = ptr_is_owned(orig);
52710         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52711         orig_conv.is_owned = false;
52712         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
52713         uint64_t ret_ref = 0;
52714         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52715         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52716         return ret_ref;
52717 }
52718
52719 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_hash"))) TS_UnsignedChannelUpdate_hash(uint64_t o) {
52720         LDKUnsignedChannelUpdate o_conv;
52721         o_conv.inner = untag_ptr(o);
52722         o_conv.is_owned = ptr_is_owned(o);
52723         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52724         o_conv.is_owned = false;
52725         int64_t ret_conv = UnsignedChannelUpdate_hash(&o_conv);
52726         return ret_conv;
52727 }
52728
52729 jboolean  __attribute__((export_name("TS_UnsignedChannelUpdate_eq"))) TS_UnsignedChannelUpdate_eq(uint64_t a, uint64_t b) {
52730         LDKUnsignedChannelUpdate a_conv;
52731         a_conv.inner = untag_ptr(a);
52732         a_conv.is_owned = ptr_is_owned(a);
52733         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52734         a_conv.is_owned = false;
52735         LDKUnsignedChannelUpdate b_conv;
52736         b_conv.inner = untag_ptr(b);
52737         b_conv.is_owned = ptr_is_owned(b);
52738         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52739         b_conv.is_owned = false;
52740         jboolean ret_conv = UnsignedChannelUpdate_eq(&a_conv, &b_conv);
52741         return ret_conv;
52742 }
52743
52744 void  __attribute__((export_name("TS_ChannelUpdate_free"))) TS_ChannelUpdate_free(uint64_t this_obj) {
52745         LDKChannelUpdate this_obj_conv;
52746         this_obj_conv.inner = untag_ptr(this_obj);
52747         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52749         ChannelUpdate_free(this_obj_conv);
52750 }
52751
52752 int8_tArray  __attribute__((export_name("TS_ChannelUpdate_get_signature"))) TS_ChannelUpdate_get_signature(uint64_t this_ptr) {
52753         LDKChannelUpdate this_ptr_conv;
52754         this_ptr_conv.inner = untag_ptr(this_ptr);
52755         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52757         this_ptr_conv.is_owned = false;
52758         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
52759         memcpy(ret_arr->elems, ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
52760         return ret_arr;
52761 }
52762
52763 void  __attribute__((export_name("TS_ChannelUpdate_set_signature"))) TS_ChannelUpdate_set_signature(uint64_t this_ptr, int8_tArray val) {
52764         LDKChannelUpdate this_ptr_conv;
52765         this_ptr_conv.inner = untag_ptr(this_ptr);
52766         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52768         this_ptr_conv.is_owned = false;
52769         LDKECDSASignature val_ref;
52770         CHECK(val->arr_len == 64);
52771         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
52772         ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
52773 }
52774
52775 uint64_t  __attribute__((export_name("TS_ChannelUpdate_get_contents"))) TS_ChannelUpdate_get_contents(uint64_t this_ptr) {
52776         LDKChannelUpdate this_ptr_conv;
52777         this_ptr_conv.inner = untag_ptr(this_ptr);
52778         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52780         this_ptr_conv.is_owned = false;
52781         LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
52782         uint64_t ret_ref = 0;
52783         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52784         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52785         return ret_ref;
52786 }
52787
52788 void  __attribute__((export_name("TS_ChannelUpdate_set_contents"))) TS_ChannelUpdate_set_contents(uint64_t this_ptr, uint64_t val) {
52789         LDKChannelUpdate this_ptr_conv;
52790         this_ptr_conv.inner = untag_ptr(this_ptr);
52791         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52793         this_ptr_conv.is_owned = false;
52794         LDKUnsignedChannelUpdate val_conv;
52795         val_conv.inner = untag_ptr(val);
52796         val_conv.is_owned = ptr_is_owned(val);
52797         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52798         val_conv = UnsignedChannelUpdate_clone(&val_conv);
52799         ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
52800 }
52801
52802 uint64_t  __attribute__((export_name("TS_ChannelUpdate_new"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint64_t contents_arg) {
52803         LDKECDSASignature signature_arg_ref;
52804         CHECK(signature_arg->arr_len == 64);
52805         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
52806         LDKUnsignedChannelUpdate contents_arg_conv;
52807         contents_arg_conv.inner = untag_ptr(contents_arg);
52808         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
52809         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
52810         contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
52811         LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
52812         uint64_t ret_ref = 0;
52813         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52814         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52815         return ret_ref;
52816 }
52817
52818 static inline uint64_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
52819         LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
52820         uint64_t ret_ref = 0;
52821         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52822         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52823         return ret_ref;
52824 }
52825 int64_t  __attribute__((export_name("TS_ChannelUpdate_clone_ptr"))) TS_ChannelUpdate_clone_ptr(uint64_t arg) {
52826         LDKChannelUpdate arg_conv;
52827         arg_conv.inner = untag_ptr(arg);
52828         arg_conv.is_owned = ptr_is_owned(arg);
52829         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52830         arg_conv.is_owned = false;
52831         int64_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
52832         return ret_conv;
52833 }
52834
52835 uint64_t  __attribute__((export_name("TS_ChannelUpdate_clone"))) TS_ChannelUpdate_clone(uint64_t orig) {
52836         LDKChannelUpdate orig_conv;
52837         orig_conv.inner = untag_ptr(orig);
52838         orig_conv.is_owned = ptr_is_owned(orig);
52839         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52840         orig_conv.is_owned = false;
52841         LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
52842         uint64_t ret_ref = 0;
52843         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52844         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52845         return ret_ref;
52846 }
52847
52848 int64_t  __attribute__((export_name("TS_ChannelUpdate_hash"))) TS_ChannelUpdate_hash(uint64_t o) {
52849         LDKChannelUpdate o_conv;
52850         o_conv.inner = untag_ptr(o);
52851         o_conv.is_owned = ptr_is_owned(o);
52852         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52853         o_conv.is_owned = false;
52854         int64_t ret_conv = ChannelUpdate_hash(&o_conv);
52855         return ret_conv;
52856 }
52857
52858 jboolean  __attribute__((export_name("TS_ChannelUpdate_eq"))) TS_ChannelUpdate_eq(uint64_t a, uint64_t b) {
52859         LDKChannelUpdate a_conv;
52860         a_conv.inner = untag_ptr(a);
52861         a_conv.is_owned = ptr_is_owned(a);
52862         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52863         a_conv.is_owned = false;
52864         LDKChannelUpdate b_conv;
52865         b_conv.inner = untag_ptr(b);
52866         b_conv.is_owned = ptr_is_owned(b);
52867         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52868         b_conv.is_owned = false;
52869         jboolean ret_conv = ChannelUpdate_eq(&a_conv, &b_conv);
52870         return ret_conv;
52871 }
52872
52873 void  __attribute__((export_name("TS_QueryChannelRange_free"))) TS_QueryChannelRange_free(uint64_t this_obj) {
52874         LDKQueryChannelRange this_obj_conv;
52875         this_obj_conv.inner = untag_ptr(this_obj);
52876         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52878         QueryChannelRange_free(this_obj_conv);
52879 }
52880
52881 int8_tArray  __attribute__((export_name("TS_QueryChannelRange_get_chain_hash"))) TS_QueryChannelRange_get_chain_hash(uint64_t this_ptr) {
52882         LDKQueryChannelRange 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         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
52888         memcpy(ret_arr->elems, *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
52889         return ret_arr;
52890 }
52891
52892 void  __attribute__((export_name("TS_QueryChannelRange_set_chain_hash"))) TS_QueryChannelRange_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
52893         LDKQueryChannelRange this_ptr_conv;
52894         this_ptr_conv.inner = untag_ptr(this_ptr);
52895         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52897         this_ptr_conv.is_owned = false;
52898         LDKThirtyTwoBytes val_ref;
52899         CHECK(val->arr_len == 32);
52900         memcpy(val_ref.data, val->elems, 32); FREE(val);
52901         QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
52902 }
52903
52904 int32_t  __attribute__((export_name("TS_QueryChannelRange_get_first_blocknum"))) TS_QueryChannelRange_get_first_blocknum(uint64_t this_ptr) {
52905         LDKQueryChannelRange this_ptr_conv;
52906         this_ptr_conv.inner = untag_ptr(this_ptr);
52907         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52909         this_ptr_conv.is_owned = false;
52910         int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
52911         return ret_conv;
52912 }
52913
52914 void  __attribute__((export_name("TS_QueryChannelRange_set_first_blocknum"))) TS_QueryChannelRange_set_first_blocknum(uint64_t this_ptr, int32_t val) {
52915         LDKQueryChannelRange this_ptr_conv;
52916         this_ptr_conv.inner = untag_ptr(this_ptr);
52917         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52919         this_ptr_conv.is_owned = false;
52920         QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
52921 }
52922
52923 int32_t  __attribute__((export_name("TS_QueryChannelRange_get_number_of_blocks"))) TS_QueryChannelRange_get_number_of_blocks(uint64_t this_ptr) {
52924         LDKQueryChannelRange this_ptr_conv;
52925         this_ptr_conv.inner = untag_ptr(this_ptr);
52926         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52928         this_ptr_conv.is_owned = false;
52929         int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
52930         return ret_conv;
52931 }
52932
52933 void  __attribute__((export_name("TS_QueryChannelRange_set_number_of_blocks"))) TS_QueryChannelRange_set_number_of_blocks(uint64_t this_ptr, int32_t val) {
52934         LDKQueryChannelRange this_ptr_conv;
52935         this_ptr_conv.inner = untag_ptr(this_ptr);
52936         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52938         this_ptr_conv.is_owned = false;
52939         QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
52940 }
52941
52942 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) {
52943         LDKThirtyTwoBytes chain_hash_arg_ref;
52944         CHECK(chain_hash_arg->arr_len == 32);
52945         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
52946         LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
52947         uint64_t ret_ref = 0;
52948         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52949         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52950         return ret_ref;
52951 }
52952
52953 static inline uint64_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
52954         LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
52955         uint64_t ret_ref = 0;
52956         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52957         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52958         return ret_ref;
52959 }
52960 int64_t  __attribute__((export_name("TS_QueryChannelRange_clone_ptr"))) TS_QueryChannelRange_clone_ptr(uint64_t arg) {
52961         LDKQueryChannelRange arg_conv;
52962         arg_conv.inner = untag_ptr(arg);
52963         arg_conv.is_owned = ptr_is_owned(arg);
52964         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52965         arg_conv.is_owned = false;
52966         int64_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
52967         return ret_conv;
52968 }
52969
52970 uint64_t  __attribute__((export_name("TS_QueryChannelRange_clone"))) TS_QueryChannelRange_clone(uint64_t orig) {
52971         LDKQueryChannelRange orig_conv;
52972         orig_conv.inner = untag_ptr(orig);
52973         orig_conv.is_owned = ptr_is_owned(orig);
52974         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52975         orig_conv.is_owned = false;
52976         LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
52977         uint64_t ret_ref = 0;
52978         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52979         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52980         return ret_ref;
52981 }
52982
52983 int64_t  __attribute__((export_name("TS_QueryChannelRange_hash"))) TS_QueryChannelRange_hash(uint64_t o) {
52984         LDKQueryChannelRange o_conv;
52985         o_conv.inner = untag_ptr(o);
52986         o_conv.is_owned = ptr_is_owned(o);
52987         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52988         o_conv.is_owned = false;
52989         int64_t ret_conv = QueryChannelRange_hash(&o_conv);
52990         return ret_conv;
52991 }
52992
52993 jboolean  __attribute__((export_name("TS_QueryChannelRange_eq"))) TS_QueryChannelRange_eq(uint64_t a, uint64_t b) {
52994         LDKQueryChannelRange a_conv;
52995         a_conv.inner = untag_ptr(a);
52996         a_conv.is_owned = ptr_is_owned(a);
52997         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52998         a_conv.is_owned = false;
52999         LDKQueryChannelRange b_conv;
53000         b_conv.inner = untag_ptr(b);
53001         b_conv.is_owned = ptr_is_owned(b);
53002         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53003         b_conv.is_owned = false;
53004         jboolean ret_conv = QueryChannelRange_eq(&a_conv, &b_conv);
53005         return ret_conv;
53006 }
53007
53008 void  __attribute__((export_name("TS_ReplyChannelRange_free"))) TS_ReplyChannelRange_free(uint64_t this_obj) {
53009         LDKReplyChannelRange this_obj_conv;
53010         this_obj_conv.inner = untag_ptr(this_obj);
53011         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53013         ReplyChannelRange_free(this_obj_conv);
53014 }
53015
53016 int8_tArray  __attribute__((export_name("TS_ReplyChannelRange_get_chain_hash"))) TS_ReplyChannelRange_get_chain_hash(uint64_t this_ptr) {
53017         LDKReplyChannelRange this_ptr_conv;
53018         this_ptr_conv.inner = untag_ptr(this_ptr);
53019         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53021         this_ptr_conv.is_owned = false;
53022         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
53023         memcpy(ret_arr->elems, *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
53024         return ret_arr;
53025 }
53026
53027 void  __attribute__((export_name("TS_ReplyChannelRange_set_chain_hash"))) TS_ReplyChannelRange_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
53028         LDKReplyChannelRange this_ptr_conv;
53029         this_ptr_conv.inner = untag_ptr(this_ptr);
53030         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53032         this_ptr_conv.is_owned = false;
53033         LDKThirtyTwoBytes val_ref;
53034         CHECK(val->arr_len == 32);
53035         memcpy(val_ref.data, val->elems, 32); FREE(val);
53036         ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
53037 }
53038
53039 int32_t  __attribute__((export_name("TS_ReplyChannelRange_get_first_blocknum"))) TS_ReplyChannelRange_get_first_blocknum(uint64_t this_ptr) {
53040         LDKReplyChannelRange this_ptr_conv;
53041         this_ptr_conv.inner = untag_ptr(this_ptr);
53042         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53044         this_ptr_conv.is_owned = false;
53045         int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
53046         return ret_conv;
53047 }
53048
53049 void  __attribute__((export_name("TS_ReplyChannelRange_set_first_blocknum"))) TS_ReplyChannelRange_set_first_blocknum(uint64_t this_ptr, int32_t val) {
53050         LDKReplyChannelRange this_ptr_conv;
53051         this_ptr_conv.inner = untag_ptr(this_ptr);
53052         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53054         this_ptr_conv.is_owned = false;
53055         ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
53056 }
53057
53058 int32_t  __attribute__((export_name("TS_ReplyChannelRange_get_number_of_blocks"))) TS_ReplyChannelRange_get_number_of_blocks(uint64_t this_ptr) {
53059         LDKReplyChannelRange this_ptr_conv;
53060         this_ptr_conv.inner = untag_ptr(this_ptr);
53061         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53063         this_ptr_conv.is_owned = false;
53064         int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
53065         return ret_conv;
53066 }
53067
53068 void  __attribute__((export_name("TS_ReplyChannelRange_set_number_of_blocks"))) TS_ReplyChannelRange_set_number_of_blocks(uint64_t this_ptr, int32_t val) {
53069         LDKReplyChannelRange this_ptr_conv;
53070         this_ptr_conv.inner = untag_ptr(this_ptr);
53071         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53073         this_ptr_conv.is_owned = false;
53074         ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
53075 }
53076
53077 jboolean  __attribute__((export_name("TS_ReplyChannelRange_get_sync_complete"))) TS_ReplyChannelRange_get_sync_complete(uint64_t this_ptr) {
53078         LDKReplyChannelRange this_ptr_conv;
53079         this_ptr_conv.inner = untag_ptr(this_ptr);
53080         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53082         this_ptr_conv.is_owned = false;
53083         jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
53084         return ret_conv;
53085 }
53086
53087 void  __attribute__((export_name("TS_ReplyChannelRange_set_sync_complete"))) TS_ReplyChannelRange_set_sync_complete(uint64_t this_ptr, jboolean val) {
53088         LDKReplyChannelRange this_ptr_conv;
53089         this_ptr_conv.inner = untag_ptr(this_ptr);
53090         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53092         this_ptr_conv.is_owned = false;
53093         ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
53094 }
53095
53096 int64_tArray  __attribute__((export_name("TS_ReplyChannelRange_get_short_channel_ids"))) TS_ReplyChannelRange_get_short_channel_ids(uint64_t this_ptr) {
53097         LDKReplyChannelRange this_ptr_conv;
53098         this_ptr_conv.inner = untag_ptr(this_ptr);
53099         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53101         this_ptr_conv.is_owned = false;
53102         LDKCVec_u64Z ret_var = ReplyChannelRange_get_short_channel_ids(&this_ptr_conv);
53103         int64_tArray ret_arr = NULL;
53104         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
53105         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
53106         for (size_t i = 0; i < ret_var.datalen; i++) {
53107                 int64_t ret_conv_8_conv = ret_var.data[i];
53108                 ret_arr_ptr[i] = ret_conv_8_conv;
53109         }
53110         
53111         FREE(ret_var.data);
53112         return ret_arr;
53113 }
53114
53115 void  __attribute__((export_name("TS_ReplyChannelRange_set_short_channel_ids"))) TS_ReplyChannelRange_set_short_channel_ids(uint64_t this_ptr, int64_tArray val) {
53116         LDKReplyChannelRange this_ptr_conv;
53117         this_ptr_conv.inner = untag_ptr(this_ptr);
53118         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53120         this_ptr_conv.is_owned = false;
53121         LDKCVec_u64Z val_constr;
53122         val_constr.datalen = val->arr_len;
53123         if (val_constr.datalen > 0)
53124                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
53125         else
53126                 val_constr.data = NULL;
53127         int64_t* val_vals = val->elems;
53128         for (size_t i = 0; i < val_constr.datalen; i++) {
53129                 int64_t val_conv_8 = val_vals[i];
53130                 val_constr.data[i] = val_conv_8;
53131         }
53132         FREE(val);
53133         ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
53134 }
53135
53136 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) {
53137         LDKThirtyTwoBytes chain_hash_arg_ref;
53138         CHECK(chain_hash_arg->arr_len == 32);
53139         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
53140         LDKCVec_u64Z short_channel_ids_arg_constr;
53141         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
53142         if (short_channel_ids_arg_constr.datalen > 0)
53143                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
53144         else
53145                 short_channel_ids_arg_constr.data = NULL;
53146         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
53147         for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
53148                 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
53149                 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
53150         }
53151         FREE(short_channel_ids_arg);
53152         LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
53153         uint64_t ret_ref = 0;
53154         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53155         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53156         return ret_ref;
53157 }
53158
53159 static inline uint64_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
53160         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
53161         uint64_t ret_ref = 0;
53162         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53163         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53164         return ret_ref;
53165 }
53166 int64_t  __attribute__((export_name("TS_ReplyChannelRange_clone_ptr"))) TS_ReplyChannelRange_clone_ptr(uint64_t arg) {
53167         LDKReplyChannelRange arg_conv;
53168         arg_conv.inner = untag_ptr(arg);
53169         arg_conv.is_owned = ptr_is_owned(arg);
53170         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53171         arg_conv.is_owned = false;
53172         int64_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
53173         return ret_conv;
53174 }
53175
53176 uint64_t  __attribute__((export_name("TS_ReplyChannelRange_clone"))) TS_ReplyChannelRange_clone(uint64_t orig) {
53177         LDKReplyChannelRange orig_conv;
53178         orig_conv.inner = untag_ptr(orig);
53179         orig_conv.is_owned = ptr_is_owned(orig);
53180         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53181         orig_conv.is_owned = false;
53182         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
53183         uint64_t ret_ref = 0;
53184         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53185         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53186         return ret_ref;
53187 }
53188
53189 int64_t  __attribute__((export_name("TS_ReplyChannelRange_hash"))) TS_ReplyChannelRange_hash(uint64_t o) {
53190         LDKReplyChannelRange o_conv;
53191         o_conv.inner = untag_ptr(o);
53192         o_conv.is_owned = ptr_is_owned(o);
53193         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53194         o_conv.is_owned = false;
53195         int64_t ret_conv = ReplyChannelRange_hash(&o_conv);
53196         return ret_conv;
53197 }
53198
53199 jboolean  __attribute__((export_name("TS_ReplyChannelRange_eq"))) TS_ReplyChannelRange_eq(uint64_t a, uint64_t b) {
53200         LDKReplyChannelRange a_conv;
53201         a_conv.inner = untag_ptr(a);
53202         a_conv.is_owned = ptr_is_owned(a);
53203         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53204         a_conv.is_owned = false;
53205         LDKReplyChannelRange b_conv;
53206         b_conv.inner = untag_ptr(b);
53207         b_conv.is_owned = ptr_is_owned(b);
53208         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53209         b_conv.is_owned = false;
53210         jboolean ret_conv = ReplyChannelRange_eq(&a_conv, &b_conv);
53211         return ret_conv;
53212 }
53213
53214 void  __attribute__((export_name("TS_QueryShortChannelIds_free"))) TS_QueryShortChannelIds_free(uint64_t this_obj) {
53215         LDKQueryShortChannelIds this_obj_conv;
53216         this_obj_conv.inner = untag_ptr(this_obj);
53217         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53219         QueryShortChannelIds_free(this_obj_conv);
53220 }
53221
53222 int8_tArray  __attribute__((export_name("TS_QueryShortChannelIds_get_chain_hash"))) TS_QueryShortChannelIds_get_chain_hash(uint64_t this_ptr) {
53223         LDKQueryShortChannelIds this_ptr_conv;
53224         this_ptr_conv.inner = untag_ptr(this_ptr);
53225         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53227         this_ptr_conv.is_owned = false;
53228         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
53229         memcpy(ret_arr->elems, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
53230         return ret_arr;
53231 }
53232
53233 void  __attribute__((export_name("TS_QueryShortChannelIds_set_chain_hash"))) TS_QueryShortChannelIds_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
53234         LDKQueryShortChannelIds this_ptr_conv;
53235         this_ptr_conv.inner = untag_ptr(this_ptr);
53236         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53238         this_ptr_conv.is_owned = false;
53239         LDKThirtyTwoBytes val_ref;
53240         CHECK(val->arr_len == 32);
53241         memcpy(val_ref.data, val->elems, 32); FREE(val);
53242         QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
53243 }
53244
53245 int64_tArray  __attribute__((export_name("TS_QueryShortChannelIds_get_short_channel_ids"))) TS_QueryShortChannelIds_get_short_channel_ids(uint64_t this_ptr) {
53246         LDKQueryShortChannelIds this_ptr_conv;
53247         this_ptr_conv.inner = untag_ptr(this_ptr);
53248         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53250         this_ptr_conv.is_owned = false;
53251         LDKCVec_u64Z ret_var = QueryShortChannelIds_get_short_channel_ids(&this_ptr_conv);
53252         int64_tArray ret_arr = NULL;
53253         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
53254         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
53255         for (size_t i = 0; i < ret_var.datalen; i++) {
53256                 int64_t ret_conv_8_conv = ret_var.data[i];
53257                 ret_arr_ptr[i] = ret_conv_8_conv;
53258         }
53259         
53260         FREE(ret_var.data);
53261         return ret_arr;
53262 }
53263
53264 void  __attribute__((export_name("TS_QueryShortChannelIds_set_short_channel_ids"))) TS_QueryShortChannelIds_set_short_channel_ids(uint64_t this_ptr, int64_tArray val) {
53265         LDKQueryShortChannelIds this_ptr_conv;
53266         this_ptr_conv.inner = untag_ptr(this_ptr);
53267         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53269         this_ptr_conv.is_owned = false;
53270         LDKCVec_u64Z val_constr;
53271         val_constr.datalen = val->arr_len;
53272         if (val_constr.datalen > 0)
53273                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
53274         else
53275                 val_constr.data = NULL;
53276         int64_t* val_vals = val->elems;
53277         for (size_t i = 0; i < val_constr.datalen; i++) {
53278                 int64_t val_conv_8 = val_vals[i];
53279                 val_constr.data[i] = val_conv_8;
53280         }
53281         FREE(val);
53282         QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
53283 }
53284
53285 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_new"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
53286         LDKThirtyTwoBytes chain_hash_arg_ref;
53287         CHECK(chain_hash_arg->arr_len == 32);
53288         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
53289         LDKCVec_u64Z short_channel_ids_arg_constr;
53290         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
53291         if (short_channel_ids_arg_constr.datalen > 0)
53292                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
53293         else
53294                 short_channel_ids_arg_constr.data = NULL;
53295         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
53296         for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
53297                 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
53298                 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
53299         }
53300         FREE(short_channel_ids_arg);
53301         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
53302         uint64_t ret_ref = 0;
53303         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53304         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53305         return ret_ref;
53306 }
53307
53308 static inline uint64_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
53309         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
53310         uint64_t ret_ref = 0;
53311         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53312         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53313         return ret_ref;
53314 }
53315 int64_t  __attribute__((export_name("TS_QueryShortChannelIds_clone_ptr"))) TS_QueryShortChannelIds_clone_ptr(uint64_t arg) {
53316         LDKQueryShortChannelIds arg_conv;
53317         arg_conv.inner = untag_ptr(arg);
53318         arg_conv.is_owned = ptr_is_owned(arg);
53319         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53320         arg_conv.is_owned = false;
53321         int64_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
53322         return ret_conv;
53323 }
53324
53325 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_clone"))) TS_QueryShortChannelIds_clone(uint64_t orig) {
53326         LDKQueryShortChannelIds orig_conv;
53327         orig_conv.inner = untag_ptr(orig);
53328         orig_conv.is_owned = ptr_is_owned(orig);
53329         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53330         orig_conv.is_owned = false;
53331         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
53332         uint64_t ret_ref = 0;
53333         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53334         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53335         return ret_ref;
53336 }
53337
53338 int64_t  __attribute__((export_name("TS_QueryShortChannelIds_hash"))) TS_QueryShortChannelIds_hash(uint64_t o) {
53339         LDKQueryShortChannelIds o_conv;
53340         o_conv.inner = untag_ptr(o);
53341         o_conv.is_owned = ptr_is_owned(o);
53342         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53343         o_conv.is_owned = false;
53344         int64_t ret_conv = QueryShortChannelIds_hash(&o_conv);
53345         return ret_conv;
53346 }
53347
53348 jboolean  __attribute__((export_name("TS_QueryShortChannelIds_eq"))) TS_QueryShortChannelIds_eq(uint64_t a, uint64_t b) {
53349         LDKQueryShortChannelIds a_conv;
53350         a_conv.inner = untag_ptr(a);
53351         a_conv.is_owned = ptr_is_owned(a);
53352         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53353         a_conv.is_owned = false;
53354         LDKQueryShortChannelIds b_conv;
53355         b_conv.inner = untag_ptr(b);
53356         b_conv.is_owned = ptr_is_owned(b);
53357         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53358         b_conv.is_owned = false;
53359         jboolean ret_conv = QueryShortChannelIds_eq(&a_conv, &b_conv);
53360         return ret_conv;
53361 }
53362
53363 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_free"))) TS_ReplyShortChannelIdsEnd_free(uint64_t this_obj) {
53364         LDKReplyShortChannelIdsEnd this_obj_conv;
53365         this_obj_conv.inner = untag_ptr(this_obj);
53366         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53368         ReplyShortChannelIdsEnd_free(this_obj_conv);
53369 }
53370
53371 int8_tArray  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_chain_hash"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint64_t this_ptr) {
53372         LDKReplyShortChannelIdsEnd this_ptr_conv;
53373         this_ptr_conv.inner = untag_ptr(this_ptr);
53374         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53376         this_ptr_conv.is_owned = false;
53377         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
53378         memcpy(ret_arr->elems, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
53379         return ret_arr;
53380 }
53381
53382 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_chain_hash"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
53383         LDKReplyShortChannelIdsEnd this_ptr_conv;
53384         this_ptr_conv.inner = untag_ptr(this_ptr);
53385         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53387         this_ptr_conv.is_owned = false;
53388         LDKThirtyTwoBytes val_ref;
53389         CHECK(val->arr_len == 32);
53390         memcpy(val_ref.data, val->elems, 32); FREE(val);
53391         ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
53392 }
53393
53394 jboolean  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_full_information"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint64_t this_ptr) {
53395         LDKReplyShortChannelIdsEnd this_ptr_conv;
53396         this_ptr_conv.inner = untag_ptr(this_ptr);
53397         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53399         this_ptr_conv.is_owned = false;
53400         jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
53401         return ret_conv;
53402 }
53403
53404 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_full_information"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint64_t this_ptr, jboolean val) {
53405         LDKReplyShortChannelIdsEnd this_ptr_conv;
53406         this_ptr_conv.inner = untag_ptr(this_ptr);
53407         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53409         this_ptr_conv.is_owned = false;
53410         ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
53411 }
53412
53413 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_new"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
53414         LDKThirtyTwoBytes chain_hash_arg_ref;
53415         CHECK(chain_hash_arg->arr_len == 32);
53416         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
53417         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
53418         uint64_t ret_ref = 0;
53419         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53420         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53421         return ret_ref;
53422 }
53423
53424 static inline uint64_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
53425         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
53426         uint64_t ret_ref = 0;
53427         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53428         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53429         return ret_ref;
53430 }
53431 int64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone_ptr"))) TS_ReplyShortChannelIdsEnd_clone_ptr(uint64_t arg) {
53432         LDKReplyShortChannelIdsEnd arg_conv;
53433         arg_conv.inner = untag_ptr(arg);
53434         arg_conv.is_owned = ptr_is_owned(arg);
53435         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53436         arg_conv.is_owned = false;
53437         int64_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
53438         return ret_conv;
53439 }
53440
53441 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone"))) TS_ReplyShortChannelIdsEnd_clone(uint64_t orig) {
53442         LDKReplyShortChannelIdsEnd orig_conv;
53443         orig_conv.inner = untag_ptr(orig);
53444         orig_conv.is_owned = ptr_is_owned(orig);
53445         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53446         orig_conv.is_owned = false;
53447         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
53448         uint64_t ret_ref = 0;
53449         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53450         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53451         return ret_ref;
53452 }
53453
53454 int64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_hash"))) TS_ReplyShortChannelIdsEnd_hash(uint64_t o) {
53455         LDKReplyShortChannelIdsEnd o_conv;
53456         o_conv.inner = untag_ptr(o);
53457         o_conv.is_owned = ptr_is_owned(o);
53458         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53459         o_conv.is_owned = false;
53460         int64_t ret_conv = ReplyShortChannelIdsEnd_hash(&o_conv);
53461         return ret_conv;
53462 }
53463
53464 jboolean  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_eq"))) TS_ReplyShortChannelIdsEnd_eq(uint64_t a, uint64_t b) {
53465         LDKReplyShortChannelIdsEnd a_conv;
53466         a_conv.inner = untag_ptr(a);
53467         a_conv.is_owned = ptr_is_owned(a);
53468         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53469         a_conv.is_owned = false;
53470         LDKReplyShortChannelIdsEnd b_conv;
53471         b_conv.inner = untag_ptr(b);
53472         b_conv.is_owned = ptr_is_owned(b);
53473         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53474         b_conv.is_owned = false;
53475         jboolean ret_conv = ReplyShortChannelIdsEnd_eq(&a_conv, &b_conv);
53476         return ret_conv;
53477 }
53478
53479 void  __attribute__((export_name("TS_GossipTimestampFilter_free"))) TS_GossipTimestampFilter_free(uint64_t this_obj) {
53480         LDKGossipTimestampFilter this_obj_conv;
53481         this_obj_conv.inner = untag_ptr(this_obj);
53482         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53484         GossipTimestampFilter_free(this_obj_conv);
53485 }
53486
53487 int8_tArray  __attribute__((export_name("TS_GossipTimestampFilter_get_chain_hash"))) TS_GossipTimestampFilter_get_chain_hash(uint64_t this_ptr) {
53488         LDKGossipTimestampFilter this_ptr_conv;
53489         this_ptr_conv.inner = untag_ptr(this_ptr);
53490         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53492         this_ptr_conv.is_owned = false;
53493         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
53494         memcpy(ret_arr->elems, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
53495         return ret_arr;
53496 }
53497
53498 void  __attribute__((export_name("TS_GossipTimestampFilter_set_chain_hash"))) TS_GossipTimestampFilter_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
53499         LDKGossipTimestampFilter this_ptr_conv;
53500         this_ptr_conv.inner = untag_ptr(this_ptr);
53501         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53503         this_ptr_conv.is_owned = false;
53504         LDKThirtyTwoBytes val_ref;
53505         CHECK(val->arr_len == 32);
53506         memcpy(val_ref.data, val->elems, 32); FREE(val);
53507         GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
53508 }
53509
53510 int32_t  __attribute__((export_name("TS_GossipTimestampFilter_get_first_timestamp"))) TS_GossipTimestampFilter_get_first_timestamp(uint64_t this_ptr) {
53511         LDKGossipTimestampFilter this_ptr_conv;
53512         this_ptr_conv.inner = untag_ptr(this_ptr);
53513         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53515         this_ptr_conv.is_owned = false;
53516         int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
53517         return ret_conv;
53518 }
53519
53520 void  __attribute__((export_name("TS_GossipTimestampFilter_set_first_timestamp"))) TS_GossipTimestampFilter_set_first_timestamp(uint64_t this_ptr, int32_t val) {
53521         LDKGossipTimestampFilter this_ptr_conv;
53522         this_ptr_conv.inner = untag_ptr(this_ptr);
53523         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53525         this_ptr_conv.is_owned = false;
53526         GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
53527 }
53528
53529 int32_t  __attribute__((export_name("TS_GossipTimestampFilter_get_timestamp_range"))) TS_GossipTimestampFilter_get_timestamp_range(uint64_t this_ptr) {
53530         LDKGossipTimestampFilter this_ptr_conv;
53531         this_ptr_conv.inner = untag_ptr(this_ptr);
53532         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53534         this_ptr_conv.is_owned = false;
53535         int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
53536         return ret_conv;
53537 }
53538
53539 void  __attribute__((export_name("TS_GossipTimestampFilter_set_timestamp_range"))) TS_GossipTimestampFilter_set_timestamp_range(uint64_t this_ptr, int32_t val) {
53540         LDKGossipTimestampFilter this_ptr_conv;
53541         this_ptr_conv.inner = untag_ptr(this_ptr);
53542         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53544         this_ptr_conv.is_owned = false;
53545         GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
53546 }
53547
53548 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) {
53549         LDKThirtyTwoBytes chain_hash_arg_ref;
53550         CHECK(chain_hash_arg->arr_len == 32);
53551         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
53552         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
53553         uint64_t ret_ref = 0;
53554         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53555         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53556         return ret_ref;
53557 }
53558
53559 static inline uint64_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
53560         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
53561         uint64_t ret_ref = 0;
53562         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53563         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53564         return ret_ref;
53565 }
53566 int64_t  __attribute__((export_name("TS_GossipTimestampFilter_clone_ptr"))) TS_GossipTimestampFilter_clone_ptr(uint64_t arg) {
53567         LDKGossipTimestampFilter arg_conv;
53568         arg_conv.inner = untag_ptr(arg);
53569         arg_conv.is_owned = ptr_is_owned(arg);
53570         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53571         arg_conv.is_owned = false;
53572         int64_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
53573         return ret_conv;
53574 }
53575
53576 uint64_t  __attribute__((export_name("TS_GossipTimestampFilter_clone"))) TS_GossipTimestampFilter_clone(uint64_t orig) {
53577         LDKGossipTimestampFilter orig_conv;
53578         orig_conv.inner = untag_ptr(orig);
53579         orig_conv.is_owned = ptr_is_owned(orig);
53580         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53581         orig_conv.is_owned = false;
53582         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
53583         uint64_t ret_ref = 0;
53584         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53585         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53586         return ret_ref;
53587 }
53588
53589 int64_t  __attribute__((export_name("TS_GossipTimestampFilter_hash"))) TS_GossipTimestampFilter_hash(uint64_t o) {
53590         LDKGossipTimestampFilter o_conv;
53591         o_conv.inner = untag_ptr(o);
53592         o_conv.is_owned = ptr_is_owned(o);
53593         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53594         o_conv.is_owned = false;
53595         int64_t ret_conv = GossipTimestampFilter_hash(&o_conv);
53596         return ret_conv;
53597 }
53598
53599 jboolean  __attribute__((export_name("TS_GossipTimestampFilter_eq"))) TS_GossipTimestampFilter_eq(uint64_t a, uint64_t b) {
53600         LDKGossipTimestampFilter a_conv;
53601         a_conv.inner = untag_ptr(a);
53602         a_conv.is_owned = ptr_is_owned(a);
53603         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53604         a_conv.is_owned = false;
53605         LDKGossipTimestampFilter b_conv;
53606         b_conv.inner = untag_ptr(b);
53607         b_conv.is_owned = ptr_is_owned(b);
53608         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53609         b_conv.is_owned = false;
53610         jboolean ret_conv = GossipTimestampFilter_eq(&a_conv, &b_conv);
53611         return ret_conv;
53612 }
53613
53614 void  __attribute__((export_name("TS_ErrorAction_free"))) TS_ErrorAction_free(uint64_t this_ptr) {
53615         if (!ptr_is_owned(this_ptr)) return;
53616         void* this_ptr_ptr = untag_ptr(this_ptr);
53617         CHECK_ACCESS(this_ptr_ptr);
53618         LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
53619         FREE(untag_ptr(this_ptr));
53620         ErrorAction_free(this_ptr_conv);
53621 }
53622
53623 static inline uint64_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
53624         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
53625         *ret_copy = ErrorAction_clone(arg);
53626         uint64_t ret_ref = tag_ptr(ret_copy, true);
53627         return ret_ref;
53628 }
53629 int64_t  __attribute__((export_name("TS_ErrorAction_clone_ptr"))) TS_ErrorAction_clone_ptr(uint64_t arg) {
53630         LDKErrorAction* arg_conv = (LDKErrorAction*)untag_ptr(arg);
53631         int64_t ret_conv = ErrorAction_clone_ptr(arg_conv);
53632         return ret_conv;
53633 }
53634
53635 uint64_t  __attribute__((export_name("TS_ErrorAction_clone"))) TS_ErrorAction_clone(uint64_t orig) {
53636         LDKErrorAction* orig_conv = (LDKErrorAction*)untag_ptr(orig);
53637         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
53638         *ret_copy = ErrorAction_clone(orig_conv);
53639         uint64_t ret_ref = tag_ptr(ret_copy, true);
53640         return ret_ref;
53641 }
53642
53643 uint64_t  __attribute__((export_name("TS_ErrorAction_disconnect_peer"))) TS_ErrorAction_disconnect_peer(uint64_t msg) {
53644         LDKErrorMessage msg_conv;
53645         msg_conv.inner = untag_ptr(msg);
53646         msg_conv.is_owned = ptr_is_owned(msg);
53647         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
53648         msg_conv = ErrorMessage_clone(&msg_conv);
53649         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
53650         *ret_copy = ErrorAction_disconnect_peer(msg_conv);
53651         uint64_t ret_ref = tag_ptr(ret_copy, true);
53652         return ret_ref;
53653 }
53654
53655 uint64_t  __attribute__((export_name("TS_ErrorAction_disconnect_peer_with_warning"))) TS_ErrorAction_disconnect_peer_with_warning(uint64_t msg) {
53656         LDKWarningMessage msg_conv;
53657         msg_conv.inner = untag_ptr(msg);
53658         msg_conv.is_owned = ptr_is_owned(msg);
53659         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
53660         msg_conv = WarningMessage_clone(&msg_conv);
53661         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
53662         *ret_copy = ErrorAction_disconnect_peer_with_warning(msg_conv);
53663         uint64_t ret_ref = tag_ptr(ret_copy, true);
53664         return ret_ref;
53665 }
53666
53667 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_error"))) TS_ErrorAction_ignore_error() {
53668         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
53669         *ret_copy = ErrorAction_ignore_error();
53670         uint64_t ret_ref = tag_ptr(ret_copy, true);
53671         return ret_ref;
53672 }
53673
53674 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_and_log"))) TS_ErrorAction_ignore_and_log(uint32_t a) {
53675         LDKLevel a_conv = LDKLevel_from_js(a);
53676         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
53677         *ret_copy = ErrorAction_ignore_and_log(a_conv);
53678         uint64_t ret_ref = tag_ptr(ret_copy, true);
53679         return ret_ref;
53680 }
53681
53682 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_duplicate_gossip"))) TS_ErrorAction_ignore_duplicate_gossip() {
53683         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
53684         *ret_copy = ErrorAction_ignore_duplicate_gossip();
53685         uint64_t ret_ref = tag_ptr(ret_copy, true);
53686         return ret_ref;
53687 }
53688
53689 uint64_t  __attribute__((export_name("TS_ErrorAction_send_error_message"))) TS_ErrorAction_send_error_message(uint64_t msg) {
53690         LDKErrorMessage msg_conv;
53691         msg_conv.inner = untag_ptr(msg);
53692         msg_conv.is_owned = ptr_is_owned(msg);
53693         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
53694         msg_conv = ErrorMessage_clone(&msg_conv);
53695         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
53696         *ret_copy = ErrorAction_send_error_message(msg_conv);
53697         uint64_t ret_ref = tag_ptr(ret_copy, true);
53698         return ret_ref;
53699 }
53700
53701 uint64_t  __attribute__((export_name("TS_ErrorAction_send_warning_message"))) TS_ErrorAction_send_warning_message(uint64_t msg, uint32_t log_level) {
53702         LDKWarningMessage msg_conv;
53703         msg_conv.inner = untag_ptr(msg);
53704         msg_conv.is_owned = ptr_is_owned(msg);
53705         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
53706         msg_conv = WarningMessage_clone(&msg_conv);
53707         LDKLevel log_level_conv = LDKLevel_from_js(log_level);
53708         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
53709         *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
53710         uint64_t ret_ref = tag_ptr(ret_copy, true);
53711         return ret_ref;
53712 }
53713
53714 int64_t  __attribute__((export_name("TS_ErrorAction_hash"))) TS_ErrorAction_hash(uint64_t o) {
53715         LDKErrorAction* o_conv = (LDKErrorAction*)untag_ptr(o);
53716         int64_t ret_conv = ErrorAction_hash(o_conv);
53717         return ret_conv;
53718 }
53719
53720 void  __attribute__((export_name("TS_LightningError_free"))) TS_LightningError_free(uint64_t this_obj) {
53721         LDKLightningError this_obj_conv;
53722         this_obj_conv.inner = untag_ptr(this_obj);
53723         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53725         LightningError_free(this_obj_conv);
53726 }
53727
53728 jstring  __attribute__((export_name("TS_LightningError_get_err"))) TS_LightningError_get_err(uint64_t this_ptr) {
53729         LDKLightningError this_ptr_conv;
53730         this_ptr_conv.inner = untag_ptr(this_ptr);
53731         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53733         this_ptr_conv.is_owned = false;
53734         LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
53735         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
53736         Str_free(ret_str);
53737         return ret_conv;
53738 }
53739
53740 void  __attribute__((export_name("TS_LightningError_set_err"))) TS_LightningError_set_err(uint64_t this_ptr, jstring val) {
53741         LDKLightningError this_ptr_conv;
53742         this_ptr_conv.inner = untag_ptr(this_ptr);
53743         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53745         this_ptr_conv.is_owned = false;
53746         LDKStr val_conv = str_ref_to_owned_c(val);
53747         LightningError_set_err(&this_ptr_conv, val_conv);
53748 }
53749
53750 uint64_t  __attribute__((export_name("TS_LightningError_get_action"))) TS_LightningError_get_action(uint64_t this_ptr) {
53751         LDKLightningError this_ptr_conv;
53752         this_ptr_conv.inner = untag_ptr(this_ptr);
53753         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53755         this_ptr_conv.is_owned = false;
53756         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
53757         *ret_copy = LightningError_get_action(&this_ptr_conv);
53758         uint64_t ret_ref = tag_ptr(ret_copy, true);
53759         return ret_ref;
53760 }
53761
53762 void  __attribute__((export_name("TS_LightningError_set_action"))) TS_LightningError_set_action(uint64_t this_ptr, uint64_t val) {
53763         LDKLightningError this_ptr_conv;
53764         this_ptr_conv.inner = untag_ptr(this_ptr);
53765         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53767         this_ptr_conv.is_owned = false;
53768         void* val_ptr = untag_ptr(val);
53769         CHECK_ACCESS(val_ptr);
53770         LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
53771         val_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(val));
53772         LightningError_set_action(&this_ptr_conv, val_conv);
53773 }
53774
53775 uint64_t  __attribute__((export_name("TS_LightningError_new"))) TS_LightningError_new(jstring err_arg, uint64_t action_arg) {
53776         LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
53777         void* action_arg_ptr = untag_ptr(action_arg);
53778         CHECK_ACCESS(action_arg_ptr);
53779         LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
53780         action_arg_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action_arg));
53781         LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
53782         uint64_t ret_ref = 0;
53783         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53784         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53785         return ret_ref;
53786 }
53787
53788 static inline uint64_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
53789         LDKLightningError ret_var = LightningError_clone(arg);
53790         uint64_t ret_ref = 0;
53791         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53792         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53793         return ret_ref;
53794 }
53795 int64_t  __attribute__((export_name("TS_LightningError_clone_ptr"))) TS_LightningError_clone_ptr(uint64_t arg) {
53796         LDKLightningError arg_conv;
53797         arg_conv.inner = untag_ptr(arg);
53798         arg_conv.is_owned = ptr_is_owned(arg);
53799         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53800         arg_conv.is_owned = false;
53801         int64_t ret_conv = LightningError_clone_ptr(&arg_conv);
53802         return ret_conv;
53803 }
53804
53805 uint64_t  __attribute__((export_name("TS_LightningError_clone"))) TS_LightningError_clone(uint64_t orig) {
53806         LDKLightningError orig_conv;
53807         orig_conv.inner = untag_ptr(orig);
53808         orig_conv.is_owned = ptr_is_owned(orig);
53809         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53810         orig_conv.is_owned = false;
53811         LDKLightningError ret_var = LightningError_clone(&orig_conv);
53812         uint64_t ret_ref = 0;
53813         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53814         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53815         return ret_ref;
53816 }
53817
53818 void  __attribute__((export_name("TS_CommitmentUpdate_free"))) TS_CommitmentUpdate_free(uint64_t this_obj) {
53819         LDKCommitmentUpdate this_obj_conv;
53820         this_obj_conv.inner = untag_ptr(this_obj);
53821         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53823         CommitmentUpdate_free(this_obj_conv);
53824 }
53825
53826 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_add_htlcs"))) TS_CommitmentUpdate_get_update_add_htlcs(uint64_t this_ptr) {
53827         LDKCommitmentUpdate this_ptr_conv;
53828         this_ptr_conv.inner = untag_ptr(this_ptr);
53829         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53831         this_ptr_conv.is_owned = false;
53832         LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
53833         uint64_tArray ret_arr = NULL;
53834         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
53835         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
53836         for (size_t p = 0; p < ret_var.datalen; p++) {
53837                 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
53838                 uint64_t ret_conv_15_ref = 0;
53839                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
53840                 ret_conv_15_ref = tag_ptr(ret_conv_15_var.inner, ret_conv_15_var.is_owned);
53841                 ret_arr_ptr[p] = ret_conv_15_ref;
53842         }
53843         
53844         FREE(ret_var.data);
53845         return ret_arr;
53846 }
53847
53848 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_add_htlcs"))) TS_CommitmentUpdate_set_update_add_htlcs(uint64_t this_ptr, uint64_tArray val) {
53849         LDKCommitmentUpdate this_ptr_conv;
53850         this_ptr_conv.inner = untag_ptr(this_ptr);
53851         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53853         this_ptr_conv.is_owned = false;
53854         LDKCVec_UpdateAddHTLCZ val_constr;
53855         val_constr.datalen = val->arr_len;
53856         if (val_constr.datalen > 0)
53857                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
53858         else
53859                 val_constr.data = NULL;
53860         uint64_t* val_vals = val->elems;
53861         for (size_t p = 0; p < val_constr.datalen; p++) {
53862                 uint64_t val_conv_15 = val_vals[p];
53863                 LDKUpdateAddHTLC val_conv_15_conv;
53864                 val_conv_15_conv.inner = untag_ptr(val_conv_15);
53865                 val_conv_15_conv.is_owned = ptr_is_owned(val_conv_15);
53866                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
53867                 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
53868                 val_constr.data[p] = val_conv_15_conv;
53869         }
53870         FREE(val);
53871         CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
53872 }
53873
53874 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fulfill_htlcs"))) TS_CommitmentUpdate_get_update_fulfill_htlcs(uint64_t this_ptr) {
53875         LDKCommitmentUpdate this_ptr_conv;
53876         this_ptr_conv.inner = untag_ptr(this_ptr);
53877         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53879         this_ptr_conv.is_owned = false;
53880         LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
53881         uint64_tArray ret_arr = NULL;
53882         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
53883         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
53884         for (size_t t = 0; t < ret_var.datalen; t++) {
53885                 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
53886                 uint64_t ret_conv_19_ref = 0;
53887                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
53888                 ret_conv_19_ref = tag_ptr(ret_conv_19_var.inner, ret_conv_19_var.is_owned);
53889                 ret_arr_ptr[t] = ret_conv_19_ref;
53890         }
53891         
53892         FREE(ret_var.data);
53893         return ret_arr;
53894 }
53895
53896 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fulfill_htlcs"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint64_t this_ptr, uint64_tArray val) {
53897         LDKCommitmentUpdate 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         LDKCVec_UpdateFulfillHTLCZ val_constr;
53903         val_constr.datalen = val->arr_len;
53904         if (val_constr.datalen > 0)
53905                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
53906         else
53907                 val_constr.data = NULL;
53908         uint64_t* val_vals = val->elems;
53909         for (size_t t = 0; t < val_constr.datalen; t++) {
53910                 uint64_t val_conv_19 = val_vals[t];
53911                 LDKUpdateFulfillHTLC val_conv_19_conv;
53912                 val_conv_19_conv.inner = untag_ptr(val_conv_19);
53913                 val_conv_19_conv.is_owned = ptr_is_owned(val_conv_19);
53914                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
53915                 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
53916                 val_constr.data[t] = val_conv_19_conv;
53917         }
53918         FREE(val);
53919         CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
53920 }
53921
53922 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_htlcs"))) TS_CommitmentUpdate_get_update_fail_htlcs(uint64_t this_ptr) {
53923         LDKCommitmentUpdate this_ptr_conv;
53924         this_ptr_conv.inner = untag_ptr(this_ptr);
53925         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53927         this_ptr_conv.is_owned = false;
53928         LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
53929         uint64_tArray ret_arr = NULL;
53930         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
53931         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
53932         for (size_t q = 0; q < ret_var.datalen; q++) {
53933                 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
53934                 uint64_t ret_conv_16_ref = 0;
53935                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
53936                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
53937                 ret_arr_ptr[q] = ret_conv_16_ref;
53938         }
53939         
53940         FREE(ret_var.data);
53941         return ret_arr;
53942 }
53943
53944 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fail_htlcs"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint64_t this_ptr, uint64_tArray val) {
53945         LDKCommitmentUpdate 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         LDKCVec_UpdateFailHTLCZ val_constr;
53951         val_constr.datalen = val->arr_len;
53952         if (val_constr.datalen > 0)
53953                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
53954         else
53955                 val_constr.data = NULL;
53956         uint64_t* val_vals = val->elems;
53957         for (size_t q = 0; q < val_constr.datalen; q++) {
53958                 uint64_t val_conv_16 = val_vals[q];
53959                 LDKUpdateFailHTLC val_conv_16_conv;
53960                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
53961                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
53962                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
53963                 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
53964                 val_constr.data[q] = val_conv_16_conv;
53965         }
53966         FREE(val);
53967         CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
53968 }
53969
53970 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_malformed_htlcs"))) TS_CommitmentUpdate_get_update_fail_malformed_htlcs(uint64_t this_ptr) {
53971         LDKCommitmentUpdate this_ptr_conv;
53972         this_ptr_conv.inner = untag_ptr(this_ptr);
53973         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53975         this_ptr_conv.is_owned = false;
53976         LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
53977         uint64_tArray ret_arr = NULL;
53978         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
53979         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
53980         for (size_t z = 0; z < ret_var.datalen; z++) {
53981                 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
53982                 uint64_t ret_conv_25_ref = 0;
53983                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
53984                 ret_conv_25_ref = tag_ptr(ret_conv_25_var.inner, ret_conv_25_var.is_owned);
53985                 ret_arr_ptr[z] = ret_conv_25_ref;
53986         }
53987         
53988         FREE(ret_var.data);
53989         return ret_arr;
53990 }
53991
53992 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) {
53993         LDKCommitmentUpdate this_ptr_conv;
53994         this_ptr_conv.inner = untag_ptr(this_ptr);
53995         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53997         this_ptr_conv.is_owned = false;
53998         LDKCVec_UpdateFailMalformedHTLCZ val_constr;
53999         val_constr.datalen = val->arr_len;
54000         if (val_constr.datalen > 0)
54001                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
54002         else
54003                 val_constr.data = NULL;
54004         uint64_t* val_vals = val->elems;
54005         for (size_t z = 0; z < val_constr.datalen; z++) {
54006                 uint64_t val_conv_25 = val_vals[z];
54007                 LDKUpdateFailMalformedHTLC val_conv_25_conv;
54008                 val_conv_25_conv.inner = untag_ptr(val_conv_25);
54009                 val_conv_25_conv.is_owned = ptr_is_owned(val_conv_25);
54010                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
54011                 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
54012                 val_constr.data[z] = val_conv_25_conv;
54013         }
54014         FREE(val);
54015         CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
54016 }
54017
54018 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_get_update_fee"))) TS_CommitmentUpdate_get_update_fee(uint64_t this_ptr) {
54019         LDKCommitmentUpdate this_ptr_conv;
54020         this_ptr_conv.inner = untag_ptr(this_ptr);
54021         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54023         this_ptr_conv.is_owned = false;
54024         LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
54025         uint64_t ret_ref = 0;
54026         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54027         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54028         return ret_ref;
54029 }
54030
54031 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fee"))) TS_CommitmentUpdate_set_update_fee(uint64_t this_ptr, uint64_t val) {
54032         LDKCommitmentUpdate this_ptr_conv;
54033         this_ptr_conv.inner = untag_ptr(this_ptr);
54034         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54036         this_ptr_conv.is_owned = false;
54037         LDKUpdateFee val_conv;
54038         val_conv.inner = untag_ptr(val);
54039         val_conv.is_owned = ptr_is_owned(val);
54040         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54041         val_conv = UpdateFee_clone(&val_conv);
54042         CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
54043 }
54044
54045 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_get_commitment_signed"))) TS_CommitmentUpdate_get_commitment_signed(uint64_t this_ptr) {
54046         LDKCommitmentUpdate this_ptr_conv;
54047         this_ptr_conv.inner = untag_ptr(this_ptr);
54048         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54050         this_ptr_conv.is_owned = false;
54051         LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
54052         uint64_t ret_ref = 0;
54053         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54054         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54055         return ret_ref;
54056 }
54057
54058 void  __attribute__((export_name("TS_CommitmentUpdate_set_commitment_signed"))) TS_CommitmentUpdate_set_commitment_signed(uint64_t this_ptr, uint64_t val) {
54059         LDKCommitmentUpdate this_ptr_conv;
54060         this_ptr_conv.inner = untag_ptr(this_ptr);
54061         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54063         this_ptr_conv.is_owned = false;
54064         LDKCommitmentSigned val_conv;
54065         val_conv.inner = untag_ptr(val);
54066         val_conv.is_owned = ptr_is_owned(val);
54067         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54068         val_conv = CommitmentSigned_clone(&val_conv);
54069         CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
54070 }
54071
54072 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) {
54073         LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
54074         update_add_htlcs_arg_constr.datalen = update_add_htlcs_arg->arr_len;
54075         if (update_add_htlcs_arg_constr.datalen > 0)
54076                 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
54077         else
54078                 update_add_htlcs_arg_constr.data = NULL;
54079         uint64_t* update_add_htlcs_arg_vals = update_add_htlcs_arg->elems;
54080         for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
54081                 uint64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
54082                 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
54083                 update_add_htlcs_arg_conv_15_conv.inner = untag_ptr(update_add_htlcs_arg_conv_15);
54084                 update_add_htlcs_arg_conv_15_conv.is_owned = ptr_is_owned(update_add_htlcs_arg_conv_15);
54085                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
54086                 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
54087                 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
54088         }
54089         FREE(update_add_htlcs_arg);
54090         LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
54091         update_fulfill_htlcs_arg_constr.datalen = update_fulfill_htlcs_arg->arr_len;
54092         if (update_fulfill_htlcs_arg_constr.datalen > 0)
54093                 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
54094         else
54095                 update_fulfill_htlcs_arg_constr.data = NULL;
54096         uint64_t* update_fulfill_htlcs_arg_vals = update_fulfill_htlcs_arg->elems;
54097         for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
54098                 uint64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
54099                 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
54100                 update_fulfill_htlcs_arg_conv_19_conv.inner = untag_ptr(update_fulfill_htlcs_arg_conv_19);
54101                 update_fulfill_htlcs_arg_conv_19_conv.is_owned = ptr_is_owned(update_fulfill_htlcs_arg_conv_19);
54102                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
54103                 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
54104                 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
54105         }
54106         FREE(update_fulfill_htlcs_arg);
54107         LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
54108         update_fail_htlcs_arg_constr.datalen = update_fail_htlcs_arg->arr_len;
54109         if (update_fail_htlcs_arg_constr.datalen > 0)
54110                 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
54111         else
54112                 update_fail_htlcs_arg_constr.data = NULL;
54113         uint64_t* update_fail_htlcs_arg_vals = update_fail_htlcs_arg->elems;
54114         for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
54115                 uint64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
54116                 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
54117                 update_fail_htlcs_arg_conv_16_conv.inner = untag_ptr(update_fail_htlcs_arg_conv_16);
54118                 update_fail_htlcs_arg_conv_16_conv.is_owned = ptr_is_owned(update_fail_htlcs_arg_conv_16);
54119                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
54120                 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
54121                 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
54122         }
54123         FREE(update_fail_htlcs_arg);
54124         LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
54125         update_fail_malformed_htlcs_arg_constr.datalen = update_fail_malformed_htlcs_arg->arr_len;
54126         if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
54127                 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
54128         else
54129                 update_fail_malformed_htlcs_arg_constr.data = NULL;
54130         uint64_t* update_fail_malformed_htlcs_arg_vals = update_fail_malformed_htlcs_arg->elems;
54131         for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
54132                 uint64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
54133                 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
54134                 update_fail_malformed_htlcs_arg_conv_25_conv.inner = untag_ptr(update_fail_malformed_htlcs_arg_conv_25);
54135                 update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = ptr_is_owned(update_fail_malformed_htlcs_arg_conv_25);
54136                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
54137                 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
54138                 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
54139         }
54140         FREE(update_fail_malformed_htlcs_arg);
54141         LDKUpdateFee update_fee_arg_conv;
54142         update_fee_arg_conv.inner = untag_ptr(update_fee_arg);
54143         update_fee_arg_conv.is_owned = ptr_is_owned(update_fee_arg);
54144         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
54145         update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
54146         LDKCommitmentSigned commitment_signed_arg_conv;
54147         commitment_signed_arg_conv.inner = untag_ptr(commitment_signed_arg);
54148         commitment_signed_arg_conv.is_owned = ptr_is_owned(commitment_signed_arg);
54149         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
54150         commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
54151         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);
54152         uint64_t ret_ref = 0;
54153         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54154         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54155         return ret_ref;
54156 }
54157
54158 static inline uint64_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
54159         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
54160         uint64_t ret_ref = 0;
54161         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54162         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54163         return ret_ref;
54164 }
54165 int64_t  __attribute__((export_name("TS_CommitmentUpdate_clone_ptr"))) TS_CommitmentUpdate_clone_ptr(uint64_t arg) {
54166         LDKCommitmentUpdate arg_conv;
54167         arg_conv.inner = untag_ptr(arg);
54168         arg_conv.is_owned = ptr_is_owned(arg);
54169         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54170         arg_conv.is_owned = false;
54171         int64_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
54172         return ret_conv;
54173 }
54174
54175 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_clone"))) TS_CommitmentUpdate_clone(uint64_t orig) {
54176         LDKCommitmentUpdate orig_conv;
54177         orig_conv.inner = untag_ptr(orig);
54178         orig_conv.is_owned = ptr_is_owned(orig);
54179         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54180         orig_conv.is_owned = false;
54181         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
54182         uint64_t ret_ref = 0;
54183         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54184         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54185         return ret_ref;
54186 }
54187
54188 int64_t  __attribute__((export_name("TS_CommitmentUpdate_hash"))) TS_CommitmentUpdate_hash(uint64_t o) {
54189         LDKCommitmentUpdate o_conv;
54190         o_conv.inner = untag_ptr(o);
54191         o_conv.is_owned = ptr_is_owned(o);
54192         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54193         o_conv.is_owned = false;
54194         int64_t ret_conv = CommitmentUpdate_hash(&o_conv);
54195         return ret_conv;
54196 }
54197
54198 jboolean  __attribute__((export_name("TS_CommitmentUpdate_eq"))) TS_CommitmentUpdate_eq(uint64_t a, uint64_t b) {
54199         LDKCommitmentUpdate a_conv;
54200         a_conv.inner = untag_ptr(a);
54201         a_conv.is_owned = ptr_is_owned(a);
54202         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54203         a_conv.is_owned = false;
54204         LDKCommitmentUpdate b_conv;
54205         b_conv.inner = untag_ptr(b);
54206         b_conv.is_owned = ptr_is_owned(b);
54207         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54208         b_conv.is_owned = false;
54209         jboolean ret_conv = CommitmentUpdate_eq(&a_conv, &b_conv);
54210         return ret_conv;
54211 }
54212
54213 void  __attribute__((export_name("TS_ChannelMessageHandler_free"))) TS_ChannelMessageHandler_free(uint64_t this_ptr) {
54214         if (!ptr_is_owned(this_ptr)) return;
54215         void* this_ptr_ptr = untag_ptr(this_ptr);
54216         CHECK_ACCESS(this_ptr_ptr);
54217         LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
54218         FREE(untag_ptr(this_ptr));
54219         ChannelMessageHandler_free(this_ptr_conv);
54220 }
54221
54222 void  __attribute__((export_name("TS_RoutingMessageHandler_free"))) TS_RoutingMessageHandler_free(uint64_t this_ptr) {
54223         if (!ptr_is_owned(this_ptr)) return;
54224         void* this_ptr_ptr = untag_ptr(this_ptr);
54225         CHECK_ACCESS(this_ptr_ptr);
54226         LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
54227         FREE(untag_ptr(this_ptr));
54228         RoutingMessageHandler_free(this_ptr_conv);
54229 }
54230
54231 void  __attribute__((export_name("TS_OnionMessageHandler_free"))) TS_OnionMessageHandler_free(uint64_t this_ptr) {
54232         if (!ptr_is_owned(this_ptr)) return;
54233         void* this_ptr_ptr = untag_ptr(this_ptr);
54234         CHECK_ACCESS(this_ptr_ptr);
54235         LDKOnionMessageHandler this_ptr_conv = *(LDKOnionMessageHandler*)(this_ptr_ptr);
54236         FREE(untag_ptr(this_ptr));
54237         OnionMessageHandler_free(this_ptr_conv);
54238 }
54239
54240 void  __attribute__((export_name("TS_FinalOnionHopData_free"))) TS_FinalOnionHopData_free(uint64_t this_obj) {
54241         LDKFinalOnionHopData this_obj_conv;
54242         this_obj_conv.inner = untag_ptr(this_obj);
54243         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54245         FinalOnionHopData_free(this_obj_conv);
54246 }
54247
54248 int8_tArray  __attribute__((export_name("TS_FinalOnionHopData_get_payment_secret"))) TS_FinalOnionHopData_get_payment_secret(uint64_t this_ptr) {
54249         LDKFinalOnionHopData this_ptr_conv;
54250         this_ptr_conv.inner = untag_ptr(this_ptr);
54251         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54253         this_ptr_conv.is_owned = false;
54254         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
54255         memcpy(ret_arr->elems, *FinalOnionHopData_get_payment_secret(&this_ptr_conv), 32);
54256         return ret_arr;
54257 }
54258
54259 void  __attribute__((export_name("TS_FinalOnionHopData_set_payment_secret"))) TS_FinalOnionHopData_set_payment_secret(uint64_t this_ptr, int8_tArray val) {
54260         LDKFinalOnionHopData this_ptr_conv;
54261         this_ptr_conv.inner = untag_ptr(this_ptr);
54262         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54264         this_ptr_conv.is_owned = false;
54265         LDKThirtyTwoBytes val_ref;
54266         CHECK(val->arr_len == 32);
54267         memcpy(val_ref.data, val->elems, 32); FREE(val);
54268         FinalOnionHopData_set_payment_secret(&this_ptr_conv, val_ref);
54269 }
54270
54271 int64_t  __attribute__((export_name("TS_FinalOnionHopData_get_total_msat"))) TS_FinalOnionHopData_get_total_msat(uint64_t this_ptr) {
54272         LDKFinalOnionHopData this_ptr_conv;
54273         this_ptr_conv.inner = untag_ptr(this_ptr);
54274         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54276         this_ptr_conv.is_owned = false;
54277         int64_t ret_conv = FinalOnionHopData_get_total_msat(&this_ptr_conv);
54278         return ret_conv;
54279 }
54280
54281 void  __attribute__((export_name("TS_FinalOnionHopData_set_total_msat"))) TS_FinalOnionHopData_set_total_msat(uint64_t this_ptr, int64_t val) {
54282         LDKFinalOnionHopData this_ptr_conv;
54283         this_ptr_conv.inner = untag_ptr(this_ptr);
54284         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54286         this_ptr_conv.is_owned = false;
54287         FinalOnionHopData_set_total_msat(&this_ptr_conv, val);
54288 }
54289
54290 uint64_t  __attribute__((export_name("TS_FinalOnionHopData_new"))) TS_FinalOnionHopData_new(int8_tArray payment_secret_arg, int64_t total_msat_arg) {
54291         LDKThirtyTwoBytes payment_secret_arg_ref;
54292         CHECK(payment_secret_arg->arr_len == 32);
54293         memcpy(payment_secret_arg_ref.data, payment_secret_arg->elems, 32); FREE(payment_secret_arg);
54294         LDKFinalOnionHopData ret_var = FinalOnionHopData_new(payment_secret_arg_ref, total_msat_arg);
54295         uint64_t ret_ref = 0;
54296         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54297         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54298         return ret_ref;
54299 }
54300
54301 static inline uint64_t FinalOnionHopData_clone_ptr(LDKFinalOnionHopData *NONNULL_PTR arg) {
54302         LDKFinalOnionHopData ret_var = FinalOnionHopData_clone(arg);
54303         uint64_t ret_ref = 0;
54304         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54305         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54306         return ret_ref;
54307 }
54308 int64_t  __attribute__((export_name("TS_FinalOnionHopData_clone_ptr"))) TS_FinalOnionHopData_clone_ptr(uint64_t arg) {
54309         LDKFinalOnionHopData arg_conv;
54310         arg_conv.inner = untag_ptr(arg);
54311         arg_conv.is_owned = ptr_is_owned(arg);
54312         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54313         arg_conv.is_owned = false;
54314         int64_t ret_conv = FinalOnionHopData_clone_ptr(&arg_conv);
54315         return ret_conv;
54316 }
54317
54318 uint64_t  __attribute__((export_name("TS_FinalOnionHopData_clone"))) TS_FinalOnionHopData_clone(uint64_t orig) {
54319         LDKFinalOnionHopData orig_conv;
54320         orig_conv.inner = untag_ptr(orig);
54321         orig_conv.is_owned = ptr_is_owned(orig);
54322         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54323         orig_conv.is_owned = false;
54324         LDKFinalOnionHopData ret_var = FinalOnionHopData_clone(&orig_conv);
54325         uint64_t ret_ref = 0;
54326         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54327         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54328         return ret_ref;
54329 }
54330
54331 void  __attribute__((export_name("TS_OnionPacket_free"))) TS_OnionPacket_free(uint64_t this_obj) {
54332         LDKOnionPacket this_obj_conv;
54333         this_obj_conv.inner = untag_ptr(this_obj);
54334         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54336         OnionPacket_free(this_obj_conv);
54337 }
54338
54339 int8_t  __attribute__((export_name("TS_OnionPacket_get_version"))) TS_OnionPacket_get_version(uint64_t this_ptr) {
54340         LDKOnionPacket this_ptr_conv;
54341         this_ptr_conv.inner = untag_ptr(this_ptr);
54342         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54344         this_ptr_conv.is_owned = false;
54345         int8_t ret_conv = OnionPacket_get_version(&this_ptr_conv);
54346         return ret_conv;
54347 }
54348
54349 void  __attribute__((export_name("TS_OnionPacket_set_version"))) TS_OnionPacket_set_version(uint64_t this_ptr, int8_t val) {
54350         LDKOnionPacket this_ptr_conv;
54351         this_ptr_conv.inner = untag_ptr(this_ptr);
54352         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54354         this_ptr_conv.is_owned = false;
54355         OnionPacket_set_version(&this_ptr_conv, val);
54356 }
54357
54358 uint64_t  __attribute__((export_name("TS_OnionPacket_get_public_key"))) TS_OnionPacket_get_public_key(uint64_t this_ptr) {
54359         LDKOnionPacket this_ptr_conv;
54360         this_ptr_conv.inner = untag_ptr(this_ptr);
54361         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54363         this_ptr_conv.is_owned = false;
54364         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
54365         *ret_conv = OnionPacket_get_public_key(&this_ptr_conv);
54366         return tag_ptr(ret_conv, true);
54367 }
54368
54369 void  __attribute__((export_name("TS_OnionPacket_set_public_key"))) TS_OnionPacket_set_public_key(uint64_t this_ptr, uint64_t val) {
54370         LDKOnionPacket this_ptr_conv;
54371         this_ptr_conv.inner = untag_ptr(this_ptr);
54372         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54374         this_ptr_conv.is_owned = false;
54375         void* val_ptr = untag_ptr(val);
54376         CHECK_ACCESS(val_ptr);
54377         LDKCResult_PublicKeySecp256k1ErrorZ val_conv = *(LDKCResult_PublicKeySecp256k1ErrorZ*)(val_ptr);
54378         val_conv = CResult_PublicKeySecp256k1ErrorZ_clone((LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(val));
54379         OnionPacket_set_public_key(&this_ptr_conv, val_conv);
54380 }
54381
54382 int8_tArray  __attribute__((export_name("TS_OnionPacket_get_hmac"))) TS_OnionPacket_get_hmac(uint64_t this_ptr) {
54383         LDKOnionPacket 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         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
54389         memcpy(ret_arr->elems, *OnionPacket_get_hmac(&this_ptr_conv), 32);
54390         return ret_arr;
54391 }
54392
54393 void  __attribute__((export_name("TS_OnionPacket_set_hmac"))) TS_OnionPacket_set_hmac(uint64_t this_ptr, int8_tArray val) {
54394         LDKOnionPacket this_ptr_conv;
54395         this_ptr_conv.inner = untag_ptr(this_ptr);
54396         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54398         this_ptr_conv.is_owned = false;
54399         LDKThirtyTwoBytes val_ref;
54400         CHECK(val->arr_len == 32);
54401         memcpy(val_ref.data, val->elems, 32); FREE(val);
54402         OnionPacket_set_hmac(&this_ptr_conv, val_ref);
54403 }
54404
54405 static inline uint64_t OnionPacket_clone_ptr(LDKOnionPacket *NONNULL_PTR arg) {
54406         LDKOnionPacket ret_var = OnionPacket_clone(arg);
54407         uint64_t ret_ref = 0;
54408         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54409         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54410         return ret_ref;
54411 }
54412 int64_t  __attribute__((export_name("TS_OnionPacket_clone_ptr"))) TS_OnionPacket_clone_ptr(uint64_t arg) {
54413         LDKOnionPacket arg_conv;
54414         arg_conv.inner = untag_ptr(arg);
54415         arg_conv.is_owned = ptr_is_owned(arg);
54416         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54417         arg_conv.is_owned = false;
54418         int64_t ret_conv = OnionPacket_clone_ptr(&arg_conv);
54419         return ret_conv;
54420 }
54421
54422 uint64_t  __attribute__((export_name("TS_OnionPacket_clone"))) TS_OnionPacket_clone(uint64_t orig) {
54423         LDKOnionPacket orig_conv;
54424         orig_conv.inner = untag_ptr(orig);
54425         orig_conv.is_owned = ptr_is_owned(orig);
54426         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54427         orig_conv.is_owned = false;
54428         LDKOnionPacket ret_var = OnionPacket_clone(&orig_conv);
54429         uint64_t ret_ref = 0;
54430         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54431         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54432         return ret_ref;
54433 }
54434
54435 int64_t  __attribute__((export_name("TS_OnionPacket_hash"))) TS_OnionPacket_hash(uint64_t o) {
54436         LDKOnionPacket o_conv;
54437         o_conv.inner = untag_ptr(o);
54438         o_conv.is_owned = ptr_is_owned(o);
54439         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54440         o_conv.is_owned = false;
54441         int64_t ret_conv = OnionPacket_hash(&o_conv);
54442         return ret_conv;
54443 }
54444
54445 jboolean  __attribute__((export_name("TS_OnionPacket_eq"))) TS_OnionPacket_eq(uint64_t a, uint64_t b) {
54446         LDKOnionPacket a_conv;
54447         a_conv.inner = untag_ptr(a);
54448         a_conv.is_owned = ptr_is_owned(a);
54449         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54450         a_conv.is_owned = false;
54451         LDKOnionPacket b_conv;
54452         b_conv.inner = untag_ptr(b);
54453         b_conv.is_owned = ptr_is_owned(b);
54454         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54455         b_conv.is_owned = false;
54456         jboolean ret_conv = OnionPacket_eq(&a_conv, &b_conv);
54457         return ret_conv;
54458 }
54459
54460 void  __attribute__((export_name("TS_TrampolineOnionPacket_free"))) TS_TrampolineOnionPacket_free(uint64_t this_obj) {
54461         LDKTrampolineOnionPacket this_obj_conv;
54462         this_obj_conv.inner = untag_ptr(this_obj);
54463         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54465         TrampolineOnionPacket_free(this_obj_conv);
54466 }
54467
54468 int8_t  __attribute__((export_name("TS_TrampolineOnionPacket_get_version"))) TS_TrampolineOnionPacket_get_version(uint64_t this_ptr) {
54469         LDKTrampolineOnionPacket this_ptr_conv;
54470         this_ptr_conv.inner = untag_ptr(this_ptr);
54471         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54473         this_ptr_conv.is_owned = false;
54474         int8_t ret_conv = TrampolineOnionPacket_get_version(&this_ptr_conv);
54475         return ret_conv;
54476 }
54477
54478 void  __attribute__((export_name("TS_TrampolineOnionPacket_set_version"))) TS_TrampolineOnionPacket_set_version(uint64_t this_ptr, int8_t val) {
54479         LDKTrampolineOnionPacket this_ptr_conv;
54480         this_ptr_conv.inner = untag_ptr(this_ptr);
54481         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54483         this_ptr_conv.is_owned = false;
54484         TrampolineOnionPacket_set_version(&this_ptr_conv, val);
54485 }
54486
54487 int8_tArray  __attribute__((export_name("TS_TrampolineOnionPacket_get_public_key"))) TS_TrampolineOnionPacket_get_public_key(uint64_t this_ptr) {
54488         LDKTrampolineOnionPacket this_ptr_conv;
54489         this_ptr_conv.inner = untag_ptr(this_ptr);
54490         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54492         this_ptr_conv.is_owned = false;
54493         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
54494         memcpy(ret_arr->elems, TrampolineOnionPacket_get_public_key(&this_ptr_conv).compressed_form, 33);
54495         return ret_arr;
54496 }
54497
54498 void  __attribute__((export_name("TS_TrampolineOnionPacket_set_public_key"))) TS_TrampolineOnionPacket_set_public_key(uint64_t this_ptr, int8_tArray val) {
54499         LDKTrampolineOnionPacket this_ptr_conv;
54500         this_ptr_conv.inner = untag_ptr(this_ptr);
54501         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54503         this_ptr_conv.is_owned = false;
54504         LDKPublicKey val_ref;
54505         CHECK(val->arr_len == 33);
54506         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
54507         TrampolineOnionPacket_set_public_key(&this_ptr_conv, val_ref);
54508 }
54509
54510 int8_tArray  __attribute__((export_name("TS_TrampolineOnionPacket_get_hop_data"))) TS_TrampolineOnionPacket_get_hop_data(uint64_t this_ptr) {
54511         LDKTrampolineOnionPacket this_ptr_conv;
54512         this_ptr_conv.inner = untag_ptr(this_ptr);
54513         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54515         this_ptr_conv.is_owned = false;
54516         LDKCVec_u8Z ret_var = TrampolineOnionPacket_get_hop_data(&this_ptr_conv);
54517         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54518         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54519         CVec_u8Z_free(ret_var);
54520         return ret_arr;
54521 }
54522
54523 void  __attribute__((export_name("TS_TrampolineOnionPacket_set_hop_data"))) TS_TrampolineOnionPacket_set_hop_data(uint64_t this_ptr, int8_tArray val) {
54524         LDKTrampolineOnionPacket this_ptr_conv;
54525         this_ptr_conv.inner = untag_ptr(this_ptr);
54526         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54528         this_ptr_conv.is_owned = false;
54529         LDKCVec_u8Z val_ref;
54530         val_ref.datalen = val->arr_len;
54531         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
54532         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
54533         TrampolineOnionPacket_set_hop_data(&this_ptr_conv, val_ref);
54534 }
54535
54536 int8_tArray  __attribute__((export_name("TS_TrampolineOnionPacket_get_hmac"))) TS_TrampolineOnionPacket_get_hmac(uint64_t this_ptr) {
54537         LDKTrampolineOnionPacket this_ptr_conv;
54538         this_ptr_conv.inner = untag_ptr(this_ptr);
54539         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54541         this_ptr_conv.is_owned = false;
54542         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
54543         memcpy(ret_arr->elems, *TrampolineOnionPacket_get_hmac(&this_ptr_conv), 32);
54544         return ret_arr;
54545 }
54546
54547 void  __attribute__((export_name("TS_TrampolineOnionPacket_set_hmac"))) TS_TrampolineOnionPacket_set_hmac(uint64_t this_ptr, int8_tArray val) {
54548         LDKTrampolineOnionPacket this_ptr_conv;
54549         this_ptr_conv.inner = untag_ptr(this_ptr);
54550         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54552         this_ptr_conv.is_owned = false;
54553         LDKThirtyTwoBytes val_ref;
54554         CHECK(val->arr_len == 32);
54555         memcpy(val_ref.data, val->elems, 32); FREE(val);
54556         TrampolineOnionPacket_set_hmac(&this_ptr_conv, val_ref);
54557 }
54558
54559 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) {
54560         LDKPublicKey public_key_arg_ref;
54561         CHECK(public_key_arg->arr_len == 33);
54562         memcpy(public_key_arg_ref.compressed_form, public_key_arg->elems, 33); FREE(public_key_arg);
54563         LDKCVec_u8Z hop_data_arg_ref;
54564         hop_data_arg_ref.datalen = hop_data_arg->arr_len;
54565         hop_data_arg_ref.data = MALLOC(hop_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
54566         memcpy(hop_data_arg_ref.data, hop_data_arg->elems, hop_data_arg_ref.datalen); FREE(hop_data_arg);
54567         LDKThirtyTwoBytes hmac_arg_ref;
54568         CHECK(hmac_arg->arr_len == 32);
54569         memcpy(hmac_arg_ref.data, hmac_arg->elems, 32); FREE(hmac_arg);
54570         LDKTrampolineOnionPacket ret_var = TrampolineOnionPacket_new(version_arg, public_key_arg_ref, hop_data_arg_ref, hmac_arg_ref);
54571         uint64_t ret_ref = 0;
54572         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54573         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54574         return ret_ref;
54575 }
54576
54577 static inline uint64_t TrampolineOnionPacket_clone_ptr(LDKTrampolineOnionPacket *NONNULL_PTR arg) {
54578         LDKTrampolineOnionPacket ret_var = TrampolineOnionPacket_clone(arg);
54579         uint64_t ret_ref = 0;
54580         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54581         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54582         return ret_ref;
54583 }
54584 int64_t  __attribute__((export_name("TS_TrampolineOnionPacket_clone_ptr"))) TS_TrampolineOnionPacket_clone_ptr(uint64_t arg) {
54585         LDKTrampolineOnionPacket arg_conv;
54586         arg_conv.inner = untag_ptr(arg);
54587         arg_conv.is_owned = ptr_is_owned(arg);
54588         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54589         arg_conv.is_owned = false;
54590         int64_t ret_conv = TrampolineOnionPacket_clone_ptr(&arg_conv);
54591         return ret_conv;
54592 }
54593
54594 uint64_t  __attribute__((export_name("TS_TrampolineOnionPacket_clone"))) TS_TrampolineOnionPacket_clone(uint64_t orig) {
54595         LDKTrampolineOnionPacket orig_conv;
54596         orig_conv.inner = untag_ptr(orig);
54597         orig_conv.is_owned = ptr_is_owned(orig);
54598         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54599         orig_conv.is_owned = false;
54600         LDKTrampolineOnionPacket ret_var = TrampolineOnionPacket_clone(&orig_conv);
54601         uint64_t ret_ref = 0;
54602         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54603         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54604         return ret_ref;
54605 }
54606
54607 int64_t  __attribute__((export_name("TS_TrampolineOnionPacket_hash"))) TS_TrampolineOnionPacket_hash(uint64_t o) {
54608         LDKTrampolineOnionPacket o_conv;
54609         o_conv.inner = untag_ptr(o);
54610         o_conv.is_owned = ptr_is_owned(o);
54611         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54612         o_conv.is_owned = false;
54613         int64_t ret_conv = TrampolineOnionPacket_hash(&o_conv);
54614         return ret_conv;
54615 }
54616
54617 jboolean  __attribute__((export_name("TS_TrampolineOnionPacket_eq"))) TS_TrampolineOnionPacket_eq(uint64_t a, uint64_t b) {
54618         LDKTrampolineOnionPacket a_conv;
54619         a_conv.inner = untag_ptr(a);
54620         a_conv.is_owned = ptr_is_owned(a);
54621         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54622         a_conv.is_owned = false;
54623         LDKTrampolineOnionPacket b_conv;
54624         b_conv.inner = untag_ptr(b);
54625         b_conv.is_owned = ptr_is_owned(b);
54626         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54627         b_conv.is_owned = false;
54628         jboolean ret_conv = TrampolineOnionPacket_eq(&a_conv, &b_conv);
54629         return ret_conv;
54630 }
54631
54632 int8_tArray  __attribute__((export_name("TS_TrampolineOnionPacket_write"))) TS_TrampolineOnionPacket_write(uint64_t obj) {
54633         LDKTrampolineOnionPacket obj_conv;
54634         obj_conv.inner = untag_ptr(obj);
54635         obj_conv.is_owned = ptr_is_owned(obj);
54636         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54637         obj_conv.is_owned = false;
54638         LDKCVec_u8Z ret_var = TrampolineOnionPacket_write(&obj_conv);
54639         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54640         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54641         CVec_u8Z_free(ret_var);
54642         return ret_arr;
54643 }
54644
54645 int8_tArray  __attribute__((export_name("TS_AcceptChannel_write"))) TS_AcceptChannel_write(uint64_t obj) {
54646         LDKAcceptChannel obj_conv;
54647         obj_conv.inner = untag_ptr(obj);
54648         obj_conv.is_owned = ptr_is_owned(obj);
54649         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54650         obj_conv.is_owned = false;
54651         LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
54652         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54653         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54654         CVec_u8Z_free(ret_var);
54655         return ret_arr;
54656 }
54657
54658 uint64_t  __attribute__((export_name("TS_AcceptChannel_read"))) TS_AcceptChannel_read(int8_tArray ser) {
54659         LDKu8slice ser_ref;
54660         ser_ref.datalen = ser->arr_len;
54661         ser_ref.data = ser->elems;
54662         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
54663         *ret_conv = AcceptChannel_read(ser_ref);
54664         FREE(ser);
54665         return tag_ptr(ret_conv, true);
54666 }
54667
54668 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_write"))) TS_AcceptChannelV2_write(uint64_t obj) {
54669         LDKAcceptChannelV2 obj_conv;
54670         obj_conv.inner = untag_ptr(obj);
54671         obj_conv.is_owned = ptr_is_owned(obj);
54672         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54673         obj_conv.is_owned = false;
54674         LDKCVec_u8Z ret_var = AcceptChannelV2_write(&obj_conv);
54675         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54676         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54677         CVec_u8Z_free(ret_var);
54678         return ret_arr;
54679 }
54680
54681 uint64_t  __attribute__((export_name("TS_AcceptChannelV2_read"))) TS_AcceptChannelV2_read(int8_tArray ser) {
54682         LDKu8slice ser_ref;
54683         ser_ref.datalen = ser->arr_len;
54684         ser_ref.data = ser->elems;
54685         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
54686         *ret_conv = AcceptChannelV2_read(ser_ref);
54687         FREE(ser);
54688         return tag_ptr(ret_conv, true);
54689 }
54690
54691 int8_tArray  __attribute__((export_name("TS_Stfu_write"))) TS_Stfu_write(uint64_t obj) {
54692         LDKStfu obj_conv;
54693         obj_conv.inner = untag_ptr(obj);
54694         obj_conv.is_owned = ptr_is_owned(obj);
54695         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54696         obj_conv.is_owned = false;
54697         LDKCVec_u8Z ret_var = Stfu_write(&obj_conv);
54698         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54699         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54700         CVec_u8Z_free(ret_var);
54701         return ret_arr;
54702 }
54703
54704 uint64_t  __attribute__((export_name("TS_Stfu_read"))) TS_Stfu_read(int8_tArray ser) {
54705         LDKu8slice ser_ref;
54706         ser_ref.datalen = ser->arr_len;
54707         ser_ref.data = ser->elems;
54708         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
54709         *ret_conv = Stfu_read(ser_ref);
54710         FREE(ser);
54711         return tag_ptr(ret_conv, true);
54712 }
54713
54714 int8_tArray  __attribute__((export_name("TS_Splice_write"))) TS_Splice_write(uint64_t obj) {
54715         LDKSplice obj_conv;
54716         obj_conv.inner = untag_ptr(obj);
54717         obj_conv.is_owned = ptr_is_owned(obj);
54718         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54719         obj_conv.is_owned = false;
54720         LDKCVec_u8Z ret_var = Splice_write(&obj_conv);
54721         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54722         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54723         CVec_u8Z_free(ret_var);
54724         return ret_arr;
54725 }
54726
54727 uint64_t  __attribute__((export_name("TS_Splice_read"))) TS_Splice_read(int8_tArray ser) {
54728         LDKu8slice ser_ref;
54729         ser_ref.datalen = ser->arr_len;
54730         ser_ref.data = ser->elems;
54731         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
54732         *ret_conv = Splice_read(ser_ref);
54733         FREE(ser);
54734         return tag_ptr(ret_conv, true);
54735 }
54736
54737 int8_tArray  __attribute__((export_name("TS_SpliceAck_write"))) TS_SpliceAck_write(uint64_t obj) {
54738         LDKSpliceAck obj_conv;
54739         obj_conv.inner = untag_ptr(obj);
54740         obj_conv.is_owned = ptr_is_owned(obj);
54741         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54742         obj_conv.is_owned = false;
54743         LDKCVec_u8Z ret_var = SpliceAck_write(&obj_conv);
54744         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54745         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54746         CVec_u8Z_free(ret_var);
54747         return ret_arr;
54748 }
54749
54750 uint64_t  __attribute__((export_name("TS_SpliceAck_read"))) TS_SpliceAck_read(int8_tArray ser) {
54751         LDKu8slice ser_ref;
54752         ser_ref.datalen = ser->arr_len;
54753         ser_ref.data = ser->elems;
54754         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
54755         *ret_conv = SpliceAck_read(ser_ref);
54756         FREE(ser);
54757         return tag_ptr(ret_conv, true);
54758 }
54759
54760 int8_tArray  __attribute__((export_name("TS_SpliceLocked_write"))) TS_SpliceLocked_write(uint64_t obj) {
54761         LDKSpliceLocked obj_conv;
54762         obj_conv.inner = untag_ptr(obj);
54763         obj_conv.is_owned = ptr_is_owned(obj);
54764         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54765         obj_conv.is_owned = false;
54766         LDKCVec_u8Z ret_var = SpliceLocked_write(&obj_conv);
54767         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54768         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54769         CVec_u8Z_free(ret_var);
54770         return ret_arr;
54771 }
54772
54773 uint64_t  __attribute__((export_name("TS_SpliceLocked_read"))) TS_SpliceLocked_read(int8_tArray ser) {
54774         LDKu8slice ser_ref;
54775         ser_ref.datalen = ser->arr_len;
54776         ser_ref.data = ser->elems;
54777         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
54778         *ret_conv = SpliceLocked_read(ser_ref);
54779         FREE(ser);
54780         return tag_ptr(ret_conv, true);
54781 }
54782
54783 int8_tArray  __attribute__((export_name("TS_TxAddInput_write"))) TS_TxAddInput_write(uint64_t obj) {
54784         LDKTxAddInput obj_conv;
54785         obj_conv.inner = untag_ptr(obj);
54786         obj_conv.is_owned = ptr_is_owned(obj);
54787         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54788         obj_conv.is_owned = false;
54789         LDKCVec_u8Z ret_var = TxAddInput_write(&obj_conv);
54790         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54791         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54792         CVec_u8Z_free(ret_var);
54793         return ret_arr;
54794 }
54795
54796 uint64_t  __attribute__((export_name("TS_TxAddInput_read"))) TS_TxAddInput_read(int8_tArray ser) {
54797         LDKu8slice ser_ref;
54798         ser_ref.datalen = ser->arr_len;
54799         ser_ref.data = ser->elems;
54800         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
54801         *ret_conv = TxAddInput_read(ser_ref);
54802         FREE(ser);
54803         return tag_ptr(ret_conv, true);
54804 }
54805
54806 int8_tArray  __attribute__((export_name("TS_TxAddOutput_write"))) TS_TxAddOutput_write(uint64_t obj) {
54807         LDKTxAddOutput obj_conv;
54808         obj_conv.inner = untag_ptr(obj);
54809         obj_conv.is_owned = ptr_is_owned(obj);
54810         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54811         obj_conv.is_owned = false;
54812         LDKCVec_u8Z ret_var = TxAddOutput_write(&obj_conv);
54813         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54814         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54815         CVec_u8Z_free(ret_var);
54816         return ret_arr;
54817 }
54818
54819 uint64_t  __attribute__((export_name("TS_TxAddOutput_read"))) TS_TxAddOutput_read(int8_tArray ser) {
54820         LDKu8slice ser_ref;
54821         ser_ref.datalen = ser->arr_len;
54822         ser_ref.data = ser->elems;
54823         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
54824         *ret_conv = TxAddOutput_read(ser_ref);
54825         FREE(ser);
54826         return tag_ptr(ret_conv, true);
54827 }
54828
54829 int8_tArray  __attribute__((export_name("TS_TxRemoveInput_write"))) TS_TxRemoveInput_write(uint64_t obj) {
54830         LDKTxRemoveInput obj_conv;
54831         obj_conv.inner = untag_ptr(obj);
54832         obj_conv.is_owned = ptr_is_owned(obj);
54833         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54834         obj_conv.is_owned = false;
54835         LDKCVec_u8Z ret_var = TxRemoveInput_write(&obj_conv);
54836         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54837         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54838         CVec_u8Z_free(ret_var);
54839         return ret_arr;
54840 }
54841
54842 uint64_t  __attribute__((export_name("TS_TxRemoveInput_read"))) TS_TxRemoveInput_read(int8_tArray ser) {
54843         LDKu8slice ser_ref;
54844         ser_ref.datalen = ser->arr_len;
54845         ser_ref.data = ser->elems;
54846         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
54847         *ret_conv = TxRemoveInput_read(ser_ref);
54848         FREE(ser);
54849         return tag_ptr(ret_conv, true);
54850 }
54851
54852 int8_tArray  __attribute__((export_name("TS_TxRemoveOutput_write"))) TS_TxRemoveOutput_write(uint64_t obj) {
54853         LDKTxRemoveOutput obj_conv;
54854         obj_conv.inner = untag_ptr(obj);
54855         obj_conv.is_owned = ptr_is_owned(obj);
54856         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54857         obj_conv.is_owned = false;
54858         LDKCVec_u8Z ret_var = TxRemoveOutput_write(&obj_conv);
54859         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54860         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54861         CVec_u8Z_free(ret_var);
54862         return ret_arr;
54863 }
54864
54865 uint64_t  __attribute__((export_name("TS_TxRemoveOutput_read"))) TS_TxRemoveOutput_read(int8_tArray ser) {
54866         LDKu8slice ser_ref;
54867         ser_ref.datalen = ser->arr_len;
54868         ser_ref.data = ser->elems;
54869         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
54870         *ret_conv = TxRemoveOutput_read(ser_ref);
54871         FREE(ser);
54872         return tag_ptr(ret_conv, true);
54873 }
54874
54875 int8_tArray  __attribute__((export_name("TS_TxComplete_write"))) TS_TxComplete_write(uint64_t obj) {
54876         LDKTxComplete obj_conv;
54877         obj_conv.inner = untag_ptr(obj);
54878         obj_conv.is_owned = ptr_is_owned(obj);
54879         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54880         obj_conv.is_owned = false;
54881         LDKCVec_u8Z ret_var = TxComplete_write(&obj_conv);
54882         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54883         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54884         CVec_u8Z_free(ret_var);
54885         return ret_arr;
54886 }
54887
54888 uint64_t  __attribute__((export_name("TS_TxComplete_read"))) TS_TxComplete_read(int8_tArray ser) {
54889         LDKu8slice ser_ref;
54890         ser_ref.datalen = ser->arr_len;
54891         ser_ref.data = ser->elems;
54892         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
54893         *ret_conv = TxComplete_read(ser_ref);
54894         FREE(ser);
54895         return tag_ptr(ret_conv, true);
54896 }
54897
54898 int8_tArray  __attribute__((export_name("TS_TxSignatures_write"))) TS_TxSignatures_write(uint64_t obj) {
54899         LDKTxSignatures obj_conv;
54900         obj_conv.inner = untag_ptr(obj);
54901         obj_conv.is_owned = ptr_is_owned(obj);
54902         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54903         obj_conv.is_owned = false;
54904         LDKCVec_u8Z ret_var = TxSignatures_write(&obj_conv);
54905         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54906         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54907         CVec_u8Z_free(ret_var);
54908         return ret_arr;
54909 }
54910
54911 uint64_t  __attribute__((export_name("TS_TxSignatures_read"))) TS_TxSignatures_read(int8_tArray ser) {
54912         LDKu8slice ser_ref;
54913         ser_ref.datalen = ser->arr_len;
54914         ser_ref.data = ser->elems;
54915         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
54916         *ret_conv = TxSignatures_read(ser_ref);
54917         FREE(ser);
54918         return tag_ptr(ret_conv, true);
54919 }
54920
54921 int8_tArray  __attribute__((export_name("TS_TxInitRbf_write"))) TS_TxInitRbf_write(uint64_t obj) {
54922         LDKTxInitRbf obj_conv;
54923         obj_conv.inner = untag_ptr(obj);
54924         obj_conv.is_owned = ptr_is_owned(obj);
54925         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54926         obj_conv.is_owned = false;
54927         LDKCVec_u8Z ret_var = TxInitRbf_write(&obj_conv);
54928         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54929         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54930         CVec_u8Z_free(ret_var);
54931         return ret_arr;
54932 }
54933
54934 uint64_t  __attribute__((export_name("TS_TxInitRbf_read"))) TS_TxInitRbf_read(int8_tArray ser) {
54935         LDKu8slice ser_ref;
54936         ser_ref.datalen = ser->arr_len;
54937         ser_ref.data = ser->elems;
54938         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
54939         *ret_conv = TxInitRbf_read(ser_ref);
54940         FREE(ser);
54941         return tag_ptr(ret_conv, true);
54942 }
54943
54944 int8_tArray  __attribute__((export_name("TS_TxAckRbf_write"))) TS_TxAckRbf_write(uint64_t obj) {
54945         LDKTxAckRbf obj_conv;
54946         obj_conv.inner = untag_ptr(obj);
54947         obj_conv.is_owned = ptr_is_owned(obj);
54948         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54949         obj_conv.is_owned = false;
54950         LDKCVec_u8Z ret_var = TxAckRbf_write(&obj_conv);
54951         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54952         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54953         CVec_u8Z_free(ret_var);
54954         return ret_arr;
54955 }
54956
54957 uint64_t  __attribute__((export_name("TS_TxAckRbf_read"))) TS_TxAckRbf_read(int8_tArray ser) {
54958         LDKu8slice ser_ref;
54959         ser_ref.datalen = ser->arr_len;
54960         ser_ref.data = ser->elems;
54961         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
54962         *ret_conv = TxAckRbf_read(ser_ref);
54963         FREE(ser);
54964         return tag_ptr(ret_conv, true);
54965 }
54966
54967 int8_tArray  __attribute__((export_name("TS_TxAbort_write"))) TS_TxAbort_write(uint64_t obj) {
54968         LDKTxAbort obj_conv;
54969         obj_conv.inner = untag_ptr(obj);
54970         obj_conv.is_owned = ptr_is_owned(obj);
54971         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54972         obj_conv.is_owned = false;
54973         LDKCVec_u8Z ret_var = TxAbort_write(&obj_conv);
54974         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54975         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54976         CVec_u8Z_free(ret_var);
54977         return ret_arr;
54978 }
54979
54980 uint64_t  __attribute__((export_name("TS_TxAbort_read"))) TS_TxAbort_read(int8_tArray ser) {
54981         LDKu8slice ser_ref;
54982         ser_ref.datalen = ser->arr_len;
54983         ser_ref.data = ser->elems;
54984         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
54985         *ret_conv = TxAbort_read(ser_ref);
54986         FREE(ser);
54987         return tag_ptr(ret_conv, true);
54988 }
54989
54990 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_write"))) TS_AnnouncementSignatures_write(uint64_t obj) {
54991         LDKAnnouncementSignatures obj_conv;
54992         obj_conv.inner = untag_ptr(obj);
54993         obj_conv.is_owned = ptr_is_owned(obj);
54994         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54995         obj_conv.is_owned = false;
54996         LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
54997         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54998         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54999         CVec_u8Z_free(ret_var);
55000         return ret_arr;
55001 }
55002
55003 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_read"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
55004         LDKu8slice ser_ref;
55005         ser_ref.datalen = ser->arr_len;
55006         ser_ref.data = ser->elems;
55007         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
55008         *ret_conv = AnnouncementSignatures_read(ser_ref);
55009         FREE(ser);
55010         return tag_ptr(ret_conv, true);
55011 }
55012
55013 int8_tArray  __attribute__((export_name("TS_ChannelReestablish_write"))) TS_ChannelReestablish_write(uint64_t obj) {
55014         LDKChannelReestablish obj_conv;
55015         obj_conv.inner = untag_ptr(obj);
55016         obj_conv.is_owned = ptr_is_owned(obj);
55017         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55018         obj_conv.is_owned = false;
55019         LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
55020         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55021         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55022         CVec_u8Z_free(ret_var);
55023         return ret_arr;
55024 }
55025
55026 uint64_t  __attribute__((export_name("TS_ChannelReestablish_read"))) TS_ChannelReestablish_read(int8_tArray ser) {
55027         LDKu8slice ser_ref;
55028         ser_ref.datalen = ser->arr_len;
55029         ser_ref.data = ser->elems;
55030         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
55031         *ret_conv = ChannelReestablish_read(ser_ref);
55032         FREE(ser);
55033         return tag_ptr(ret_conv, true);
55034 }
55035
55036 int8_tArray  __attribute__((export_name("TS_ClosingSigned_write"))) TS_ClosingSigned_write(uint64_t obj) {
55037         LDKClosingSigned obj_conv;
55038         obj_conv.inner = untag_ptr(obj);
55039         obj_conv.is_owned = ptr_is_owned(obj);
55040         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55041         obj_conv.is_owned = false;
55042         LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
55043         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55044         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55045         CVec_u8Z_free(ret_var);
55046         return ret_arr;
55047 }
55048
55049 uint64_t  __attribute__((export_name("TS_ClosingSigned_read"))) TS_ClosingSigned_read(int8_tArray ser) {
55050         LDKu8slice ser_ref;
55051         ser_ref.datalen = ser->arr_len;
55052         ser_ref.data = ser->elems;
55053         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
55054         *ret_conv = ClosingSigned_read(ser_ref);
55055         FREE(ser);
55056         return tag_ptr(ret_conv, true);
55057 }
55058
55059 int8_tArray  __attribute__((export_name("TS_ClosingSignedFeeRange_write"))) TS_ClosingSignedFeeRange_write(uint64_t obj) {
55060         LDKClosingSignedFeeRange obj_conv;
55061         obj_conv.inner = untag_ptr(obj);
55062         obj_conv.is_owned = ptr_is_owned(obj);
55063         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55064         obj_conv.is_owned = false;
55065         LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
55066         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55067         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55068         CVec_u8Z_free(ret_var);
55069         return ret_arr;
55070 }
55071
55072 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_read"))) TS_ClosingSignedFeeRange_read(int8_tArray ser) {
55073         LDKu8slice ser_ref;
55074         ser_ref.datalen = ser->arr_len;
55075         ser_ref.data = ser->elems;
55076         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
55077         *ret_conv = ClosingSignedFeeRange_read(ser_ref);
55078         FREE(ser);
55079         return tag_ptr(ret_conv, true);
55080 }
55081
55082 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_write"))) TS_CommitmentSigned_write(uint64_t obj) {
55083         LDKCommitmentSigned obj_conv;
55084         obj_conv.inner = untag_ptr(obj);
55085         obj_conv.is_owned = ptr_is_owned(obj);
55086         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55087         obj_conv.is_owned = false;
55088         LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
55089         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55090         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55091         CVec_u8Z_free(ret_var);
55092         return ret_arr;
55093 }
55094
55095 uint64_t  __attribute__((export_name("TS_CommitmentSigned_read"))) TS_CommitmentSigned_read(int8_tArray ser) {
55096         LDKu8slice ser_ref;
55097         ser_ref.datalen = ser->arr_len;
55098         ser_ref.data = ser->elems;
55099         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
55100         *ret_conv = CommitmentSigned_read(ser_ref);
55101         FREE(ser);
55102         return tag_ptr(ret_conv, true);
55103 }
55104
55105 int8_tArray  __attribute__((export_name("TS_FundingCreated_write"))) TS_FundingCreated_write(uint64_t obj) {
55106         LDKFundingCreated obj_conv;
55107         obj_conv.inner = untag_ptr(obj);
55108         obj_conv.is_owned = ptr_is_owned(obj);
55109         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55110         obj_conv.is_owned = false;
55111         LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
55112         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55113         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55114         CVec_u8Z_free(ret_var);
55115         return ret_arr;
55116 }
55117
55118 uint64_t  __attribute__((export_name("TS_FundingCreated_read"))) TS_FundingCreated_read(int8_tArray ser) {
55119         LDKu8slice ser_ref;
55120         ser_ref.datalen = ser->arr_len;
55121         ser_ref.data = ser->elems;
55122         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
55123         *ret_conv = FundingCreated_read(ser_ref);
55124         FREE(ser);
55125         return tag_ptr(ret_conv, true);
55126 }
55127
55128 int8_tArray  __attribute__((export_name("TS_FundingSigned_write"))) TS_FundingSigned_write(uint64_t obj) {
55129         LDKFundingSigned obj_conv;
55130         obj_conv.inner = untag_ptr(obj);
55131         obj_conv.is_owned = ptr_is_owned(obj);
55132         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55133         obj_conv.is_owned = false;
55134         LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
55135         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55136         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55137         CVec_u8Z_free(ret_var);
55138         return ret_arr;
55139 }
55140
55141 uint64_t  __attribute__((export_name("TS_FundingSigned_read"))) TS_FundingSigned_read(int8_tArray ser) {
55142         LDKu8slice ser_ref;
55143         ser_ref.datalen = ser->arr_len;
55144         ser_ref.data = ser->elems;
55145         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
55146         *ret_conv = FundingSigned_read(ser_ref);
55147         FREE(ser);
55148         return tag_ptr(ret_conv, true);
55149 }
55150
55151 int8_tArray  __attribute__((export_name("TS_ChannelReady_write"))) TS_ChannelReady_write(uint64_t obj) {
55152         LDKChannelReady obj_conv;
55153         obj_conv.inner = untag_ptr(obj);
55154         obj_conv.is_owned = ptr_is_owned(obj);
55155         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55156         obj_conv.is_owned = false;
55157         LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
55158         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55159         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55160         CVec_u8Z_free(ret_var);
55161         return ret_arr;
55162 }
55163
55164 uint64_t  __attribute__((export_name("TS_ChannelReady_read"))) TS_ChannelReady_read(int8_tArray ser) {
55165         LDKu8slice ser_ref;
55166         ser_ref.datalen = ser->arr_len;
55167         ser_ref.data = ser->elems;
55168         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
55169         *ret_conv = ChannelReady_read(ser_ref);
55170         FREE(ser);
55171         return tag_ptr(ret_conv, true);
55172 }
55173
55174 int8_tArray  __attribute__((export_name("TS_Init_write"))) TS_Init_write(uint64_t obj) {
55175         LDKInit obj_conv;
55176         obj_conv.inner = untag_ptr(obj);
55177         obj_conv.is_owned = ptr_is_owned(obj);
55178         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55179         obj_conv.is_owned = false;
55180         LDKCVec_u8Z ret_var = Init_write(&obj_conv);
55181         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55182         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55183         CVec_u8Z_free(ret_var);
55184         return ret_arr;
55185 }
55186
55187 uint64_t  __attribute__((export_name("TS_Init_read"))) TS_Init_read(int8_tArray ser) {
55188         LDKu8slice ser_ref;
55189         ser_ref.datalen = ser->arr_len;
55190         ser_ref.data = ser->elems;
55191         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
55192         *ret_conv = Init_read(ser_ref);
55193         FREE(ser);
55194         return tag_ptr(ret_conv, true);
55195 }
55196
55197 int8_tArray  __attribute__((export_name("TS_OpenChannel_write"))) TS_OpenChannel_write(uint64_t obj) {
55198         LDKOpenChannel obj_conv;
55199         obj_conv.inner = untag_ptr(obj);
55200         obj_conv.is_owned = ptr_is_owned(obj);
55201         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55202         obj_conv.is_owned = false;
55203         LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
55204         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55205         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55206         CVec_u8Z_free(ret_var);
55207         return ret_arr;
55208 }
55209
55210 uint64_t  __attribute__((export_name("TS_OpenChannel_read"))) TS_OpenChannel_read(int8_tArray ser) {
55211         LDKu8slice ser_ref;
55212         ser_ref.datalen = ser->arr_len;
55213         ser_ref.data = ser->elems;
55214         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
55215         *ret_conv = OpenChannel_read(ser_ref);
55216         FREE(ser);
55217         return tag_ptr(ret_conv, true);
55218 }
55219
55220 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_write"))) TS_OpenChannelV2_write(uint64_t obj) {
55221         LDKOpenChannelV2 obj_conv;
55222         obj_conv.inner = untag_ptr(obj);
55223         obj_conv.is_owned = ptr_is_owned(obj);
55224         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55225         obj_conv.is_owned = false;
55226         LDKCVec_u8Z ret_var = OpenChannelV2_write(&obj_conv);
55227         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55228         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55229         CVec_u8Z_free(ret_var);
55230         return ret_arr;
55231 }
55232
55233 uint64_t  __attribute__((export_name("TS_OpenChannelV2_read"))) TS_OpenChannelV2_read(int8_tArray ser) {
55234         LDKu8slice ser_ref;
55235         ser_ref.datalen = ser->arr_len;
55236         ser_ref.data = ser->elems;
55237         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
55238         *ret_conv = OpenChannelV2_read(ser_ref);
55239         FREE(ser);
55240         return tag_ptr(ret_conv, true);
55241 }
55242
55243 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_write"))) TS_RevokeAndACK_write(uint64_t obj) {
55244         LDKRevokeAndACK obj_conv;
55245         obj_conv.inner = untag_ptr(obj);
55246         obj_conv.is_owned = ptr_is_owned(obj);
55247         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55248         obj_conv.is_owned = false;
55249         LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
55250         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55251         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55252         CVec_u8Z_free(ret_var);
55253         return ret_arr;
55254 }
55255
55256 uint64_t  __attribute__((export_name("TS_RevokeAndACK_read"))) TS_RevokeAndACK_read(int8_tArray ser) {
55257         LDKu8slice ser_ref;
55258         ser_ref.datalen = ser->arr_len;
55259         ser_ref.data = ser->elems;
55260         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
55261         *ret_conv = RevokeAndACK_read(ser_ref);
55262         FREE(ser);
55263         return tag_ptr(ret_conv, true);
55264 }
55265
55266 int8_tArray  __attribute__((export_name("TS_Shutdown_write"))) TS_Shutdown_write(uint64_t obj) {
55267         LDKShutdown obj_conv;
55268         obj_conv.inner = untag_ptr(obj);
55269         obj_conv.is_owned = ptr_is_owned(obj);
55270         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55271         obj_conv.is_owned = false;
55272         LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
55273         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55274         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55275         CVec_u8Z_free(ret_var);
55276         return ret_arr;
55277 }
55278
55279 uint64_t  __attribute__((export_name("TS_Shutdown_read"))) TS_Shutdown_read(int8_tArray ser) {
55280         LDKu8slice ser_ref;
55281         ser_ref.datalen = ser->arr_len;
55282         ser_ref.data = ser->elems;
55283         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
55284         *ret_conv = Shutdown_read(ser_ref);
55285         FREE(ser);
55286         return tag_ptr(ret_conv, true);
55287 }
55288
55289 int8_tArray  __attribute__((export_name("TS_UpdateFailHTLC_write"))) TS_UpdateFailHTLC_write(uint64_t obj) {
55290         LDKUpdateFailHTLC obj_conv;
55291         obj_conv.inner = untag_ptr(obj);
55292         obj_conv.is_owned = ptr_is_owned(obj);
55293         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55294         obj_conv.is_owned = false;
55295         LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
55296         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55297         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55298         CVec_u8Z_free(ret_var);
55299         return ret_arr;
55300 }
55301
55302 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_read"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
55303         LDKu8slice ser_ref;
55304         ser_ref.datalen = ser->arr_len;
55305         ser_ref.data = ser->elems;
55306         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
55307         *ret_conv = UpdateFailHTLC_read(ser_ref);
55308         FREE(ser);
55309         return tag_ptr(ret_conv, true);
55310 }
55311
55312 int8_tArray  __attribute__((export_name("TS_UpdateFailMalformedHTLC_write"))) TS_UpdateFailMalformedHTLC_write(uint64_t obj) {
55313         LDKUpdateFailMalformedHTLC obj_conv;
55314         obj_conv.inner = untag_ptr(obj);
55315         obj_conv.is_owned = ptr_is_owned(obj);
55316         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55317         obj_conv.is_owned = false;
55318         LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
55319         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55320         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55321         CVec_u8Z_free(ret_var);
55322         return ret_arr;
55323 }
55324
55325 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_read"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
55326         LDKu8slice ser_ref;
55327         ser_ref.datalen = ser->arr_len;
55328         ser_ref.data = ser->elems;
55329         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
55330         *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
55331         FREE(ser);
55332         return tag_ptr(ret_conv, true);
55333 }
55334
55335 int8_tArray  __attribute__((export_name("TS_UpdateFee_write"))) TS_UpdateFee_write(uint64_t obj) {
55336         LDKUpdateFee obj_conv;
55337         obj_conv.inner = untag_ptr(obj);
55338         obj_conv.is_owned = ptr_is_owned(obj);
55339         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55340         obj_conv.is_owned = false;
55341         LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
55342         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55343         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55344         CVec_u8Z_free(ret_var);
55345         return ret_arr;
55346 }
55347
55348 uint64_t  __attribute__((export_name("TS_UpdateFee_read"))) TS_UpdateFee_read(int8_tArray ser) {
55349         LDKu8slice ser_ref;
55350         ser_ref.datalen = ser->arr_len;
55351         ser_ref.data = ser->elems;
55352         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
55353         *ret_conv = UpdateFee_read(ser_ref);
55354         FREE(ser);
55355         return tag_ptr(ret_conv, true);
55356 }
55357
55358 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_write"))) TS_UpdateFulfillHTLC_write(uint64_t obj) {
55359         LDKUpdateFulfillHTLC obj_conv;
55360         obj_conv.inner = untag_ptr(obj);
55361         obj_conv.is_owned = ptr_is_owned(obj);
55362         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55363         obj_conv.is_owned = false;
55364         LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
55365         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55366         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55367         CVec_u8Z_free(ret_var);
55368         return ret_arr;
55369 }
55370
55371 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_read"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
55372         LDKu8slice ser_ref;
55373         ser_ref.datalen = ser->arr_len;
55374         ser_ref.data = ser->elems;
55375         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
55376         *ret_conv = UpdateFulfillHTLC_read(ser_ref);
55377         FREE(ser);
55378         return tag_ptr(ret_conv, true);
55379 }
55380
55381 int8_tArray  __attribute__((export_name("TS_OnionPacket_write"))) TS_OnionPacket_write(uint64_t obj) {
55382         LDKOnionPacket obj_conv;
55383         obj_conv.inner = untag_ptr(obj);
55384         obj_conv.is_owned = ptr_is_owned(obj);
55385         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55386         obj_conv.is_owned = false;
55387         LDKCVec_u8Z ret_var = OnionPacket_write(&obj_conv);
55388         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55389         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55390         CVec_u8Z_free(ret_var);
55391         return ret_arr;
55392 }
55393
55394 uint64_t  __attribute__((export_name("TS_OnionPacket_read"))) TS_OnionPacket_read(int8_tArray ser) {
55395         LDKu8slice ser_ref;
55396         ser_ref.datalen = ser->arr_len;
55397         ser_ref.data = ser->elems;
55398         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
55399         *ret_conv = OnionPacket_read(ser_ref);
55400         FREE(ser);
55401         return tag_ptr(ret_conv, true);
55402 }
55403
55404 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_write"))) TS_UpdateAddHTLC_write(uint64_t obj) {
55405         LDKUpdateAddHTLC obj_conv;
55406         obj_conv.inner = untag_ptr(obj);
55407         obj_conv.is_owned = ptr_is_owned(obj);
55408         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55409         obj_conv.is_owned = false;
55410         LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
55411         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55412         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55413         CVec_u8Z_free(ret_var);
55414         return ret_arr;
55415 }
55416
55417 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_read"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
55418         LDKu8slice ser_ref;
55419         ser_ref.datalen = ser->arr_len;
55420         ser_ref.data = ser->elems;
55421         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
55422         *ret_conv = UpdateAddHTLC_read(ser_ref);
55423         FREE(ser);
55424         return tag_ptr(ret_conv, true);
55425 }
55426
55427 uint64_t  __attribute__((export_name("TS_OnionMessage_read"))) TS_OnionMessage_read(int8_tArray ser) {
55428         LDKu8slice ser_ref;
55429         ser_ref.datalen = ser->arr_len;
55430         ser_ref.data = ser->elems;
55431         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
55432         *ret_conv = OnionMessage_read(ser_ref);
55433         FREE(ser);
55434         return tag_ptr(ret_conv, true);
55435 }
55436
55437 int8_tArray  __attribute__((export_name("TS_OnionMessage_write"))) TS_OnionMessage_write(uint64_t obj) {
55438         LDKOnionMessage obj_conv;
55439         obj_conv.inner = untag_ptr(obj);
55440         obj_conv.is_owned = ptr_is_owned(obj);
55441         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55442         obj_conv.is_owned = false;
55443         LDKCVec_u8Z ret_var = OnionMessage_write(&obj_conv);
55444         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55445         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55446         CVec_u8Z_free(ret_var);
55447         return ret_arr;
55448 }
55449
55450 int8_tArray  __attribute__((export_name("TS_FinalOnionHopData_write"))) TS_FinalOnionHopData_write(uint64_t obj) {
55451         LDKFinalOnionHopData obj_conv;
55452         obj_conv.inner = untag_ptr(obj);
55453         obj_conv.is_owned = ptr_is_owned(obj);
55454         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55455         obj_conv.is_owned = false;
55456         LDKCVec_u8Z ret_var = FinalOnionHopData_write(&obj_conv);
55457         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55458         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55459         CVec_u8Z_free(ret_var);
55460         return ret_arr;
55461 }
55462
55463 uint64_t  __attribute__((export_name("TS_FinalOnionHopData_read"))) TS_FinalOnionHopData_read(int8_tArray ser) {
55464         LDKu8slice ser_ref;
55465         ser_ref.datalen = ser->arr_len;
55466         ser_ref.data = ser->elems;
55467         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
55468         *ret_conv = FinalOnionHopData_read(ser_ref);
55469         FREE(ser);
55470         return tag_ptr(ret_conv, true);
55471 }
55472
55473 int8_tArray  __attribute__((export_name("TS_Ping_write"))) TS_Ping_write(uint64_t obj) {
55474         LDKPing obj_conv;
55475         obj_conv.inner = untag_ptr(obj);
55476         obj_conv.is_owned = ptr_is_owned(obj);
55477         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55478         obj_conv.is_owned = false;
55479         LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
55480         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55481         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55482         CVec_u8Z_free(ret_var);
55483         return ret_arr;
55484 }
55485
55486 uint64_t  __attribute__((export_name("TS_Ping_read"))) TS_Ping_read(int8_tArray ser) {
55487         LDKu8slice ser_ref;
55488         ser_ref.datalen = ser->arr_len;
55489         ser_ref.data = ser->elems;
55490         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
55491         *ret_conv = Ping_read(ser_ref);
55492         FREE(ser);
55493         return tag_ptr(ret_conv, true);
55494 }
55495
55496 int8_tArray  __attribute__((export_name("TS_Pong_write"))) TS_Pong_write(uint64_t obj) {
55497         LDKPong obj_conv;
55498         obj_conv.inner = untag_ptr(obj);
55499         obj_conv.is_owned = ptr_is_owned(obj);
55500         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55501         obj_conv.is_owned = false;
55502         LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
55503         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55504         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55505         CVec_u8Z_free(ret_var);
55506         return ret_arr;
55507 }
55508
55509 uint64_t  __attribute__((export_name("TS_Pong_read"))) TS_Pong_read(int8_tArray ser) {
55510         LDKu8slice ser_ref;
55511         ser_ref.datalen = ser->arr_len;
55512         ser_ref.data = ser->elems;
55513         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
55514         *ret_conv = Pong_read(ser_ref);
55515         FREE(ser);
55516         return tag_ptr(ret_conv, true);
55517 }
55518
55519 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_write"))) TS_UnsignedChannelAnnouncement_write(uint64_t obj) {
55520         LDKUnsignedChannelAnnouncement obj_conv;
55521         obj_conv.inner = untag_ptr(obj);
55522         obj_conv.is_owned = ptr_is_owned(obj);
55523         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55524         obj_conv.is_owned = false;
55525         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
55526         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55527         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55528         CVec_u8Z_free(ret_var);
55529         return ret_arr;
55530 }
55531
55532 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_read"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
55533         LDKu8slice ser_ref;
55534         ser_ref.datalen = ser->arr_len;
55535         ser_ref.data = ser->elems;
55536         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
55537         *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
55538         FREE(ser);
55539         return tag_ptr(ret_conv, true);
55540 }
55541
55542 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_write"))) TS_ChannelAnnouncement_write(uint64_t obj) {
55543         LDKChannelAnnouncement obj_conv;
55544         obj_conv.inner = untag_ptr(obj);
55545         obj_conv.is_owned = ptr_is_owned(obj);
55546         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55547         obj_conv.is_owned = false;
55548         LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
55549         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55550         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55551         CVec_u8Z_free(ret_var);
55552         return ret_arr;
55553 }
55554
55555 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_read"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
55556         LDKu8slice ser_ref;
55557         ser_ref.datalen = ser->arr_len;
55558         ser_ref.data = ser->elems;
55559         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
55560         *ret_conv = ChannelAnnouncement_read(ser_ref);
55561         FREE(ser);
55562         return tag_ptr(ret_conv, true);
55563 }
55564
55565 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_write"))) TS_UnsignedChannelUpdate_write(uint64_t obj) {
55566         LDKUnsignedChannelUpdate obj_conv;
55567         obj_conv.inner = untag_ptr(obj);
55568         obj_conv.is_owned = ptr_is_owned(obj);
55569         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55570         obj_conv.is_owned = false;
55571         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
55572         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55573         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55574         CVec_u8Z_free(ret_var);
55575         return ret_arr;
55576 }
55577
55578 uint64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_read"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
55579         LDKu8slice ser_ref;
55580         ser_ref.datalen = ser->arr_len;
55581         ser_ref.data = ser->elems;
55582         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
55583         *ret_conv = UnsignedChannelUpdate_read(ser_ref);
55584         FREE(ser);
55585         return tag_ptr(ret_conv, true);
55586 }
55587
55588 int8_tArray  __attribute__((export_name("TS_ChannelUpdate_write"))) TS_ChannelUpdate_write(uint64_t obj) {
55589         LDKChannelUpdate obj_conv;
55590         obj_conv.inner = untag_ptr(obj);
55591         obj_conv.is_owned = ptr_is_owned(obj);
55592         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55593         obj_conv.is_owned = false;
55594         LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
55595         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55596         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55597         CVec_u8Z_free(ret_var);
55598         return ret_arr;
55599 }
55600
55601 uint64_t  __attribute__((export_name("TS_ChannelUpdate_read"))) TS_ChannelUpdate_read(int8_tArray ser) {
55602         LDKu8slice ser_ref;
55603         ser_ref.datalen = ser->arr_len;
55604         ser_ref.data = ser->elems;
55605         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
55606         *ret_conv = ChannelUpdate_read(ser_ref);
55607         FREE(ser);
55608         return tag_ptr(ret_conv, true);
55609 }
55610
55611 int8_tArray  __attribute__((export_name("TS_ErrorMessage_write"))) TS_ErrorMessage_write(uint64_t obj) {
55612         LDKErrorMessage obj_conv;
55613         obj_conv.inner = untag_ptr(obj);
55614         obj_conv.is_owned = ptr_is_owned(obj);
55615         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55616         obj_conv.is_owned = false;
55617         LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
55618         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55619         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55620         CVec_u8Z_free(ret_var);
55621         return ret_arr;
55622 }
55623
55624 uint64_t  __attribute__((export_name("TS_ErrorMessage_read"))) TS_ErrorMessage_read(int8_tArray ser) {
55625         LDKu8slice ser_ref;
55626         ser_ref.datalen = ser->arr_len;
55627         ser_ref.data = ser->elems;
55628         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
55629         *ret_conv = ErrorMessage_read(ser_ref);
55630         FREE(ser);
55631         return tag_ptr(ret_conv, true);
55632 }
55633
55634 int8_tArray  __attribute__((export_name("TS_WarningMessage_write"))) TS_WarningMessage_write(uint64_t obj) {
55635         LDKWarningMessage obj_conv;
55636         obj_conv.inner = untag_ptr(obj);
55637         obj_conv.is_owned = ptr_is_owned(obj);
55638         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55639         obj_conv.is_owned = false;
55640         LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
55641         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55642         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55643         CVec_u8Z_free(ret_var);
55644         return ret_arr;
55645 }
55646
55647 uint64_t  __attribute__((export_name("TS_WarningMessage_read"))) TS_WarningMessage_read(int8_tArray ser) {
55648         LDKu8slice ser_ref;
55649         ser_ref.datalen = ser->arr_len;
55650         ser_ref.data = ser->elems;
55651         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
55652         *ret_conv = WarningMessage_read(ser_ref);
55653         FREE(ser);
55654         return tag_ptr(ret_conv, true);
55655 }
55656
55657 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_write"))) TS_UnsignedNodeAnnouncement_write(uint64_t obj) {
55658         LDKUnsignedNodeAnnouncement obj_conv;
55659         obj_conv.inner = untag_ptr(obj);
55660         obj_conv.is_owned = ptr_is_owned(obj);
55661         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55662         obj_conv.is_owned = false;
55663         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
55664         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55665         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55666         CVec_u8Z_free(ret_var);
55667         return ret_arr;
55668 }
55669
55670 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_read"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
55671         LDKu8slice ser_ref;
55672         ser_ref.datalen = ser->arr_len;
55673         ser_ref.data = ser->elems;
55674         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
55675         *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
55676         FREE(ser);
55677         return tag_ptr(ret_conv, true);
55678 }
55679
55680 int8_tArray  __attribute__((export_name("TS_NodeAnnouncement_write"))) TS_NodeAnnouncement_write(uint64_t obj) {
55681         LDKNodeAnnouncement obj_conv;
55682         obj_conv.inner = untag_ptr(obj);
55683         obj_conv.is_owned = ptr_is_owned(obj);
55684         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55685         obj_conv.is_owned = false;
55686         LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
55687         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55688         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55689         CVec_u8Z_free(ret_var);
55690         return ret_arr;
55691 }
55692
55693 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_read"))) TS_NodeAnnouncement_read(int8_tArray ser) {
55694         LDKu8slice ser_ref;
55695         ser_ref.datalen = ser->arr_len;
55696         ser_ref.data = ser->elems;
55697         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
55698         *ret_conv = NodeAnnouncement_read(ser_ref);
55699         FREE(ser);
55700         return tag_ptr(ret_conv, true);
55701 }
55702
55703 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_read"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
55704         LDKu8slice ser_ref;
55705         ser_ref.datalen = ser->arr_len;
55706         ser_ref.data = ser->elems;
55707         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
55708         *ret_conv = QueryShortChannelIds_read(ser_ref);
55709         FREE(ser);
55710         return tag_ptr(ret_conv, true);
55711 }
55712
55713 int8_tArray  __attribute__((export_name("TS_QueryShortChannelIds_write"))) TS_QueryShortChannelIds_write(uint64_t obj) {
55714         LDKQueryShortChannelIds obj_conv;
55715         obj_conv.inner = untag_ptr(obj);
55716         obj_conv.is_owned = ptr_is_owned(obj);
55717         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55718         obj_conv.is_owned = false;
55719         LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
55720         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55721         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55722         CVec_u8Z_free(ret_var);
55723         return ret_arr;
55724 }
55725
55726 int8_tArray  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_write"))) TS_ReplyShortChannelIdsEnd_write(uint64_t obj) {
55727         LDKReplyShortChannelIdsEnd obj_conv;
55728         obj_conv.inner = untag_ptr(obj);
55729         obj_conv.is_owned = ptr_is_owned(obj);
55730         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55731         obj_conv.is_owned = false;
55732         LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
55733         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55734         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55735         CVec_u8Z_free(ret_var);
55736         return ret_arr;
55737 }
55738
55739 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_read"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
55740         LDKu8slice ser_ref;
55741         ser_ref.datalen = ser->arr_len;
55742         ser_ref.data = ser->elems;
55743         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
55744         *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
55745         FREE(ser);
55746         return tag_ptr(ret_conv, true);
55747 }
55748
55749 int32_t  __attribute__((export_name("TS_QueryChannelRange_end_blocknum"))) TS_QueryChannelRange_end_blocknum(uint64_t this_arg) {
55750         LDKQueryChannelRange this_arg_conv;
55751         this_arg_conv.inner = untag_ptr(this_arg);
55752         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55754         this_arg_conv.is_owned = false;
55755         int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
55756         return ret_conv;
55757 }
55758
55759 int8_tArray  __attribute__((export_name("TS_QueryChannelRange_write"))) TS_QueryChannelRange_write(uint64_t obj) {
55760         LDKQueryChannelRange obj_conv;
55761         obj_conv.inner = untag_ptr(obj);
55762         obj_conv.is_owned = ptr_is_owned(obj);
55763         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55764         obj_conv.is_owned = false;
55765         LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
55766         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55767         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55768         CVec_u8Z_free(ret_var);
55769         return ret_arr;
55770 }
55771
55772 uint64_t  __attribute__((export_name("TS_QueryChannelRange_read"))) TS_QueryChannelRange_read(int8_tArray ser) {
55773         LDKu8slice ser_ref;
55774         ser_ref.datalen = ser->arr_len;
55775         ser_ref.data = ser->elems;
55776         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
55777         *ret_conv = QueryChannelRange_read(ser_ref);
55778         FREE(ser);
55779         return tag_ptr(ret_conv, true);
55780 }
55781
55782 uint64_t  __attribute__((export_name("TS_ReplyChannelRange_read"))) TS_ReplyChannelRange_read(int8_tArray ser) {
55783         LDKu8slice ser_ref;
55784         ser_ref.datalen = ser->arr_len;
55785         ser_ref.data = ser->elems;
55786         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
55787         *ret_conv = ReplyChannelRange_read(ser_ref);
55788         FREE(ser);
55789         return tag_ptr(ret_conv, true);
55790 }
55791
55792 int8_tArray  __attribute__((export_name("TS_ReplyChannelRange_write"))) TS_ReplyChannelRange_write(uint64_t obj) {
55793         LDKReplyChannelRange obj_conv;
55794         obj_conv.inner = untag_ptr(obj);
55795         obj_conv.is_owned = ptr_is_owned(obj);
55796         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55797         obj_conv.is_owned = false;
55798         LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
55799         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55800         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55801         CVec_u8Z_free(ret_var);
55802         return ret_arr;
55803 }
55804
55805 int8_tArray  __attribute__((export_name("TS_GossipTimestampFilter_write"))) TS_GossipTimestampFilter_write(uint64_t obj) {
55806         LDKGossipTimestampFilter obj_conv;
55807         obj_conv.inner = untag_ptr(obj);
55808         obj_conv.is_owned = ptr_is_owned(obj);
55809         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55810         obj_conv.is_owned = false;
55811         LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
55812         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55813         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55814         CVec_u8Z_free(ret_var);
55815         return ret_arr;
55816 }
55817
55818 uint64_t  __attribute__((export_name("TS_GossipTimestampFilter_read"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
55819         LDKu8slice ser_ref;
55820         ser_ref.datalen = ser->arr_len;
55821         ser_ref.data = ser->elems;
55822         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
55823         *ret_conv = GossipTimestampFilter_read(ser_ref);
55824         FREE(ser);
55825         return tag_ptr(ret_conv, true);
55826 }
55827
55828 void  __attribute__((export_name("TS_CustomMessageHandler_free"))) TS_CustomMessageHandler_free(uint64_t this_ptr) {
55829         if (!ptr_is_owned(this_ptr)) return;
55830         void* this_ptr_ptr = untag_ptr(this_ptr);
55831         CHECK_ACCESS(this_ptr_ptr);
55832         LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
55833         FREE(untag_ptr(this_ptr));
55834         CustomMessageHandler_free(this_ptr_conv);
55835 }
55836
55837 void  __attribute__((export_name("TS_IgnoringMessageHandler_free"))) TS_IgnoringMessageHandler_free(uint64_t this_obj) {
55838         LDKIgnoringMessageHandler this_obj_conv;
55839         this_obj_conv.inner = untag_ptr(this_obj);
55840         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55842         IgnoringMessageHandler_free(this_obj_conv);
55843 }
55844
55845 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_new"))) TS_IgnoringMessageHandler_new() {
55846         LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
55847         uint64_t ret_ref = 0;
55848         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55849         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55850         return ret_ref;
55851 }
55852
55853 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_EventsProvider"))) TS_IgnoringMessageHandler_as_EventsProvider(uint64_t this_arg) {
55854         LDKIgnoringMessageHandler this_arg_conv;
55855         this_arg_conv.inner = untag_ptr(this_arg);
55856         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55858         this_arg_conv.is_owned = false;
55859         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
55860         *ret_ret = IgnoringMessageHandler_as_EventsProvider(&this_arg_conv);
55861         return tag_ptr(ret_ret, true);
55862 }
55863
55864 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_MessageSendEventsProvider"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint64_t this_arg) {
55865         LDKIgnoringMessageHandler this_arg_conv;
55866         this_arg_conv.inner = untag_ptr(this_arg);
55867         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55869         this_arg_conv.is_owned = false;
55870         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
55871         *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
55872         return tag_ptr(ret_ret, true);
55873 }
55874
55875 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_RoutingMessageHandler"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint64_t this_arg) {
55876         LDKIgnoringMessageHandler this_arg_conv;
55877         this_arg_conv.inner = untag_ptr(this_arg);
55878         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55880         this_arg_conv.is_owned = false;
55881         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
55882         *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
55883         return tag_ptr(ret_ret, true);
55884 }
55885
55886 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_OnionMessageHandler"))) TS_IgnoringMessageHandler_as_OnionMessageHandler(uint64_t this_arg) {
55887         LDKIgnoringMessageHandler this_arg_conv;
55888         this_arg_conv.inner = untag_ptr(this_arg);
55889         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55891         this_arg_conv.is_owned = false;
55892         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
55893         *ret_ret = IgnoringMessageHandler_as_OnionMessageHandler(&this_arg_conv);
55894         return tag_ptr(ret_ret, true);
55895 }
55896
55897 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_OffersMessageHandler"))) TS_IgnoringMessageHandler_as_OffersMessageHandler(uint64_t this_arg) {
55898         LDKIgnoringMessageHandler this_arg_conv;
55899         this_arg_conv.inner = untag_ptr(this_arg);
55900         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55902         this_arg_conv.is_owned = false;
55903         LDKOffersMessageHandler* ret_ret = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
55904         *ret_ret = IgnoringMessageHandler_as_OffersMessageHandler(&this_arg_conv);
55905         return tag_ptr(ret_ret, true);
55906 }
55907
55908 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomOnionMessageHandler"))) TS_IgnoringMessageHandler_as_CustomOnionMessageHandler(uint64_t this_arg) {
55909         LDKIgnoringMessageHandler this_arg_conv;
55910         this_arg_conv.inner = untag_ptr(this_arg);
55911         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55913         this_arg_conv.is_owned = false;
55914         LDKCustomOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
55915         *ret_ret = IgnoringMessageHandler_as_CustomOnionMessageHandler(&this_arg_conv);
55916         return tag_ptr(ret_ret, true);
55917 }
55918
55919 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageReader"))) TS_IgnoringMessageHandler_as_CustomMessageReader(uint64_t this_arg) {
55920         LDKIgnoringMessageHandler this_arg_conv;
55921         this_arg_conv.inner = untag_ptr(this_arg);
55922         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55924         this_arg_conv.is_owned = false;
55925         LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
55926         *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
55927         return tag_ptr(ret_ret, true);
55928 }
55929
55930 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageHandler"))) TS_IgnoringMessageHandler_as_CustomMessageHandler(uint64_t this_arg) {
55931         LDKIgnoringMessageHandler this_arg_conv;
55932         this_arg_conv.inner = untag_ptr(this_arg);
55933         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55935         this_arg_conv.is_owned = false;
55936         LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
55937         *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
55938         return tag_ptr(ret_ret, true);
55939 }
55940
55941 void  __attribute__((export_name("TS_ErroringMessageHandler_free"))) TS_ErroringMessageHandler_free(uint64_t this_obj) {
55942         LDKErroringMessageHandler this_obj_conv;
55943         this_obj_conv.inner = untag_ptr(this_obj);
55944         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55946         ErroringMessageHandler_free(this_obj_conv);
55947 }
55948
55949 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_new"))) TS_ErroringMessageHandler_new() {
55950         LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
55951         uint64_t ret_ref = 0;
55952         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55953         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55954         return ret_ref;
55955 }
55956
55957 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_as_MessageSendEventsProvider"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint64_t this_arg) {
55958         LDKErroringMessageHandler this_arg_conv;
55959         this_arg_conv.inner = untag_ptr(this_arg);
55960         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55962         this_arg_conv.is_owned = false;
55963         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
55964         *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
55965         return tag_ptr(ret_ret, true);
55966 }
55967
55968 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_as_ChannelMessageHandler"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint64_t this_arg) {
55969         LDKErroringMessageHandler this_arg_conv;
55970         this_arg_conv.inner = untag_ptr(this_arg);
55971         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55973         this_arg_conv.is_owned = false;
55974         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
55975         *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
55976         return tag_ptr(ret_ret, true);
55977 }
55978
55979 void  __attribute__((export_name("TS_MessageHandler_free"))) TS_MessageHandler_free(uint64_t this_obj) {
55980         LDKMessageHandler this_obj_conv;
55981         this_obj_conv.inner = untag_ptr(this_obj);
55982         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55984         MessageHandler_free(this_obj_conv);
55985 }
55986
55987 uint64_t  __attribute__((export_name("TS_MessageHandler_get_chan_handler"))) TS_MessageHandler_get_chan_handler(uint64_t this_ptr) {
55988         LDKMessageHandler this_ptr_conv;
55989         this_ptr_conv.inner = untag_ptr(this_ptr);
55990         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55992         this_ptr_conv.is_owned = false;
55993         // WARNING: This object doesn't live past this scope, needs clone!
55994         uint64_t ret_ret = tag_ptr(MessageHandler_get_chan_handler(&this_ptr_conv), false);
55995         return ret_ret;
55996 }
55997
55998 void  __attribute__((export_name("TS_MessageHandler_set_chan_handler"))) TS_MessageHandler_set_chan_handler(uint64_t this_ptr, uint64_t val) {
55999         LDKMessageHandler this_ptr_conv;
56000         this_ptr_conv.inner = untag_ptr(this_ptr);
56001         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56003         this_ptr_conv.is_owned = false;
56004         void* val_ptr = untag_ptr(val);
56005         CHECK_ACCESS(val_ptr);
56006         LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
56007         if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
56008                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
56009                 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
56010         }
56011         MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
56012 }
56013
56014 uint64_t  __attribute__((export_name("TS_MessageHandler_get_route_handler"))) TS_MessageHandler_get_route_handler(uint64_t this_ptr) {
56015         LDKMessageHandler this_ptr_conv;
56016         this_ptr_conv.inner = untag_ptr(this_ptr);
56017         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56019         this_ptr_conv.is_owned = false;
56020         // WARNING: This object doesn't live past this scope, needs clone!
56021         uint64_t ret_ret = tag_ptr(MessageHandler_get_route_handler(&this_ptr_conv), false);
56022         return ret_ret;
56023 }
56024
56025 void  __attribute__((export_name("TS_MessageHandler_set_route_handler"))) TS_MessageHandler_set_route_handler(uint64_t this_ptr, uint64_t val) {
56026         LDKMessageHandler this_ptr_conv;
56027         this_ptr_conv.inner = untag_ptr(this_ptr);
56028         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56030         this_ptr_conv.is_owned = false;
56031         void* val_ptr = untag_ptr(val);
56032         CHECK_ACCESS(val_ptr);
56033         LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
56034         if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
56035                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
56036                 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
56037         }
56038         MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
56039 }
56040
56041 uint64_t  __attribute__((export_name("TS_MessageHandler_get_onion_message_handler"))) TS_MessageHandler_get_onion_message_handler(uint64_t this_ptr) {
56042         LDKMessageHandler this_ptr_conv;
56043         this_ptr_conv.inner = untag_ptr(this_ptr);
56044         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56046         this_ptr_conv.is_owned = false;
56047         // WARNING: This object doesn't live past this scope, needs clone!
56048         uint64_t ret_ret = tag_ptr(MessageHandler_get_onion_message_handler(&this_ptr_conv), false);
56049         return ret_ret;
56050 }
56051
56052 void  __attribute__((export_name("TS_MessageHandler_set_onion_message_handler"))) TS_MessageHandler_set_onion_message_handler(uint64_t this_ptr, uint64_t val) {
56053         LDKMessageHandler this_ptr_conv;
56054         this_ptr_conv.inner = untag_ptr(this_ptr);
56055         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56057         this_ptr_conv.is_owned = false;
56058         void* val_ptr = untag_ptr(val);
56059         CHECK_ACCESS(val_ptr);
56060         LDKOnionMessageHandler val_conv = *(LDKOnionMessageHandler*)(val_ptr);
56061         if (val_conv.free == LDKOnionMessageHandler_JCalls_free) {
56062                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
56063                 LDKOnionMessageHandler_JCalls_cloned(&val_conv);
56064         }
56065         MessageHandler_set_onion_message_handler(&this_ptr_conv, val_conv);
56066 }
56067
56068 uint64_t  __attribute__((export_name("TS_MessageHandler_get_custom_message_handler"))) TS_MessageHandler_get_custom_message_handler(uint64_t this_ptr) {
56069         LDKMessageHandler this_ptr_conv;
56070         this_ptr_conv.inner = untag_ptr(this_ptr);
56071         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56073         this_ptr_conv.is_owned = false;
56074         // WARNING: This object doesn't live past this scope, needs clone!
56075         uint64_t ret_ret = tag_ptr(MessageHandler_get_custom_message_handler(&this_ptr_conv), false);
56076         return ret_ret;
56077 }
56078
56079 void  __attribute__((export_name("TS_MessageHandler_set_custom_message_handler"))) TS_MessageHandler_set_custom_message_handler(uint64_t this_ptr, uint64_t val) {
56080         LDKMessageHandler this_ptr_conv;
56081         this_ptr_conv.inner = untag_ptr(this_ptr);
56082         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56084         this_ptr_conv.is_owned = false;
56085         void* val_ptr = untag_ptr(val);
56086         CHECK_ACCESS(val_ptr);
56087         LDKCustomMessageHandler val_conv = *(LDKCustomMessageHandler*)(val_ptr);
56088         if (val_conv.free == LDKCustomMessageHandler_JCalls_free) {
56089                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
56090                 LDKCustomMessageHandler_JCalls_cloned(&val_conv);
56091         }
56092         MessageHandler_set_custom_message_handler(&this_ptr_conv, val_conv);
56093 }
56094
56095 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) {
56096         void* chan_handler_arg_ptr = untag_ptr(chan_handler_arg);
56097         CHECK_ACCESS(chan_handler_arg_ptr);
56098         LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
56099         if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
56100                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
56101                 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
56102         }
56103         void* route_handler_arg_ptr = untag_ptr(route_handler_arg);
56104         CHECK_ACCESS(route_handler_arg_ptr);
56105         LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
56106         if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
56107                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
56108                 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
56109         }
56110         void* onion_message_handler_arg_ptr = untag_ptr(onion_message_handler_arg);
56111         CHECK_ACCESS(onion_message_handler_arg_ptr);
56112         LDKOnionMessageHandler onion_message_handler_arg_conv = *(LDKOnionMessageHandler*)(onion_message_handler_arg_ptr);
56113         if (onion_message_handler_arg_conv.free == LDKOnionMessageHandler_JCalls_free) {
56114                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
56115                 LDKOnionMessageHandler_JCalls_cloned(&onion_message_handler_arg_conv);
56116         }
56117         void* custom_message_handler_arg_ptr = untag_ptr(custom_message_handler_arg);
56118         CHECK_ACCESS(custom_message_handler_arg_ptr);
56119         LDKCustomMessageHandler custom_message_handler_arg_conv = *(LDKCustomMessageHandler*)(custom_message_handler_arg_ptr);
56120         if (custom_message_handler_arg_conv.free == LDKCustomMessageHandler_JCalls_free) {
56121                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
56122                 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_arg_conv);
56123         }
56124         LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv, onion_message_handler_arg_conv, custom_message_handler_arg_conv);
56125         uint64_t ret_ref = 0;
56126         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56127         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56128         return ret_ref;
56129 }
56130
56131 static inline uint64_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
56132         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
56133         *ret_ret = SocketDescriptor_clone(arg);
56134         return tag_ptr(ret_ret, true);
56135 }
56136 int64_t  __attribute__((export_name("TS_SocketDescriptor_clone_ptr"))) TS_SocketDescriptor_clone_ptr(uint64_t arg) {
56137         void* arg_ptr = untag_ptr(arg);
56138         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
56139         LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
56140         int64_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
56141         return ret_conv;
56142 }
56143
56144 uint64_t  __attribute__((export_name("TS_SocketDescriptor_clone"))) TS_SocketDescriptor_clone(uint64_t orig) {
56145         void* orig_ptr = untag_ptr(orig);
56146         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
56147         LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
56148         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
56149         *ret_ret = SocketDescriptor_clone(orig_conv);
56150         return tag_ptr(ret_ret, true);
56151 }
56152
56153 void  __attribute__((export_name("TS_SocketDescriptor_free"))) TS_SocketDescriptor_free(uint64_t this_ptr) {
56154         if (!ptr_is_owned(this_ptr)) return;
56155         void* this_ptr_ptr = untag_ptr(this_ptr);
56156         CHECK_ACCESS(this_ptr_ptr);
56157         LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
56158         FREE(untag_ptr(this_ptr));
56159         SocketDescriptor_free(this_ptr_conv);
56160 }
56161
56162 void  __attribute__((export_name("TS_PeerDetails_free"))) TS_PeerDetails_free(uint64_t this_obj) {
56163         LDKPeerDetails this_obj_conv;
56164         this_obj_conv.inner = untag_ptr(this_obj);
56165         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56167         PeerDetails_free(this_obj_conv);
56168 }
56169
56170 int8_tArray  __attribute__((export_name("TS_PeerDetails_get_counterparty_node_id"))) TS_PeerDetails_get_counterparty_node_id(uint64_t this_ptr) {
56171         LDKPeerDetails this_ptr_conv;
56172         this_ptr_conv.inner = untag_ptr(this_ptr);
56173         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56175         this_ptr_conv.is_owned = false;
56176         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
56177         memcpy(ret_arr->elems, PeerDetails_get_counterparty_node_id(&this_ptr_conv).compressed_form, 33);
56178         return ret_arr;
56179 }
56180
56181 void  __attribute__((export_name("TS_PeerDetails_set_counterparty_node_id"))) TS_PeerDetails_set_counterparty_node_id(uint64_t this_ptr, int8_tArray val) {
56182         LDKPeerDetails this_ptr_conv;
56183         this_ptr_conv.inner = untag_ptr(this_ptr);
56184         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56186         this_ptr_conv.is_owned = false;
56187         LDKPublicKey val_ref;
56188         CHECK(val->arr_len == 33);
56189         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
56190         PeerDetails_set_counterparty_node_id(&this_ptr_conv, val_ref);
56191 }
56192
56193 uint64_t  __attribute__((export_name("TS_PeerDetails_get_socket_address"))) TS_PeerDetails_get_socket_address(uint64_t this_ptr) {
56194         LDKPeerDetails this_ptr_conv;
56195         this_ptr_conv.inner = untag_ptr(this_ptr);
56196         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56198         this_ptr_conv.is_owned = false;
56199         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
56200         *ret_copy = PeerDetails_get_socket_address(&this_ptr_conv);
56201         uint64_t ret_ref = tag_ptr(ret_copy, true);
56202         return ret_ref;
56203 }
56204
56205 void  __attribute__((export_name("TS_PeerDetails_set_socket_address"))) TS_PeerDetails_set_socket_address(uint64_t this_ptr, uint64_t val) {
56206         LDKPeerDetails this_ptr_conv;
56207         this_ptr_conv.inner = untag_ptr(this_ptr);
56208         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56210         this_ptr_conv.is_owned = false;
56211         void* val_ptr = untag_ptr(val);
56212         CHECK_ACCESS(val_ptr);
56213         LDKCOption_SocketAddressZ val_conv = *(LDKCOption_SocketAddressZ*)(val_ptr);
56214         val_conv = COption_SocketAddressZ_clone((LDKCOption_SocketAddressZ*)untag_ptr(val));
56215         PeerDetails_set_socket_address(&this_ptr_conv, val_conv);
56216 }
56217
56218 uint64_t  __attribute__((export_name("TS_PeerDetails_get_init_features"))) TS_PeerDetails_get_init_features(uint64_t this_ptr) {
56219         LDKPeerDetails this_ptr_conv;
56220         this_ptr_conv.inner = untag_ptr(this_ptr);
56221         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56223         this_ptr_conv.is_owned = false;
56224         LDKInitFeatures ret_var = PeerDetails_get_init_features(&this_ptr_conv);
56225         uint64_t ret_ref = 0;
56226         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56227         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56228         return ret_ref;
56229 }
56230
56231 void  __attribute__((export_name("TS_PeerDetails_set_init_features"))) TS_PeerDetails_set_init_features(uint64_t this_ptr, uint64_t val) {
56232         LDKPeerDetails this_ptr_conv;
56233         this_ptr_conv.inner = untag_ptr(this_ptr);
56234         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56236         this_ptr_conv.is_owned = false;
56237         LDKInitFeatures val_conv;
56238         val_conv.inner = untag_ptr(val);
56239         val_conv.is_owned = ptr_is_owned(val);
56240         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56241         val_conv = InitFeatures_clone(&val_conv);
56242         PeerDetails_set_init_features(&this_ptr_conv, val_conv);
56243 }
56244
56245 jboolean  __attribute__((export_name("TS_PeerDetails_get_is_inbound_connection"))) TS_PeerDetails_get_is_inbound_connection(uint64_t this_ptr) {
56246         LDKPeerDetails this_ptr_conv;
56247         this_ptr_conv.inner = untag_ptr(this_ptr);
56248         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56250         this_ptr_conv.is_owned = false;
56251         jboolean ret_conv = PeerDetails_get_is_inbound_connection(&this_ptr_conv);
56252         return ret_conv;
56253 }
56254
56255 void  __attribute__((export_name("TS_PeerDetails_set_is_inbound_connection"))) TS_PeerDetails_set_is_inbound_connection(uint64_t this_ptr, jboolean val) {
56256         LDKPeerDetails this_ptr_conv;
56257         this_ptr_conv.inner = untag_ptr(this_ptr);
56258         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56260         this_ptr_conv.is_owned = false;
56261         PeerDetails_set_is_inbound_connection(&this_ptr_conv, val);
56262 }
56263
56264 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) {
56265         LDKPublicKey counterparty_node_id_arg_ref;
56266         CHECK(counterparty_node_id_arg->arr_len == 33);
56267         memcpy(counterparty_node_id_arg_ref.compressed_form, counterparty_node_id_arg->elems, 33); FREE(counterparty_node_id_arg);
56268         void* socket_address_arg_ptr = untag_ptr(socket_address_arg);
56269         CHECK_ACCESS(socket_address_arg_ptr);
56270         LDKCOption_SocketAddressZ socket_address_arg_conv = *(LDKCOption_SocketAddressZ*)(socket_address_arg_ptr);
56271         LDKInitFeatures init_features_arg_conv;
56272         init_features_arg_conv.inner = untag_ptr(init_features_arg);
56273         init_features_arg_conv.is_owned = ptr_is_owned(init_features_arg);
56274         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_features_arg_conv);
56275         init_features_arg_conv = InitFeatures_clone(&init_features_arg_conv);
56276         LDKPeerDetails ret_var = PeerDetails_new(counterparty_node_id_arg_ref, socket_address_arg_conv, init_features_arg_conv, is_inbound_connection_arg);
56277         uint64_t ret_ref = 0;
56278         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56279         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56280         return ret_ref;
56281 }
56282
56283 void  __attribute__((export_name("TS_PeerHandleError_free"))) TS_PeerHandleError_free(uint64_t this_obj) {
56284         LDKPeerHandleError this_obj_conv;
56285         this_obj_conv.inner = untag_ptr(this_obj);
56286         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56288         PeerHandleError_free(this_obj_conv);
56289 }
56290
56291 uint64_t  __attribute__((export_name("TS_PeerHandleError_new"))) TS_PeerHandleError_new() {
56292         LDKPeerHandleError ret_var = PeerHandleError_new();
56293         uint64_t ret_ref = 0;
56294         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56295         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56296         return ret_ref;
56297 }
56298
56299 static inline uint64_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
56300         LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
56301         uint64_t ret_ref = 0;
56302         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56303         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56304         return ret_ref;
56305 }
56306 int64_t  __attribute__((export_name("TS_PeerHandleError_clone_ptr"))) TS_PeerHandleError_clone_ptr(uint64_t arg) {
56307         LDKPeerHandleError arg_conv;
56308         arg_conv.inner = untag_ptr(arg);
56309         arg_conv.is_owned = ptr_is_owned(arg);
56310         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56311         arg_conv.is_owned = false;
56312         int64_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
56313         return ret_conv;
56314 }
56315
56316 uint64_t  __attribute__((export_name("TS_PeerHandleError_clone"))) TS_PeerHandleError_clone(uint64_t orig) {
56317         LDKPeerHandleError orig_conv;
56318         orig_conv.inner = untag_ptr(orig);
56319         orig_conv.is_owned = ptr_is_owned(orig);
56320         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56321         orig_conv.is_owned = false;
56322         LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
56323         uint64_t ret_ref = 0;
56324         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56325         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56326         return ret_ref;
56327 }
56328
56329 void  __attribute__((export_name("TS_PeerManager_free"))) TS_PeerManager_free(uint64_t this_obj) {
56330         LDKPeerManager this_obj_conv;
56331         this_obj_conv.inner = untag_ptr(this_obj);
56332         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56334         PeerManager_free(this_obj_conv);
56335 }
56336
56337 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) {
56338         LDKMessageHandler message_handler_conv;
56339         message_handler_conv.inner = untag_ptr(message_handler);
56340         message_handler_conv.is_owned = ptr_is_owned(message_handler);
56341         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
56342         // WARNING: we need a move here but no clone is available for LDKMessageHandler
56343         
56344         uint8_t ephemeral_random_data_arr[32];
56345         CHECK(ephemeral_random_data->arr_len == 32);
56346         memcpy(ephemeral_random_data_arr, ephemeral_random_data->elems, 32); FREE(ephemeral_random_data);
56347         uint8_t (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
56348         void* logger_ptr = untag_ptr(logger);
56349         CHECK_ACCESS(logger_ptr);
56350         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
56351         if (logger_conv.free == LDKLogger_JCalls_free) {
56352                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
56353                 LDKLogger_JCalls_cloned(&logger_conv);
56354         }
56355         void* node_signer_ptr = untag_ptr(node_signer);
56356         CHECK_ACCESS(node_signer_ptr);
56357         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
56358         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
56359                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
56360                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
56361         }
56362         LDKPeerManager ret_var = PeerManager_new(message_handler_conv, current_time, ephemeral_random_data_ref, logger_conv, node_signer_conv);
56363         uint64_t ret_ref = 0;
56364         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56365         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56366         return ret_ref;
56367 }
56368
56369 uint64_tArray  __attribute__((export_name("TS_PeerManager_list_peers"))) TS_PeerManager_list_peers(uint64_t this_arg) {
56370         LDKPeerManager this_arg_conv;
56371         this_arg_conv.inner = untag_ptr(this_arg);
56372         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56374         this_arg_conv.is_owned = false;
56375         LDKCVec_PeerDetailsZ ret_var = PeerManager_list_peers(&this_arg_conv);
56376         uint64_tArray ret_arr = NULL;
56377         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
56378         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
56379         for (size_t n = 0; n < ret_var.datalen; n++) {
56380                 LDKPeerDetails ret_conv_13_var = ret_var.data[n];
56381                 uint64_t ret_conv_13_ref = 0;
56382                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
56383                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
56384                 ret_arr_ptr[n] = ret_conv_13_ref;
56385         }
56386         
56387         FREE(ret_var.data);
56388         return ret_arr;
56389 }
56390
56391 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) {
56392         LDKPeerManager this_arg_conv;
56393         this_arg_conv.inner = untag_ptr(this_arg);
56394         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56396         this_arg_conv.is_owned = false;
56397         LDKPublicKey their_node_id_ref;
56398         CHECK(their_node_id->arr_len == 33);
56399         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
56400         LDKPeerDetails ret_var = PeerManager_peer_by_node_id(&this_arg_conv, their_node_id_ref);
56401         uint64_t ret_ref = 0;
56402         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56403         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56404         return ret_ref;
56405 }
56406
56407 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) {
56408         LDKPeerManager this_arg_conv;
56409         this_arg_conv.inner = untag_ptr(this_arg);
56410         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56412         this_arg_conv.is_owned = false;
56413         LDKPublicKey their_node_id_ref;
56414         CHECK(their_node_id->arr_len == 33);
56415         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
56416         void* descriptor_ptr = untag_ptr(descriptor);
56417         CHECK_ACCESS(descriptor_ptr);
56418         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
56419         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
56420                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
56421                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
56422         }
56423         void* remote_network_address_ptr = untag_ptr(remote_network_address);
56424         CHECK_ACCESS(remote_network_address_ptr);
56425         LDKCOption_SocketAddressZ remote_network_address_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_ptr);
56426         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
56427         *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
56428         return tag_ptr(ret_conv, true);
56429 }
56430
56431 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) {
56432         LDKPeerManager this_arg_conv;
56433         this_arg_conv.inner = untag_ptr(this_arg);
56434         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56436         this_arg_conv.is_owned = false;
56437         void* descriptor_ptr = untag_ptr(descriptor);
56438         CHECK_ACCESS(descriptor_ptr);
56439         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
56440         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
56441                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
56442                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
56443         }
56444         void* remote_network_address_ptr = untag_ptr(remote_network_address);
56445         CHECK_ACCESS(remote_network_address_ptr);
56446         LDKCOption_SocketAddressZ remote_network_address_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_ptr);
56447         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
56448         *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
56449         return tag_ptr(ret_conv, true);
56450 }
56451
56452 uint64_t  __attribute__((export_name("TS_PeerManager_write_buffer_space_avail"))) TS_PeerManager_write_buffer_space_avail(uint64_t this_arg, uint64_t descriptor) {
56453         LDKPeerManager this_arg_conv;
56454         this_arg_conv.inner = untag_ptr(this_arg);
56455         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56457         this_arg_conv.is_owned = false;
56458         void* descriptor_ptr = untag_ptr(descriptor);
56459         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
56460         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
56461         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
56462         *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
56463         return tag_ptr(ret_conv, true);
56464 }
56465
56466 uint64_t  __attribute__((export_name("TS_PeerManager_read_event"))) TS_PeerManager_read_event(uint64_t this_arg, uint64_t peer_descriptor, int8_tArray data) {
56467         LDKPeerManager this_arg_conv;
56468         this_arg_conv.inner = untag_ptr(this_arg);
56469         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56471         this_arg_conv.is_owned = false;
56472         void* peer_descriptor_ptr = untag_ptr(peer_descriptor);
56473         if (ptr_is_owned(peer_descriptor)) { CHECK_ACCESS(peer_descriptor_ptr); }
56474         LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
56475         LDKu8slice data_ref;
56476         data_ref.datalen = data->arr_len;
56477         data_ref.data = data->elems;
56478         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
56479         *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
56480         FREE(data);
56481         return tag_ptr(ret_conv, true);
56482 }
56483
56484 void  __attribute__((export_name("TS_PeerManager_process_events"))) TS_PeerManager_process_events(uint64_t this_arg) {
56485         LDKPeerManager this_arg_conv;
56486         this_arg_conv.inner = untag_ptr(this_arg);
56487         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56489         this_arg_conv.is_owned = false;
56490         PeerManager_process_events(&this_arg_conv);
56491 }
56492
56493 void  __attribute__((export_name("TS_PeerManager_socket_disconnected"))) TS_PeerManager_socket_disconnected(uint64_t this_arg, uint64_t descriptor) {
56494         LDKPeerManager this_arg_conv;
56495         this_arg_conv.inner = untag_ptr(this_arg);
56496         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56498         this_arg_conv.is_owned = false;
56499         void* descriptor_ptr = untag_ptr(descriptor);
56500         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
56501         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
56502         PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
56503 }
56504
56505 void  __attribute__((export_name("TS_PeerManager_disconnect_by_node_id"))) TS_PeerManager_disconnect_by_node_id(uint64_t this_arg, int8_tArray node_id) {
56506         LDKPeerManager this_arg_conv;
56507         this_arg_conv.inner = untag_ptr(this_arg);
56508         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56510         this_arg_conv.is_owned = false;
56511         LDKPublicKey node_id_ref;
56512         CHECK(node_id->arr_len == 33);
56513         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
56514         PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref);
56515 }
56516
56517 void  __attribute__((export_name("TS_PeerManager_disconnect_all_peers"))) TS_PeerManager_disconnect_all_peers(uint64_t this_arg) {
56518         LDKPeerManager this_arg_conv;
56519         this_arg_conv.inner = untag_ptr(this_arg);
56520         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56522         this_arg_conv.is_owned = false;
56523         PeerManager_disconnect_all_peers(&this_arg_conv);
56524 }
56525
56526 void  __attribute__((export_name("TS_PeerManager_timer_tick_occurred"))) TS_PeerManager_timer_tick_occurred(uint64_t this_arg) {
56527         LDKPeerManager this_arg_conv;
56528         this_arg_conv.inner = untag_ptr(this_arg);
56529         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56531         this_arg_conv.is_owned = false;
56532         PeerManager_timer_tick_occurred(&this_arg_conv);
56533 }
56534
56535 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) {
56536         LDKPeerManager this_arg_conv;
56537         this_arg_conv.inner = untag_ptr(this_arg);
56538         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56540         this_arg_conv.is_owned = false;
56541         LDKThreeBytes rgb_ref;
56542         CHECK(rgb->arr_len == 3);
56543         memcpy(rgb_ref.data, rgb->elems, 3); FREE(rgb);
56544         LDKThirtyTwoBytes alias_ref;
56545         CHECK(alias->arr_len == 32);
56546         memcpy(alias_ref.data, alias->elems, 32); FREE(alias);
56547         LDKCVec_SocketAddressZ addresses_constr;
56548         addresses_constr.datalen = addresses->arr_len;
56549         if (addresses_constr.datalen > 0)
56550                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
56551         else
56552                 addresses_constr.data = NULL;
56553         uint64_t* addresses_vals = addresses->elems;
56554         for (size_t p = 0; p < addresses_constr.datalen; p++) {
56555                 uint64_t addresses_conv_15 = addresses_vals[p];
56556                 void* addresses_conv_15_ptr = untag_ptr(addresses_conv_15);
56557                 CHECK_ACCESS(addresses_conv_15_ptr);
56558                 LDKSocketAddress addresses_conv_15_conv = *(LDKSocketAddress*)(addresses_conv_15_ptr);
56559                 addresses_constr.data[p] = addresses_conv_15_conv;
56560         }
56561         FREE(addresses);
56562         PeerManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
56563 }
56564
56565 int64_t  __attribute__((export_name("TS_htlc_success_tx_weight"))) TS_htlc_success_tx_weight(uint64_t channel_type_features) {
56566         LDKChannelTypeFeatures channel_type_features_conv;
56567         channel_type_features_conv.inner = untag_ptr(channel_type_features);
56568         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
56569         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
56570         channel_type_features_conv.is_owned = false;
56571         int64_t ret_conv = htlc_success_tx_weight(&channel_type_features_conv);
56572         return ret_conv;
56573 }
56574
56575 int64_t  __attribute__((export_name("TS_htlc_timeout_tx_weight"))) TS_htlc_timeout_tx_weight(uint64_t channel_type_features) {
56576         LDKChannelTypeFeatures channel_type_features_conv;
56577         channel_type_features_conv.inner = untag_ptr(channel_type_features);
56578         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
56579         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
56580         channel_type_features_conv.is_owned = false;
56581         int64_t ret_conv = htlc_timeout_tx_weight(&channel_type_features_conv);
56582         return ret_conv;
56583 }
56584
56585 uint32_t  __attribute__((export_name("TS_HTLCClaim_clone"))) TS_HTLCClaim_clone(uint64_t orig) {
56586         LDKHTLCClaim* orig_conv = (LDKHTLCClaim*)untag_ptr(orig);
56587         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_clone(orig_conv));
56588         return ret_conv;
56589 }
56590
56591 uint32_t  __attribute__((export_name("TS_HTLCClaim_offered_timeout"))) TS_HTLCClaim_offered_timeout() {
56592         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_offered_timeout());
56593         return ret_conv;
56594 }
56595
56596 uint32_t  __attribute__((export_name("TS_HTLCClaim_offered_preimage"))) TS_HTLCClaim_offered_preimage() {
56597         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_offered_preimage());
56598         return ret_conv;
56599 }
56600
56601 uint32_t  __attribute__((export_name("TS_HTLCClaim_accepted_timeout"))) TS_HTLCClaim_accepted_timeout() {
56602         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_accepted_timeout());
56603         return ret_conv;
56604 }
56605
56606 uint32_t  __attribute__((export_name("TS_HTLCClaim_accepted_preimage"))) TS_HTLCClaim_accepted_preimage() {
56607         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_accepted_preimage());
56608         return ret_conv;
56609 }
56610
56611 uint32_t  __attribute__((export_name("TS_HTLCClaim_revocation"))) TS_HTLCClaim_revocation() {
56612         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_revocation());
56613         return ret_conv;
56614 }
56615
56616 jboolean  __attribute__((export_name("TS_HTLCClaim_eq"))) TS_HTLCClaim_eq(uint64_t a, uint64_t b) {
56617         LDKHTLCClaim* a_conv = (LDKHTLCClaim*)untag_ptr(a);
56618         LDKHTLCClaim* b_conv = (LDKHTLCClaim*)untag_ptr(b);
56619         jboolean ret_conv = HTLCClaim_eq(a_conv, b_conv);
56620         return ret_conv;
56621 }
56622
56623 uint64_t  __attribute__((export_name("TS_HTLCClaim_from_witness"))) TS_HTLCClaim_from_witness(int8_tArray witness) {
56624         LDKWitness witness_ref;
56625         witness_ref.datalen = witness->arr_len;
56626         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
56627         memcpy(witness_ref.data, witness->elems, witness_ref.datalen); FREE(witness);
56628         witness_ref.data_is_owned = true;
56629         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
56630         *ret_copy = HTLCClaim_from_witness(witness_ref);
56631         uint64_t ret_ref = tag_ptr(ret_copy, true);
56632         return ret_ref;
56633 }
56634
56635 int8_tArray  __attribute__((export_name("TS_build_commitment_secret"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
56636         uint8_t commitment_seed_arr[32];
56637         CHECK(commitment_seed->arr_len == 32);
56638         memcpy(commitment_seed_arr, commitment_seed->elems, 32); FREE(commitment_seed);
56639         uint8_t (*commitment_seed_ref)[32] = &commitment_seed_arr;
56640         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
56641         memcpy(ret_arr->elems, build_commitment_secret(commitment_seed_ref, idx).data, 32);
56642         return ret_arr;
56643 }
56644
56645 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) {
56646         LDKCVec_u8Z to_holder_script_ref;
56647         to_holder_script_ref.datalen = to_holder_script->arr_len;
56648         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
56649         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
56650         LDKCVec_u8Z to_counterparty_script_ref;
56651         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
56652         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
56653         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
56654         LDKOutPoint funding_outpoint_conv;
56655         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
56656         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
56657         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
56658         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
56659         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);
56660         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56661         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56662         Transaction_free(ret_var);
56663         return ret_arr;
56664 }
56665
56666 void  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_free"))) TS_CounterpartyCommitmentSecrets_free(uint64_t this_obj) {
56667         LDKCounterpartyCommitmentSecrets this_obj_conv;
56668         this_obj_conv.inner = untag_ptr(this_obj);
56669         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56671         CounterpartyCommitmentSecrets_free(this_obj_conv);
56672 }
56673
56674 static inline uint64_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
56675         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
56676         uint64_t ret_ref = 0;
56677         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56678         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56679         return ret_ref;
56680 }
56681 int64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone_ptr"))) TS_CounterpartyCommitmentSecrets_clone_ptr(uint64_t arg) {
56682         LDKCounterpartyCommitmentSecrets arg_conv;
56683         arg_conv.inner = untag_ptr(arg);
56684         arg_conv.is_owned = ptr_is_owned(arg);
56685         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56686         arg_conv.is_owned = false;
56687         int64_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
56688         return ret_conv;
56689 }
56690
56691 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone"))) TS_CounterpartyCommitmentSecrets_clone(uint64_t orig) {
56692         LDKCounterpartyCommitmentSecrets orig_conv;
56693         orig_conv.inner = untag_ptr(orig);
56694         orig_conv.is_owned = ptr_is_owned(orig);
56695         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56696         orig_conv.is_owned = false;
56697         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
56698         uint64_t ret_ref = 0;
56699         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56700         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56701         return ret_ref;
56702 }
56703
56704 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_new"))) TS_CounterpartyCommitmentSecrets_new() {
56705         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
56706         uint64_t ret_ref = 0;
56707         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56708         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56709         return ret_ref;
56710 }
56711
56712 int64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_min_seen_secret"))) TS_CounterpartyCommitmentSecrets_get_min_seen_secret(uint64_t this_arg) {
56713         LDKCounterpartyCommitmentSecrets this_arg_conv;
56714         this_arg_conv.inner = untag_ptr(this_arg);
56715         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56717         this_arg_conv.is_owned = false;
56718         int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
56719         return ret_conv;
56720 }
56721
56722 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_provide_secret"))) TS_CounterpartyCommitmentSecrets_provide_secret(uint64_t this_arg, int64_t idx, int8_tArray secret) {
56723         LDKCounterpartyCommitmentSecrets this_arg_conv;
56724         this_arg_conv.inner = untag_ptr(this_arg);
56725         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56727         this_arg_conv.is_owned = false;
56728         LDKThirtyTwoBytes secret_ref;
56729         CHECK(secret->arr_len == 32);
56730         memcpy(secret_ref.data, secret->elems, 32); FREE(secret);
56731         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56732         *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
56733         return tag_ptr(ret_conv, true);
56734 }
56735
56736 int8_tArray  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_secret"))) TS_CounterpartyCommitmentSecrets_get_secret(uint64_t this_arg, int64_t idx) {
56737         LDKCounterpartyCommitmentSecrets this_arg_conv;
56738         this_arg_conv.inner = untag_ptr(this_arg);
56739         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56741         this_arg_conv.is_owned = false;
56742         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
56743         memcpy(ret_arr->elems, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data, 32);
56744         return ret_arr;
56745 }
56746
56747 int8_tArray  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_write"))) TS_CounterpartyCommitmentSecrets_write(uint64_t obj) {
56748         LDKCounterpartyCommitmentSecrets obj_conv;
56749         obj_conv.inner = untag_ptr(obj);
56750         obj_conv.is_owned = ptr_is_owned(obj);
56751         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56752         obj_conv.is_owned = false;
56753         LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
56754         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56755         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56756         CVec_u8Z_free(ret_var);
56757         return ret_arr;
56758 }
56759
56760 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_read"))) TS_CounterpartyCommitmentSecrets_read(int8_tArray ser) {
56761         LDKu8slice ser_ref;
56762         ser_ref.datalen = ser->arr_len;
56763         ser_ref.data = ser->elems;
56764         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
56765         *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
56766         FREE(ser);
56767         return tag_ptr(ret_conv, true);
56768 }
56769
56770 int8_tArray  __attribute__((export_name("TS_derive_private_key"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
56771         LDKPublicKey per_commitment_point_ref;
56772         CHECK(per_commitment_point->arr_len == 33);
56773         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
56774         uint8_t base_secret_arr[32];
56775         CHECK(base_secret->arr_len == 32);
56776         memcpy(base_secret_arr, base_secret->elems, 32); FREE(base_secret);
56777         uint8_t (*base_secret_ref)[32] = &base_secret_arr;
56778         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
56779         memcpy(ret_arr->elems, derive_private_key(per_commitment_point_ref, base_secret_ref).bytes, 32);
56780         return ret_arr;
56781 }
56782
56783 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) {
56784         uint8_t per_commitment_secret_arr[32];
56785         CHECK(per_commitment_secret->arr_len == 32);
56786         memcpy(per_commitment_secret_arr, per_commitment_secret->elems, 32); FREE(per_commitment_secret);
56787         uint8_t (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
56788         uint8_t countersignatory_revocation_base_secret_arr[32];
56789         CHECK(countersignatory_revocation_base_secret->arr_len == 32);
56790         memcpy(countersignatory_revocation_base_secret_arr, countersignatory_revocation_base_secret->elems, 32); FREE(countersignatory_revocation_base_secret);
56791         uint8_t (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
56792         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
56793         memcpy(ret_arr->elems, derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref).bytes, 32);
56794         return ret_arr;
56795 }
56796
56797 void  __attribute__((export_name("TS_TxCreationKeys_free"))) TS_TxCreationKeys_free(uint64_t this_obj) {
56798         LDKTxCreationKeys this_obj_conv;
56799         this_obj_conv.inner = untag_ptr(this_obj);
56800         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56802         TxCreationKeys_free(this_obj_conv);
56803 }
56804
56805 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_per_commitment_point"))) TS_TxCreationKeys_get_per_commitment_point(uint64_t this_ptr) {
56806         LDKTxCreationKeys this_ptr_conv;
56807         this_ptr_conv.inner = untag_ptr(this_ptr);
56808         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56810         this_ptr_conv.is_owned = false;
56811         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
56812         memcpy(ret_arr->elems, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
56813         return ret_arr;
56814 }
56815
56816 void  __attribute__((export_name("TS_TxCreationKeys_set_per_commitment_point"))) TS_TxCreationKeys_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
56817         LDKTxCreationKeys this_ptr_conv;
56818         this_ptr_conv.inner = untag_ptr(this_ptr);
56819         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56821         this_ptr_conv.is_owned = false;
56822         LDKPublicKey val_ref;
56823         CHECK(val->arr_len == 33);
56824         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
56825         TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
56826 }
56827
56828 uint64_t  __attribute__((export_name("TS_TxCreationKeys_get_revocation_key"))) TS_TxCreationKeys_get_revocation_key(uint64_t this_ptr) {
56829         LDKTxCreationKeys this_ptr_conv;
56830         this_ptr_conv.inner = untag_ptr(this_ptr);
56831         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56833         this_ptr_conv.is_owned = false;
56834         LDKRevocationKey ret_var = TxCreationKeys_get_revocation_key(&this_ptr_conv);
56835         uint64_t ret_ref = 0;
56836         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56837         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56838         return ret_ref;
56839 }
56840
56841 void  __attribute__((export_name("TS_TxCreationKeys_set_revocation_key"))) TS_TxCreationKeys_set_revocation_key(uint64_t this_ptr, uint64_t val) {
56842         LDKTxCreationKeys this_ptr_conv;
56843         this_ptr_conv.inner = untag_ptr(this_ptr);
56844         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56846         this_ptr_conv.is_owned = false;
56847         LDKRevocationKey val_conv;
56848         val_conv.inner = untag_ptr(val);
56849         val_conv.is_owned = ptr_is_owned(val);
56850         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56851         val_conv = RevocationKey_clone(&val_conv);
56852         TxCreationKeys_set_revocation_key(&this_ptr_conv, val_conv);
56853 }
56854
56855 uint64_t  __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_htlc_key"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint64_t this_ptr) {
56856         LDKTxCreationKeys this_ptr_conv;
56857         this_ptr_conv.inner = untag_ptr(this_ptr);
56858         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56860         this_ptr_conv.is_owned = false;
56861         LDKHtlcKey ret_var = TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv);
56862         uint64_t ret_ref = 0;
56863         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56864         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56865         return ret_ref;
56866 }
56867
56868 void  __attribute__((export_name("TS_TxCreationKeys_set_broadcaster_htlc_key"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint64_t this_ptr, uint64_t val) {
56869         LDKTxCreationKeys this_ptr_conv;
56870         this_ptr_conv.inner = untag_ptr(this_ptr);
56871         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56873         this_ptr_conv.is_owned = false;
56874         LDKHtlcKey val_conv;
56875         val_conv.inner = untag_ptr(val);
56876         val_conv.is_owned = ptr_is_owned(val);
56877         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56878         val_conv = HtlcKey_clone(&val_conv);
56879         TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_conv);
56880 }
56881
56882 uint64_t  __attribute__((export_name("TS_TxCreationKeys_get_countersignatory_htlc_key"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint64_t this_ptr) {
56883         LDKTxCreationKeys this_ptr_conv;
56884         this_ptr_conv.inner = untag_ptr(this_ptr);
56885         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56887         this_ptr_conv.is_owned = false;
56888         LDKHtlcKey ret_var = TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv);
56889         uint64_t ret_ref = 0;
56890         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56891         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56892         return ret_ref;
56893 }
56894
56895 void  __attribute__((export_name("TS_TxCreationKeys_set_countersignatory_htlc_key"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint64_t this_ptr, uint64_t val) {
56896         LDKTxCreationKeys this_ptr_conv;
56897         this_ptr_conv.inner = untag_ptr(this_ptr);
56898         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56900         this_ptr_conv.is_owned = false;
56901         LDKHtlcKey val_conv;
56902         val_conv.inner = untag_ptr(val);
56903         val_conv.is_owned = ptr_is_owned(val);
56904         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56905         val_conv = HtlcKey_clone(&val_conv);
56906         TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_conv);
56907 }
56908
56909 uint64_t  __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_delayed_payment_key"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint64_t this_ptr) {
56910         LDKTxCreationKeys this_ptr_conv;
56911         this_ptr_conv.inner = untag_ptr(this_ptr);
56912         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56914         this_ptr_conv.is_owned = false;
56915         LDKDelayedPaymentKey ret_var = TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv);
56916         uint64_t ret_ref = 0;
56917         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56918         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56919         return ret_ref;
56920 }
56921
56922 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) {
56923         LDKTxCreationKeys this_ptr_conv;
56924         this_ptr_conv.inner = untag_ptr(this_ptr);
56925         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56927         this_ptr_conv.is_owned = false;
56928         LDKDelayedPaymentKey val_conv;
56929         val_conv.inner = untag_ptr(val);
56930         val_conv.is_owned = ptr_is_owned(val);
56931         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56932         val_conv = DelayedPaymentKey_clone(&val_conv);
56933         TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_conv);
56934 }
56935
56936 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) {
56937         LDKPublicKey per_commitment_point_arg_ref;
56938         CHECK(per_commitment_point_arg->arr_len == 33);
56939         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
56940         LDKRevocationKey revocation_key_arg_conv;
56941         revocation_key_arg_conv.inner = untag_ptr(revocation_key_arg);
56942         revocation_key_arg_conv.is_owned = ptr_is_owned(revocation_key_arg);
56943         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_key_arg_conv);
56944         revocation_key_arg_conv = RevocationKey_clone(&revocation_key_arg_conv);
56945         LDKHtlcKey broadcaster_htlc_key_arg_conv;
56946         broadcaster_htlc_key_arg_conv.inner = untag_ptr(broadcaster_htlc_key_arg);
56947         broadcaster_htlc_key_arg_conv.is_owned = ptr_is_owned(broadcaster_htlc_key_arg);
56948         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_htlc_key_arg_conv);
56949         broadcaster_htlc_key_arg_conv = HtlcKey_clone(&broadcaster_htlc_key_arg_conv);
56950         LDKHtlcKey countersignatory_htlc_key_arg_conv;
56951         countersignatory_htlc_key_arg_conv.inner = untag_ptr(countersignatory_htlc_key_arg);
56952         countersignatory_htlc_key_arg_conv.is_owned = ptr_is_owned(countersignatory_htlc_key_arg);
56953         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_htlc_key_arg_conv);
56954         countersignatory_htlc_key_arg_conv = HtlcKey_clone(&countersignatory_htlc_key_arg_conv);
56955         LDKDelayedPaymentKey broadcaster_delayed_payment_key_arg_conv;
56956         broadcaster_delayed_payment_key_arg_conv.inner = untag_ptr(broadcaster_delayed_payment_key_arg);
56957         broadcaster_delayed_payment_key_arg_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_key_arg);
56958         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_key_arg_conv);
56959         broadcaster_delayed_payment_key_arg_conv = DelayedPaymentKey_clone(&broadcaster_delayed_payment_key_arg_conv);
56960         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);
56961         uint64_t ret_ref = 0;
56962         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56963         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56964         return ret_ref;
56965 }
56966
56967 jboolean  __attribute__((export_name("TS_TxCreationKeys_eq"))) TS_TxCreationKeys_eq(uint64_t a, uint64_t b) {
56968         LDKTxCreationKeys a_conv;
56969         a_conv.inner = untag_ptr(a);
56970         a_conv.is_owned = ptr_is_owned(a);
56971         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
56972         a_conv.is_owned = false;
56973         LDKTxCreationKeys b_conv;
56974         b_conv.inner = untag_ptr(b);
56975         b_conv.is_owned = ptr_is_owned(b);
56976         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
56977         b_conv.is_owned = false;
56978         jboolean ret_conv = TxCreationKeys_eq(&a_conv, &b_conv);
56979         return ret_conv;
56980 }
56981
56982 static inline uint64_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
56983         LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
56984         uint64_t ret_ref = 0;
56985         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56986         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56987         return ret_ref;
56988 }
56989 int64_t  __attribute__((export_name("TS_TxCreationKeys_clone_ptr"))) TS_TxCreationKeys_clone_ptr(uint64_t arg) {
56990         LDKTxCreationKeys arg_conv;
56991         arg_conv.inner = untag_ptr(arg);
56992         arg_conv.is_owned = ptr_is_owned(arg);
56993         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56994         arg_conv.is_owned = false;
56995         int64_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
56996         return ret_conv;
56997 }
56998
56999 uint64_t  __attribute__((export_name("TS_TxCreationKeys_clone"))) TS_TxCreationKeys_clone(uint64_t orig) {
57000         LDKTxCreationKeys orig_conv;
57001         orig_conv.inner = untag_ptr(orig);
57002         orig_conv.is_owned = ptr_is_owned(orig);
57003         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57004         orig_conv.is_owned = false;
57005         LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
57006         uint64_t ret_ref = 0;
57007         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57008         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57009         return ret_ref;
57010 }
57011
57012 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_write"))) TS_TxCreationKeys_write(uint64_t obj) {
57013         LDKTxCreationKeys 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 = TxCreationKeys_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_TxCreationKeys_read"))) TS_TxCreationKeys_read(int8_tArray ser) {
57026         LDKu8slice ser_ref;
57027         ser_ref.datalen = ser->arr_len;
57028         ser_ref.data = ser->elems;
57029         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
57030         *ret_conv = TxCreationKeys_read(ser_ref);
57031         FREE(ser);
57032         return tag_ptr(ret_conv, true);
57033 }
57034
57035 void  __attribute__((export_name("TS_ChannelPublicKeys_free"))) TS_ChannelPublicKeys_free(uint64_t this_obj) {
57036         LDKChannelPublicKeys this_obj_conv;
57037         this_obj_conv.inner = untag_ptr(this_obj);
57038         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57040         ChannelPublicKeys_free(this_obj_conv);
57041 }
57042
57043 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_funding_pubkey"))) TS_ChannelPublicKeys_get_funding_pubkey(uint64_t this_ptr) {
57044         LDKChannelPublicKeys this_ptr_conv;
57045         this_ptr_conv.inner = untag_ptr(this_ptr);
57046         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57048         this_ptr_conv.is_owned = false;
57049         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
57050         memcpy(ret_arr->elems, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
57051         return ret_arr;
57052 }
57053
57054 void  __attribute__((export_name("TS_ChannelPublicKeys_set_funding_pubkey"))) TS_ChannelPublicKeys_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
57055         LDKChannelPublicKeys this_ptr_conv;
57056         this_ptr_conv.inner = untag_ptr(this_ptr);
57057         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57059         this_ptr_conv.is_owned = false;
57060         LDKPublicKey val_ref;
57061         CHECK(val->arr_len == 33);
57062         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
57063         ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
57064 }
57065
57066 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_get_revocation_basepoint"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint64_t this_ptr) {
57067         LDKChannelPublicKeys this_ptr_conv;
57068         this_ptr_conv.inner = untag_ptr(this_ptr);
57069         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57071         this_ptr_conv.is_owned = false;
57072         LDKRevocationBasepoint ret_var = ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv);
57073         uint64_t ret_ref = 0;
57074         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57075         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57076         return ret_ref;
57077 }
57078
57079 void  __attribute__((export_name("TS_ChannelPublicKeys_set_revocation_basepoint"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint64_t this_ptr, uint64_t val) {
57080         LDKChannelPublicKeys this_ptr_conv;
57081         this_ptr_conv.inner = untag_ptr(this_ptr);
57082         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57084         this_ptr_conv.is_owned = false;
57085         LDKRevocationBasepoint val_conv;
57086         val_conv.inner = untag_ptr(val);
57087         val_conv.is_owned = ptr_is_owned(val);
57088         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57089         val_conv = RevocationBasepoint_clone(&val_conv);
57090         ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_conv);
57091 }
57092
57093 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_payment_point"))) TS_ChannelPublicKeys_get_payment_point(uint64_t this_ptr) {
57094         LDKChannelPublicKeys this_ptr_conv;
57095         this_ptr_conv.inner = untag_ptr(this_ptr);
57096         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57098         this_ptr_conv.is_owned = false;
57099         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
57100         memcpy(ret_arr->elems, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
57101         return ret_arr;
57102 }
57103
57104 void  __attribute__((export_name("TS_ChannelPublicKeys_set_payment_point"))) TS_ChannelPublicKeys_set_payment_point(uint64_t this_ptr, int8_tArray val) {
57105         LDKChannelPublicKeys this_ptr_conv;
57106         this_ptr_conv.inner = untag_ptr(this_ptr);
57107         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57109         this_ptr_conv.is_owned = false;
57110         LDKPublicKey val_ref;
57111         CHECK(val->arr_len == 33);
57112         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
57113         ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
57114 }
57115
57116 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_get_delayed_payment_basepoint"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint64_t this_ptr) {
57117         LDKChannelPublicKeys this_ptr_conv;
57118         this_ptr_conv.inner = untag_ptr(this_ptr);
57119         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57121         this_ptr_conv.is_owned = false;
57122         LDKDelayedPaymentBasepoint ret_var = ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv);
57123         uint64_t ret_ref = 0;
57124         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57125         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57126         return ret_ref;
57127 }
57128
57129 void  __attribute__((export_name("TS_ChannelPublicKeys_set_delayed_payment_basepoint"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint64_t this_ptr, uint64_t val) {
57130         LDKChannelPublicKeys this_ptr_conv;
57131         this_ptr_conv.inner = untag_ptr(this_ptr);
57132         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57134         this_ptr_conv.is_owned = false;
57135         LDKDelayedPaymentBasepoint val_conv;
57136         val_conv.inner = untag_ptr(val);
57137         val_conv.is_owned = ptr_is_owned(val);
57138         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57139         val_conv = DelayedPaymentBasepoint_clone(&val_conv);
57140         ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_conv);
57141 }
57142
57143 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_get_htlc_basepoint"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint64_t this_ptr) {
57144         LDKChannelPublicKeys this_ptr_conv;
57145         this_ptr_conv.inner = untag_ptr(this_ptr);
57146         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57148         this_ptr_conv.is_owned = false;
57149         LDKHtlcBasepoint ret_var = ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv);
57150         uint64_t ret_ref = 0;
57151         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57152         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57153         return ret_ref;
57154 }
57155
57156 void  __attribute__((export_name("TS_ChannelPublicKeys_set_htlc_basepoint"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint64_t this_ptr, uint64_t val) {
57157         LDKChannelPublicKeys this_ptr_conv;
57158         this_ptr_conv.inner = untag_ptr(this_ptr);
57159         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57161         this_ptr_conv.is_owned = false;
57162         LDKHtlcBasepoint val_conv;
57163         val_conv.inner = untag_ptr(val);
57164         val_conv.is_owned = ptr_is_owned(val);
57165         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57166         val_conv = HtlcBasepoint_clone(&val_conv);
57167         ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_conv);
57168 }
57169
57170 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) {
57171         LDKPublicKey funding_pubkey_arg_ref;
57172         CHECK(funding_pubkey_arg->arr_len == 33);
57173         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
57174         LDKRevocationBasepoint revocation_basepoint_arg_conv;
57175         revocation_basepoint_arg_conv.inner = untag_ptr(revocation_basepoint_arg);
57176         revocation_basepoint_arg_conv.is_owned = ptr_is_owned(revocation_basepoint_arg);
57177         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_basepoint_arg_conv);
57178         revocation_basepoint_arg_conv = RevocationBasepoint_clone(&revocation_basepoint_arg_conv);
57179         LDKPublicKey payment_point_arg_ref;
57180         CHECK(payment_point_arg->arr_len == 33);
57181         memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
57182         LDKDelayedPaymentBasepoint delayed_payment_basepoint_arg_conv;
57183         delayed_payment_basepoint_arg_conv.inner = untag_ptr(delayed_payment_basepoint_arg);
57184         delayed_payment_basepoint_arg_conv.is_owned = ptr_is_owned(delayed_payment_basepoint_arg);
57185         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_basepoint_arg_conv);
57186         delayed_payment_basepoint_arg_conv = DelayedPaymentBasepoint_clone(&delayed_payment_basepoint_arg_conv);
57187         LDKHtlcBasepoint htlc_basepoint_arg_conv;
57188         htlc_basepoint_arg_conv.inner = untag_ptr(htlc_basepoint_arg);
57189         htlc_basepoint_arg_conv.is_owned = ptr_is_owned(htlc_basepoint_arg);
57190         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_basepoint_arg_conv);
57191         htlc_basepoint_arg_conv = HtlcBasepoint_clone(&htlc_basepoint_arg_conv);
57192         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);
57193         uint64_t ret_ref = 0;
57194         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57195         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57196         return ret_ref;
57197 }
57198
57199 static inline uint64_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
57200         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
57201         uint64_t ret_ref = 0;
57202         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57203         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57204         return ret_ref;
57205 }
57206 int64_t  __attribute__((export_name("TS_ChannelPublicKeys_clone_ptr"))) TS_ChannelPublicKeys_clone_ptr(uint64_t arg) {
57207         LDKChannelPublicKeys arg_conv;
57208         arg_conv.inner = untag_ptr(arg);
57209         arg_conv.is_owned = ptr_is_owned(arg);
57210         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57211         arg_conv.is_owned = false;
57212         int64_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
57213         return ret_conv;
57214 }
57215
57216 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_clone"))) TS_ChannelPublicKeys_clone(uint64_t orig) {
57217         LDKChannelPublicKeys orig_conv;
57218         orig_conv.inner = untag_ptr(orig);
57219         orig_conv.is_owned = ptr_is_owned(orig);
57220         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57221         orig_conv.is_owned = false;
57222         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
57223         uint64_t ret_ref = 0;
57224         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57225         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57226         return ret_ref;
57227 }
57228
57229 int64_t  __attribute__((export_name("TS_ChannelPublicKeys_hash"))) TS_ChannelPublicKeys_hash(uint64_t o) {
57230         LDKChannelPublicKeys o_conv;
57231         o_conv.inner = untag_ptr(o);
57232         o_conv.is_owned = ptr_is_owned(o);
57233         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
57234         o_conv.is_owned = false;
57235         int64_t ret_conv = ChannelPublicKeys_hash(&o_conv);
57236         return ret_conv;
57237 }
57238
57239 jboolean  __attribute__((export_name("TS_ChannelPublicKeys_eq"))) TS_ChannelPublicKeys_eq(uint64_t a, uint64_t b) {
57240         LDKChannelPublicKeys a_conv;
57241         a_conv.inner = untag_ptr(a);
57242         a_conv.is_owned = ptr_is_owned(a);
57243         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57244         a_conv.is_owned = false;
57245         LDKChannelPublicKeys b_conv;
57246         b_conv.inner = untag_ptr(b);
57247         b_conv.is_owned = ptr_is_owned(b);
57248         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
57249         b_conv.is_owned = false;
57250         jboolean ret_conv = ChannelPublicKeys_eq(&a_conv, &b_conv);
57251         return ret_conv;
57252 }
57253
57254 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_write"))) TS_ChannelPublicKeys_write(uint64_t obj) {
57255         LDKChannelPublicKeys obj_conv;
57256         obj_conv.inner = untag_ptr(obj);
57257         obj_conv.is_owned = ptr_is_owned(obj);
57258         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57259         obj_conv.is_owned = false;
57260         LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
57261         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57262         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57263         CVec_u8Z_free(ret_var);
57264         return ret_arr;
57265 }
57266
57267 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_read"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
57268         LDKu8slice ser_ref;
57269         ser_ref.datalen = ser->arr_len;
57270         ser_ref.data = ser->elems;
57271         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
57272         *ret_conv = ChannelPublicKeys_read(ser_ref);
57273         FREE(ser);
57274         return tag_ptr(ret_conv, true);
57275 }
57276
57277 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) {
57278         LDKPublicKey per_commitment_point_ref;
57279         CHECK(per_commitment_point->arr_len == 33);
57280         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
57281         LDKDelayedPaymentBasepoint broadcaster_delayed_payment_base_conv;
57282         broadcaster_delayed_payment_base_conv.inner = untag_ptr(broadcaster_delayed_payment_base);
57283         broadcaster_delayed_payment_base_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_base);
57284         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_base_conv);
57285         broadcaster_delayed_payment_base_conv.is_owned = false;
57286         LDKHtlcBasepoint broadcaster_htlc_base_conv;
57287         broadcaster_htlc_base_conv.inner = untag_ptr(broadcaster_htlc_base);
57288         broadcaster_htlc_base_conv.is_owned = ptr_is_owned(broadcaster_htlc_base);
57289         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_htlc_base_conv);
57290         broadcaster_htlc_base_conv.is_owned = false;
57291         LDKRevocationBasepoint countersignatory_revocation_base_conv;
57292         countersignatory_revocation_base_conv.inner = untag_ptr(countersignatory_revocation_base);
57293         countersignatory_revocation_base_conv.is_owned = ptr_is_owned(countersignatory_revocation_base);
57294         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_revocation_base_conv);
57295         countersignatory_revocation_base_conv.is_owned = false;
57296         LDKHtlcBasepoint countersignatory_htlc_base_conv;
57297         countersignatory_htlc_base_conv.inner = untag_ptr(countersignatory_htlc_base);
57298         countersignatory_htlc_base_conv.is_owned = ptr_is_owned(countersignatory_htlc_base);
57299         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_htlc_base_conv);
57300         countersignatory_htlc_base_conv.is_owned = false;
57301         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);
57302         uint64_t ret_ref = 0;
57303         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57304         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57305         return ret_ref;
57306 }
57307
57308 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) {
57309         LDKPublicKey per_commitment_point_ref;
57310         CHECK(per_commitment_point->arr_len == 33);
57311         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
57312         LDKChannelPublicKeys broadcaster_keys_conv;
57313         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
57314         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
57315         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
57316         broadcaster_keys_conv.is_owned = false;
57317         LDKChannelPublicKeys countersignatory_keys_conv;
57318         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
57319         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
57320         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
57321         countersignatory_keys_conv.is_owned = false;
57322         LDKTxCreationKeys ret_var = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
57323         uint64_t ret_ref = 0;
57324         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57325         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57326         return ret_ref;
57327 }
57328
57329 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) {
57330         LDKRevocationKey revocation_key_conv;
57331         revocation_key_conv.inner = untag_ptr(revocation_key);
57332         revocation_key_conv.is_owned = ptr_is_owned(revocation_key);
57333         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_key_conv);
57334         revocation_key_conv.is_owned = false;
57335         LDKDelayedPaymentKey broadcaster_delayed_payment_key_conv;
57336         broadcaster_delayed_payment_key_conv.inner = untag_ptr(broadcaster_delayed_payment_key);
57337         broadcaster_delayed_payment_key_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_key);
57338         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_key_conv);
57339         broadcaster_delayed_payment_key_conv.is_owned = false;
57340         LDKCVec_u8Z ret_var = get_revokeable_redeemscript(&revocation_key_conv, contest_delay, &broadcaster_delayed_payment_key_conv);
57341         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57342         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57343         CVec_u8Z_free(ret_var);
57344         return ret_arr;
57345 }
57346
57347 int8_tArray  __attribute__((export_name("TS_get_counterparty_payment_script"))) TS_get_counterparty_payment_script(uint64_t channel_type_features, int8_tArray payment_key) {
57348         LDKChannelTypeFeatures channel_type_features_conv;
57349         channel_type_features_conv.inner = untag_ptr(channel_type_features);
57350         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
57351         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
57352         channel_type_features_conv.is_owned = false;
57353         LDKPublicKey payment_key_ref;
57354         CHECK(payment_key->arr_len == 33);
57355         memcpy(payment_key_ref.compressed_form, payment_key->elems, 33); FREE(payment_key);
57356         LDKCVec_u8Z ret_var = get_counterparty_payment_script(&channel_type_features_conv, payment_key_ref);
57357         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57358         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57359         CVec_u8Z_free(ret_var);
57360         return ret_arr;
57361 }
57362
57363 void  __attribute__((export_name("TS_HTLCOutputInCommitment_free"))) TS_HTLCOutputInCommitment_free(uint64_t this_obj) {
57364         LDKHTLCOutputInCommitment this_obj_conv;
57365         this_obj_conv.inner = untag_ptr(this_obj);
57366         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57368         HTLCOutputInCommitment_free(this_obj_conv);
57369 }
57370
57371 jboolean  __attribute__((export_name("TS_HTLCOutputInCommitment_get_offered"))) TS_HTLCOutputInCommitment_get_offered(uint64_t this_ptr) {
57372         LDKHTLCOutputInCommitment this_ptr_conv;
57373         this_ptr_conv.inner = untag_ptr(this_ptr);
57374         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57376         this_ptr_conv.is_owned = false;
57377         jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
57378         return ret_conv;
57379 }
57380
57381 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_offered"))) TS_HTLCOutputInCommitment_set_offered(uint64_t this_ptr, jboolean val) {
57382         LDKHTLCOutputInCommitment this_ptr_conv;
57383         this_ptr_conv.inner = untag_ptr(this_ptr);
57384         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57386         this_ptr_conv.is_owned = false;
57387         HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
57388 }
57389
57390 int64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_amount_msat"))) TS_HTLCOutputInCommitment_get_amount_msat(uint64_t this_ptr) {
57391         LDKHTLCOutputInCommitment this_ptr_conv;
57392         this_ptr_conv.inner = untag_ptr(this_ptr);
57393         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57395         this_ptr_conv.is_owned = false;
57396         int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
57397         return ret_conv;
57398 }
57399
57400 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_amount_msat"))) TS_HTLCOutputInCommitment_set_amount_msat(uint64_t this_ptr, int64_t val) {
57401         LDKHTLCOutputInCommitment 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         HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
57407 }
57408
57409 int32_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_cltv_expiry"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint64_t this_ptr) {
57410         LDKHTLCOutputInCommitment this_ptr_conv;
57411         this_ptr_conv.inner = untag_ptr(this_ptr);
57412         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57414         this_ptr_conv.is_owned = false;
57415         int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
57416         return ret_conv;
57417 }
57418
57419 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_cltv_expiry"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
57420         LDKHTLCOutputInCommitment this_ptr_conv;
57421         this_ptr_conv.inner = untag_ptr(this_ptr);
57422         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57424         this_ptr_conv.is_owned = false;
57425         HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
57426 }
57427
57428 int8_tArray  __attribute__((export_name("TS_HTLCOutputInCommitment_get_payment_hash"))) TS_HTLCOutputInCommitment_get_payment_hash(uint64_t this_ptr) {
57429         LDKHTLCOutputInCommitment this_ptr_conv;
57430         this_ptr_conv.inner = untag_ptr(this_ptr);
57431         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57433         this_ptr_conv.is_owned = false;
57434         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
57435         memcpy(ret_arr->elems, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
57436         return ret_arr;
57437 }
57438
57439 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_payment_hash"))) TS_HTLCOutputInCommitment_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
57440         LDKHTLCOutputInCommitment this_ptr_conv;
57441         this_ptr_conv.inner = untag_ptr(this_ptr);
57442         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57444         this_ptr_conv.is_owned = false;
57445         LDKThirtyTwoBytes val_ref;
57446         CHECK(val->arr_len == 32);
57447         memcpy(val_ref.data, val->elems, 32); FREE(val);
57448         HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
57449 }
57450
57451 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_transaction_output_index"))) TS_HTLCOutputInCommitment_get_transaction_output_index(uint64_t this_ptr) {
57452         LDKHTLCOutputInCommitment this_ptr_conv;
57453         this_ptr_conv.inner = untag_ptr(this_ptr);
57454         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57456         this_ptr_conv.is_owned = false;
57457         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
57458         *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
57459         uint64_t ret_ref = tag_ptr(ret_copy, true);
57460         return ret_ref;
57461 }
57462
57463 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_transaction_output_index"))) TS_HTLCOutputInCommitment_set_transaction_output_index(uint64_t this_ptr, uint64_t val) {
57464         LDKHTLCOutputInCommitment this_ptr_conv;
57465         this_ptr_conv.inner = untag_ptr(this_ptr);
57466         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57468         this_ptr_conv.is_owned = false;
57469         void* val_ptr = untag_ptr(val);
57470         CHECK_ACCESS(val_ptr);
57471         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
57472         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
57473         HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
57474 }
57475
57476 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) {
57477         LDKThirtyTwoBytes payment_hash_arg_ref;
57478         CHECK(payment_hash_arg->arr_len == 32);
57479         memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
57480         void* transaction_output_index_arg_ptr = untag_ptr(transaction_output_index_arg);
57481         CHECK_ACCESS(transaction_output_index_arg_ptr);
57482         LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
57483         transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(transaction_output_index_arg));
57484         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
57485         uint64_t ret_ref = 0;
57486         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57487         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57488         return ret_ref;
57489 }
57490
57491 static inline uint64_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
57492         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
57493         uint64_t ret_ref = 0;
57494         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57495         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57496         return ret_ref;
57497 }
57498 int64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_clone_ptr"))) TS_HTLCOutputInCommitment_clone_ptr(uint64_t arg) {
57499         LDKHTLCOutputInCommitment arg_conv;
57500         arg_conv.inner = untag_ptr(arg);
57501         arg_conv.is_owned = ptr_is_owned(arg);
57502         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57503         arg_conv.is_owned = false;
57504         int64_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
57505         return ret_conv;
57506 }
57507
57508 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_clone"))) TS_HTLCOutputInCommitment_clone(uint64_t orig) {
57509         LDKHTLCOutputInCommitment orig_conv;
57510         orig_conv.inner = untag_ptr(orig);
57511         orig_conv.is_owned = ptr_is_owned(orig);
57512         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57513         orig_conv.is_owned = false;
57514         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
57515         uint64_t ret_ref = 0;
57516         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57517         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57518         return ret_ref;
57519 }
57520
57521 jboolean  __attribute__((export_name("TS_HTLCOutputInCommitment_eq"))) TS_HTLCOutputInCommitment_eq(uint64_t a, uint64_t b) {
57522         LDKHTLCOutputInCommitment a_conv;
57523         a_conv.inner = untag_ptr(a);
57524         a_conv.is_owned = ptr_is_owned(a);
57525         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57526         a_conv.is_owned = false;
57527         LDKHTLCOutputInCommitment b_conv;
57528         b_conv.inner = untag_ptr(b);
57529         b_conv.is_owned = ptr_is_owned(b);
57530         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
57531         b_conv.is_owned = false;
57532         jboolean ret_conv = HTLCOutputInCommitment_eq(&a_conv, &b_conv);
57533         return ret_conv;
57534 }
57535
57536 int8_tArray  __attribute__((export_name("TS_HTLCOutputInCommitment_write"))) TS_HTLCOutputInCommitment_write(uint64_t obj) {
57537         LDKHTLCOutputInCommitment obj_conv;
57538         obj_conv.inner = untag_ptr(obj);
57539         obj_conv.is_owned = ptr_is_owned(obj);
57540         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57541         obj_conv.is_owned = false;
57542         LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
57543         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57544         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57545         CVec_u8Z_free(ret_var);
57546         return ret_arr;
57547 }
57548
57549 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_read"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
57550         LDKu8slice ser_ref;
57551         ser_ref.datalen = ser->arr_len;
57552         ser_ref.data = ser->elems;
57553         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
57554         *ret_conv = HTLCOutputInCommitment_read(ser_ref);
57555         FREE(ser);
57556         return tag_ptr(ret_conv, true);
57557 }
57558
57559 int8_tArray  __attribute__((export_name("TS_get_htlc_redeemscript"))) TS_get_htlc_redeemscript(uint64_t htlc, uint64_t channel_type_features, uint64_t keys) {
57560         LDKHTLCOutputInCommitment htlc_conv;
57561         htlc_conv.inner = untag_ptr(htlc);
57562         htlc_conv.is_owned = ptr_is_owned(htlc);
57563         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
57564         htlc_conv.is_owned = false;
57565         LDKChannelTypeFeatures channel_type_features_conv;
57566         channel_type_features_conv.inner = untag_ptr(channel_type_features);
57567         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
57568         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
57569         channel_type_features_conv.is_owned = false;
57570         LDKTxCreationKeys keys_conv;
57571         keys_conv.inner = untag_ptr(keys);
57572         keys_conv.is_owned = ptr_is_owned(keys);
57573         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
57574         keys_conv.is_owned = false;
57575         LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &channel_type_features_conv, &keys_conv);
57576         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57577         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57578         CVec_u8Z_free(ret_var);
57579         return ret_arr;
57580 }
57581
57582 int8_tArray  __attribute__((export_name("TS_make_funding_redeemscript"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
57583         LDKPublicKey broadcaster_ref;
57584         CHECK(broadcaster->arr_len == 33);
57585         memcpy(broadcaster_ref.compressed_form, broadcaster->elems, 33); FREE(broadcaster);
57586         LDKPublicKey countersignatory_ref;
57587         CHECK(countersignatory->arr_len == 33);
57588         memcpy(countersignatory_ref.compressed_form, countersignatory->elems, 33); FREE(countersignatory);
57589         LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
57590         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57591         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57592         CVec_u8Z_free(ret_var);
57593         return ret_arr;
57594 }
57595
57596 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) {
57597         uint8_t commitment_txid_arr[32];
57598         CHECK(commitment_txid->arr_len == 32);
57599         memcpy(commitment_txid_arr, commitment_txid->elems, 32); FREE(commitment_txid);
57600         uint8_t (*commitment_txid_ref)[32] = &commitment_txid_arr;
57601         LDKHTLCOutputInCommitment htlc_conv;
57602         htlc_conv.inner = untag_ptr(htlc);
57603         htlc_conv.is_owned = ptr_is_owned(htlc);
57604         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
57605         htlc_conv.is_owned = false;
57606         LDKChannelTypeFeatures channel_type_features_conv;
57607         channel_type_features_conv.inner = untag_ptr(channel_type_features);
57608         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
57609         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
57610         channel_type_features_conv.is_owned = false;
57611         LDKDelayedPaymentKey broadcaster_delayed_payment_key_conv;
57612         broadcaster_delayed_payment_key_conv.inner = untag_ptr(broadcaster_delayed_payment_key);
57613         broadcaster_delayed_payment_key_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_key);
57614         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_key_conv);
57615         broadcaster_delayed_payment_key_conv.is_owned = false;
57616         LDKRevocationKey revocation_key_conv;
57617         revocation_key_conv.inner = untag_ptr(revocation_key);
57618         revocation_key_conv.is_owned = ptr_is_owned(revocation_key);
57619         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_key_conv);
57620         revocation_key_conv.is_owned = false;
57621         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);
57622         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57623         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57624         Transaction_free(ret_var);
57625         return ret_arr;
57626 }
57627
57628 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) {
57629         LDKECDSASignature local_sig_ref;
57630         CHECK(local_sig->arr_len == 64);
57631         memcpy(local_sig_ref.compact_form, local_sig->elems, 64); FREE(local_sig);
57632         LDKECDSASignature remote_sig_ref;
57633         CHECK(remote_sig->arr_len == 64);
57634         memcpy(remote_sig_ref.compact_form, remote_sig->elems, 64); FREE(remote_sig);
57635         void* preimage_ptr = untag_ptr(preimage);
57636         CHECK_ACCESS(preimage_ptr);
57637         LDKCOption_ThirtyTwoBytesZ preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(preimage_ptr);
57638         preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(preimage));
57639         LDKu8slice redeem_script_ref;
57640         redeem_script_ref.datalen = redeem_script->arr_len;
57641         redeem_script_ref.data = redeem_script->elems;
57642         LDKChannelTypeFeatures channel_type_features_conv;
57643         channel_type_features_conv.inner = untag_ptr(channel_type_features);
57644         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
57645         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
57646         channel_type_features_conv.is_owned = false;
57647         LDKWitness ret_var = build_htlc_input_witness(local_sig_ref, remote_sig_ref, preimage_conv, redeem_script_ref, &channel_type_features_conv);
57648         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57649         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57650         Witness_free(ret_var);
57651         FREE(redeem_script);
57652         return ret_arr;
57653 }
57654
57655 int8_tArray  __attribute__((export_name("TS_get_to_countersignatory_with_anchors_redeemscript"))) TS_get_to_countersignatory_with_anchors_redeemscript(int8_tArray payment_point) {
57656         LDKPublicKey payment_point_ref;
57657         CHECK(payment_point->arr_len == 33);
57658         memcpy(payment_point_ref.compressed_form, payment_point->elems, 33); FREE(payment_point);
57659         LDKCVec_u8Z ret_var = get_to_countersignatory_with_anchors_redeemscript(payment_point_ref);
57660         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57661         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57662         CVec_u8Z_free(ret_var);
57663         return ret_arr;
57664 }
57665
57666 int8_tArray  __attribute__((export_name("TS_get_anchor_redeemscript"))) TS_get_anchor_redeemscript(int8_tArray funding_pubkey) {
57667         LDKPublicKey funding_pubkey_ref;
57668         CHECK(funding_pubkey->arr_len == 33);
57669         memcpy(funding_pubkey_ref.compressed_form, funding_pubkey->elems, 33); FREE(funding_pubkey);
57670         LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
57671         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57672         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57673         CVec_u8Z_free(ret_var);
57674         return ret_arr;
57675 }
57676
57677 int8_tArray  __attribute__((export_name("TS_build_anchor_input_witness"))) TS_build_anchor_input_witness(int8_tArray funding_key, int8_tArray funding_sig) {
57678         LDKPublicKey funding_key_ref;
57679         CHECK(funding_key->arr_len == 33);
57680         memcpy(funding_key_ref.compressed_form, funding_key->elems, 33); FREE(funding_key);
57681         LDKECDSASignature funding_sig_ref;
57682         CHECK(funding_sig->arr_len == 64);
57683         memcpy(funding_sig_ref.compact_form, funding_sig->elems, 64); FREE(funding_sig);
57684         LDKWitness ret_var = build_anchor_input_witness(funding_key_ref, funding_sig_ref);
57685         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57686         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57687         Witness_free(ret_var);
57688         return ret_arr;
57689 }
57690
57691 void  __attribute__((export_name("TS_ChannelTransactionParameters_free"))) TS_ChannelTransactionParameters_free(uint64_t this_obj) {
57692         LDKChannelTransactionParameters this_obj_conv;
57693         this_obj_conv.inner = untag_ptr(this_obj);
57694         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57696         ChannelTransactionParameters_free(this_obj_conv);
57697 }
57698
57699 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_pubkeys"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint64_t this_ptr) {
57700         LDKChannelTransactionParameters this_ptr_conv;
57701         this_ptr_conv.inner = untag_ptr(this_ptr);
57702         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57704         this_ptr_conv.is_owned = false;
57705         LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
57706         uint64_t ret_ref = 0;
57707         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57708         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57709         return ret_ref;
57710 }
57711
57712 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_holder_pubkeys"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint64_t this_ptr, uint64_t val) {
57713         LDKChannelTransactionParameters this_ptr_conv;
57714         this_ptr_conv.inner = untag_ptr(this_ptr);
57715         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57717         this_ptr_conv.is_owned = false;
57718         LDKChannelPublicKeys val_conv;
57719         val_conv.inner = untag_ptr(val);
57720         val_conv.is_owned = ptr_is_owned(val);
57721         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57722         val_conv = ChannelPublicKeys_clone(&val_conv);
57723         ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
57724 }
57725
57726 int16_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_selected_contest_delay"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint64_t this_ptr) {
57727         LDKChannelTransactionParameters this_ptr_conv;
57728         this_ptr_conv.inner = untag_ptr(this_ptr);
57729         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57731         this_ptr_conv.is_owned = false;
57732         int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
57733         return ret_conv;
57734 }
57735
57736 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) {
57737         LDKChannelTransactionParameters this_ptr_conv;
57738         this_ptr_conv.inner = untag_ptr(this_ptr);
57739         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57741         this_ptr_conv.is_owned = false;
57742         ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
57743 }
57744
57745 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_get_is_outbound_from_holder"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint64_t this_ptr) {
57746         LDKChannelTransactionParameters this_ptr_conv;
57747         this_ptr_conv.inner = untag_ptr(this_ptr);
57748         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57750         this_ptr_conv.is_owned = false;
57751         jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
57752         return ret_conv;
57753 }
57754
57755 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_is_outbound_from_holder"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint64_t this_ptr, jboolean val) {
57756         LDKChannelTransactionParameters this_ptr_conv;
57757         this_ptr_conv.inner = untag_ptr(this_ptr);
57758         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57760         this_ptr_conv.is_owned = false;
57761         ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
57762 }
57763
57764 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_counterparty_parameters"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint64_t this_ptr) {
57765         LDKChannelTransactionParameters this_ptr_conv;
57766         this_ptr_conv.inner = untag_ptr(this_ptr);
57767         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57769         this_ptr_conv.is_owned = false;
57770         LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
57771         uint64_t ret_ref = 0;
57772         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57773         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57774         return ret_ref;
57775 }
57776
57777 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_counterparty_parameters"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint64_t this_ptr, uint64_t val) {
57778         LDKChannelTransactionParameters this_ptr_conv;
57779         this_ptr_conv.inner = untag_ptr(this_ptr);
57780         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57782         this_ptr_conv.is_owned = false;
57783         LDKCounterpartyChannelTransactionParameters val_conv;
57784         val_conv.inner = untag_ptr(val);
57785         val_conv.is_owned = ptr_is_owned(val);
57786         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57787         val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
57788         ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
57789 }
57790
57791 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_funding_outpoint"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint64_t this_ptr) {
57792         LDKChannelTransactionParameters this_ptr_conv;
57793         this_ptr_conv.inner = untag_ptr(this_ptr);
57794         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57796         this_ptr_conv.is_owned = false;
57797         LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
57798         uint64_t ret_ref = 0;
57799         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57800         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57801         return ret_ref;
57802 }
57803
57804 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_funding_outpoint"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint64_t this_ptr, uint64_t val) {
57805         LDKChannelTransactionParameters this_ptr_conv;
57806         this_ptr_conv.inner = untag_ptr(this_ptr);
57807         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57809         this_ptr_conv.is_owned = false;
57810         LDKOutPoint val_conv;
57811         val_conv.inner = untag_ptr(val);
57812         val_conv.is_owned = ptr_is_owned(val);
57813         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57814         val_conv = OutPoint_clone(&val_conv);
57815         ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
57816 }
57817
57818 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_channel_type_features"))) TS_ChannelTransactionParameters_get_channel_type_features(uint64_t this_ptr) {
57819         LDKChannelTransactionParameters this_ptr_conv;
57820         this_ptr_conv.inner = untag_ptr(this_ptr);
57821         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57823         this_ptr_conv.is_owned = false;
57824         LDKChannelTypeFeatures ret_var = ChannelTransactionParameters_get_channel_type_features(&this_ptr_conv);
57825         uint64_t ret_ref = 0;
57826         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57827         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57828         return ret_ref;
57829 }
57830
57831 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_channel_type_features"))) TS_ChannelTransactionParameters_set_channel_type_features(uint64_t this_ptr, uint64_t val) {
57832         LDKChannelTransactionParameters this_ptr_conv;
57833         this_ptr_conv.inner = untag_ptr(this_ptr);
57834         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57836         this_ptr_conv.is_owned = false;
57837         LDKChannelTypeFeatures val_conv;
57838         val_conv.inner = untag_ptr(val);
57839         val_conv.is_owned = ptr_is_owned(val);
57840         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57841         val_conv = ChannelTypeFeatures_clone(&val_conv);
57842         ChannelTransactionParameters_set_channel_type_features(&this_ptr_conv, val_conv);
57843 }
57844
57845 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) {
57846         LDKChannelPublicKeys holder_pubkeys_arg_conv;
57847         holder_pubkeys_arg_conv.inner = untag_ptr(holder_pubkeys_arg);
57848         holder_pubkeys_arg_conv.is_owned = ptr_is_owned(holder_pubkeys_arg);
57849         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
57850         holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
57851         LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
57852         counterparty_parameters_arg_conv.inner = untag_ptr(counterparty_parameters_arg);
57853         counterparty_parameters_arg_conv.is_owned = ptr_is_owned(counterparty_parameters_arg);
57854         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
57855         counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
57856         LDKOutPoint funding_outpoint_arg_conv;
57857         funding_outpoint_arg_conv.inner = untag_ptr(funding_outpoint_arg);
57858         funding_outpoint_arg_conv.is_owned = ptr_is_owned(funding_outpoint_arg);
57859         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
57860         funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
57861         LDKChannelTypeFeatures channel_type_features_arg_conv;
57862         channel_type_features_arg_conv.inner = untag_ptr(channel_type_features_arg);
57863         channel_type_features_arg_conv.is_owned = ptr_is_owned(channel_type_features_arg);
57864         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_arg_conv);
57865         channel_type_features_arg_conv = ChannelTypeFeatures_clone(&channel_type_features_arg_conv);
57866         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);
57867         uint64_t ret_ref = 0;
57868         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57869         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57870         return ret_ref;
57871 }
57872
57873 static inline uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
57874         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
57875         uint64_t ret_ref = 0;
57876         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57877         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57878         return ret_ref;
57879 }
57880 int64_t  __attribute__((export_name("TS_ChannelTransactionParameters_clone_ptr"))) TS_ChannelTransactionParameters_clone_ptr(uint64_t arg) {
57881         LDKChannelTransactionParameters arg_conv;
57882         arg_conv.inner = untag_ptr(arg);
57883         arg_conv.is_owned = ptr_is_owned(arg);
57884         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57885         arg_conv.is_owned = false;
57886         int64_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
57887         return ret_conv;
57888 }
57889
57890 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_clone"))) TS_ChannelTransactionParameters_clone(uint64_t orig) {
57891         LDKChannelTransactionParameters orig_conv;
57892         orig_conv.inner = untag_ptr(orig);
57893         orig_conv.is_owned = ptr_is_owned(orig);
57894         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57895         orig_conv.is_owned = false;
57896         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
57897         uint64_t ret_ref = 0;
57898         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57899         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57900         return ret_ref;
57901 }
57902
57903 int64_t  __attribute__((export_name("TS_ChannelTransactionParameters_hash"))) TS_ChannelTransactionParameters_hash(uint64_t o) {
57904         LDKChannelTransactionParameters o_conv;
57905         o_conv.inner = untag_ptr(o);
57906         o_conv.is_owned = ptr_is_owned(o);
57907         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
57908         o_conv.is_owned = false;
57909         int64_t ret_conv = ChannelTransactionParameters_hash(&o_conv);
57910         return ret_conv;
57911 }
57912
57913 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_eq"))) TS_ChannelTransactionParameters_eq(uint64_t a, uint64_t b) {
57914         LDKChannelTransactionParameters a_conv;
57915         a_conv.inner = untag_ptr(a);
57916         a_conv.is_owned = ptr_is_owned(a);
57917         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57918         a_conv.is_owned = false;
57919         LDKChannelTransactionParameters b_conv;
57920         b_conv.inner = untag_ptr(b);
57921         b_conv.is_owned = ptr_is_owned(b);
57922         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
57923         b_conv.is_owned = false;
57924         jboolean ret_conv = ChannelTransactionParameters_eq(&a_conv, &b_conv);
57925         return ret_conv;
57926 }
57927
57928 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_free"))) TS_CounterpartyChannelTransactionParameters_free(uint64_t this_obj) {
57929         LDKCounterpartyChannelTransactionParameters this_obj_conv;
57930         this_obj_conv.inner = untag_ptr(this_obj);
57931         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57933         CounterpartyChannelTransactionParameters_free(this_obj_conv);
57934 }
57935
57936 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_pubkeys"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint64_t this_ptr) {
57937         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
57938         this_ptr_conv.inner = untag_ptr(this_ptr);
57939         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57941         this_ptr_conv.is_owned = false;
57942         LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
57943         uint64_t ret_ref = 0;
57944         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57945         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57946         return ret_ref;
57947 }
57948
57949 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_pubkeys"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint64_t this_ptr, uint64_t val) {
57950         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
57951         this_ptr_conv.inner = untag_ptr(this_ptr);
57952         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57954         this_ptr_conv.is_owned = false;
57955         LDKChannelPublicKeys val_conv;
57956         val_conv.inner = untag_ptr(val);
57957         val_conv.is_owned = ptr_is_owned(val);
57958         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57959         val_conv = ChannelPublicKeys_clone(&val_conv);
57960         CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
57961 }
57962
57963 int16_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint64_t this_ptr) {
57964         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
57965         this_ptr_conv.inner = untag_ptr(this_ptr);
57966         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57968         this_ptr_conv.is_owned = false;
57969         int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
57970         return ret_conv;
57971 }
57972
57973 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint64_t this_ptr, int16_t val) {
57974         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
57975         this_ptr_conv.inner = untag_ptr(this_ptr);
57976         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57978         this_ptr_conv.is_owned = false;
57979         CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
57980 }
57981
57982 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_new"))) TS_CounterpartyChannelTransactionParameters_new(uint64_t pubkeys_arg, int16_t selected_contest_delay_arg) {
57983         LDKChannelPublicKeys pubkeys_arg_conv;
57984         pubkeys_arg_conv.inner = untag_ptr(pubkeys_arg);
57985         pubkeys_arg_conv.is_owned = ptr_is_owned(pubkeys_arg);
57986         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
57987         pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
57988         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
57989         uint64_t ret_ref = 0;
57990         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57991         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57992         return ret_ref;
57993 }
57994
57995 static inline uint64_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
57996         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
57997         uint64_t ret_ref = 0;
57998         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57999         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58000         return ret_ref;
58001 }
58002 int64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone_ptr"))) TS_CounterpartyChannelTransactionParameters_clone_ptr(uint64_t arg) {
58003         LDKCounterpartyChannelTransactionParameters arg_conv;
58004         arg_conv.inner = untag_ptr(arg);
58005         arg_conv.is_owned = ptr_is_owned(arg);
58006         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58007         arg_conv.is_owned = false;
58008         int64_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
58009         return ret_conv;
58010 }
58011
58012 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone"))) TS_CounterpartyChannelTransactionParameters_clone(uint64_t orig) {
58013         LDKCounterpartyChannelTransactionParameters orig_conv;
58014         orig_conv.inner = untag_ptr(orig);
58015         orig_conv.is_owned = ptr_is_owned(orig);
58016         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58017         orig_conv.is_owned = false;
58018         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
58019         uint64_t ret_ref = 0;
58020         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58021         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58022         return ret_ref;
58023 }
58024
58025 int64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_hash"))) TS_CounterpartyChannelTransactionParameters_hash(uint64_t o) {
58026         LDKCounterpartyChannelTransactionParameters o_conv;
58027         o_conv.inner = untag_ptr(o);
58028         o_conv.is_owned = ptr_is_owned(o);
58029         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
58030         o_conv.is_owned = false;
58031         int64_t ret_conv = CounterpartyChannelTransactionParameters_hash(&o_conv);
58032         return ret_conv;
58033 }
58034
58035 jboolean  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_eq"))) TS_CounterpartyChannelTransactionParameters_eq(uint64_t a, uint64_t b) {
58036         LDKCounterpartyChannelTransactionParameters a_conv;
58037         a_conv.inner = untag_ptr(a);
58038         a_conv.is_owned = ptr_is_owned(a);
58039         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58040         a_conv.is_owned = false;
58041         LDKCounterpartyChannelTransactionParameters b_conv;
58042         b_conv.inner = untag_ptr(b);
58043         b_conv.is_owned = ptr_is_owned(b);
58044         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58045         b_conv.is_owned = false;
58046         jboolean ret_conv = CounterpartyChannelTransactionParameters_eq(&a_conv, &b_conv);
58047         return ret_conv;
58048 }
58049
58050 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_is_populated"))) TS_ChannelTransactionParameters_is_populated(uint64_t this_arg) {
58051         LDKChannelTransactionParameters this_arg_conv;
58052         this_arg_conv.inner = untag_ptr(this_arg);
58053         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58055         this_arg_conv.is_owned = false;
58056         jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
58057         return ret_conv;
58058 }
58059
58060 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_as_holder_broadcastable"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint64_t this_arg) {
58061         LDKChannelTransactionParameters this_arg_conv;
58062         this_arg_conv.inner = untag_ptr(this_arg);
58063         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58065         this_arg_conv.is_owned = false;
58066         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
58067         uint64_t ret_ref = 0;
58068         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58069         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58070         return ret_ref;
58071 }
58072
58073 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_as_counterparty_broadcastable"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint64_t this_arg) {
58074         LDKChannelTransactionParameters this_arg_conv;
58075         this_arg_conv.inner = untag_ptr(this_arg);
58076         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58078         this_arg_conv.is_owned = false;
58079         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
58080         uint64_t ret_ref = 0;
58081         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58082         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58083         return ret_ref;
58084 }
58085
58086 int8_tArray  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_write"))) TS_CounterpartyChannelTransactionParameters_write(uint64_t obj) {
58087         LDKCounterpartyChannelTransactionParameters obj_conv;
58088         obj_conv.inner = untag_ptr(obj);
58089         obj_conv.is_owned = ptr_is_owned(obj);
58090         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58091         obj_conv.is_owned = false;
58092         LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
58093         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58094         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58095         CVec_u8Z_free(ret_var);
58096         return ret_arr;
58097 }
58098
58099 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_read"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
58100         LDKu8slice ser_ref;
58101         ser_ref.datalen = ser->arr_len;
58102         ser_ref.data = ser->elems;
58103         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
58104         *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
58105         FREE(ser);
58106         return tag_ptr(ret_conv, true);
58107 }
58108
58109 int8_tArray  __attribute__((export_name("TS_ChannelTransactionParameters_write"))) TS_ChannelTransactionParameters_write(uint64_t obj) {
58110         LDKChannelTransactionParameters obj_conv;
58111         obj_conv.inner = untag_ptr(obj);
58112         obj_conv.is_owned = ptr_is_owned(obj);
58113         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58114         obj_conv.is_owned = false;
58115         LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
58116         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58117         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58118         CVec_u8Z_free(ret_var);
58119         return ret_arr;
58120 }
58121
58122 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_read"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
58123         LDKu8slice ser_ref;
58124         ser_ref.datalen = ser->arr_len;
58125         ser_ref.data = ser->elems;
58126         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
58127         *ret_conv = ChannelTransactionParameters_read(ser_ref);
58128         FREE(ser);
58129         return tag_ptr(ret_conv, true);
58130 }
58131
58132 void  __attribute__((export_name("TS_DirectedChannelTransactionParameters_free"))) TS_DirectedChannelTransactionParameters_free(uint64_t this_obj) {
58133         LDKDirectedChannelTransactionParameters this_obj_conv;
58134         this_obj_conv.inner = untag_ptr(this_obj);
58135         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58137         DirectedChannelTransactionParameters_free(this_obj_conv);
58138 }
58139
58140 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_broadcaster_pubkeys"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint64_t this_arg) {
58141         LDKDirectedChannelTransactionParameters this_arg_conv;
58142         this_arg_conv.inner = untag_ptr(this_arg);
58143         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58145         this_arg_conv.is_owned = false;
58146         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
58147         uint64_t ret_ref = 0;
58148         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58149         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58150         return ret_ref;
58151 }
58152
58153 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_countersignatory_pubkeys"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint64_t this_arg) {
58154         LDKDirectedChannelTransactionParameters this_arg_conv;
58155         this_arg_conv.inner = untag_ptr(this_arg);
58156         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58158         this_arg_conv.is_owned = false;
58159         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
58160         uint64_t ret_ref = 0;
58161         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58162         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58163         return ret_ref;
58164 }
58165
58166 int16_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_contest_delay"))) TS_DirectedChannelTransactionParameters_contest_delay(uint64_t this_arg) {
58167         LDKDirectedChannelTransactionParameters this_arg_conv;
58168         this_arg_conv.inner = untag_ptr(this_arg);
58169         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58171         this_arg_conv.is_owned = false;
58172         int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
58173         return ret_conv;
58174 }
58175
58176 jboolean  __attribute__((export_name("TS_DirectedChannelTransactionParameters_is_outbound"))) TS_DirectedChannelTransactionParameters_is_outbound(uint64_t this_arg) {
58177         LDKDirectedChannelTransactionParameters this_arg_conv;
58178         this_arg_conv.inner = untag_ptr(this_arg);
58179         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58181         this_arg_conv.is_owned = false;
58182         jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
58183         return ret_conv;
58184 }
58185
58186 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_funding_outpoint"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint64_t this_arg) {
58187         LDKDirectedChannelTransactionParameters this_arg_conv;
58188         this_arg_conv.inner = untag_ptr(this_arg);
58189         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58191         this_arg_conv.is_owned = false;
58192         LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
58193         uint64_t ret_ref = 0;
58194         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58195         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58196         return ret_ref;
58197 }
58198
58199 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_channel_type_features"))) TS_DirectedChannelTransactionParameters_channel_type_features(uint64_t this_arg) {
58200         LDKDirectedChannelTransactionParameters this_arg_conv;
58201         this_arg_conv.inner = untag_ptr(this_arg);
58202         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58204         this_arg_conv.is_owned = false;
58205         LDKChannelTypeFeatures ret_var = DirectedChannelTransactionParameters_channel_type_features(&this_arg_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_HolderCommitmentTransaction_free"))) TS_HolderCommitmentTransaction_free(uint64_t this_obj) {
58213         LDKHolderCommitmentTransaction this_obj_conv;
58214         this_obj_conv.inner = untag_ptr(this_obj);
58215         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58217         HolderCommitmentTransaction_free(this_obj_conv);
58218 }
58219
58220 int8_tArray  __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_sig"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint64_t this_ptr) {
58221         LDKHolderCommitmentTransaction this_ptr_conv;
58222         this_ptr_conv.inner = untag_ptr(this_ptr);
58223         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58225         this_ptr_conv.is_owned = false;
58226         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
58227         memcpy(ret_arr->elems, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
58228         return ret_arr;
58229 }
58230
58231 void  __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_sig"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint64_t this_ptr, int8_tArray val) {
58232         LDKHolderCommitmentTransaction this_ptr_conv;
58233         this_ptr_conv.inner = untag_ptr(this_ptr);
58234         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58236         this_ptr_conv.is_owned = false;
58237         LDKECDSASignature val_ref;
58238         CHECK(val->arr_len == 64);
58239         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
58240         HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
58241 }
58242
58243 ptrArray  __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_get_counterparty_htlc_sigs(uint64_t this_ptr) {
58244         LDKHolderCommitmentTransaction this_ptr_conv;
58245         this_ptr_conv.inner = untag_ptr(this_ptr);
58246         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58248         this_ptr_conv.is_owned = false;
58249         LDKCVec_ECDSASignatureZ ret_var = HolderCommitmentTransaction_get_counterparty_htlc_sigs(&this_ptr_conv);
58250         ptrArray ret_arr = NULL;
58251         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
58252         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
58253         for (size_t m = 0; m < ret_var.datalen; m++) {
58254                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
58255                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
58256                 ret_arr_ptr[m] = ret_conv_12_arr;
58257         }
58258         
58259         FREE(ret_var.data);
58260         return ret_arr;
58261 }
58262
58263 void  __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint64_t this_ptr, ptrArray val) {
58264         LDKHolderCommitmentTransaction this_ptr_conv;
58265         this_ptr_conv.inner = untag_ptr(this_ptr);
58266         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58268         this_ptr_conv.is_owned = false;
58269         LDKCVec_ECDSASignatureZ val_constr;
58270         val_constr.datalen = val->arr_len;
58271         if (val_constr.datalen > 0)
58272                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
58273         else
58274                 val_constr.data = NULL;
58275         int8_tArray* val_vals = (void*) val->elems;
58276         for (size_t m = 0; m < val_constr.datalen; m++) {
58277                 int8_tArray val_conv_12 = val_vals[m];
58278                 LDKECDSASignature val_conv_12_ref;
58279                 CHECK(val_conv_12->arr_len == 64);
58280                 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
58281                 val_constr.data[m] = val_conv_12_ref;
58282         }
58283         FREE(val);
58284         HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
58285 }
58286
58287 static inline uint64_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
58288         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
58289         uint64_t ret_ref = 0;
58290         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58291         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58292         return ret_ref;
58293 }
58294 int64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_clone_ptr"))) TS_HolderCommitmentTransaction_clone_ptr(uint64_t arg) {
58295         LDKHolderCommitmentTransaction arg_conv;
58296         arg_conv.inner = untag_ptr(arg);
58297         arg_conv.is_owned = ptr_is_owned(arg);
58298         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58299         arg_conv.is_owned = false;
58300         int64_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
58301         return ret_conv;
58302 }
58303
58304 uint64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_clone"))) TS_HolderCommitmentTransaction_clone(uint64_t orig) {
58305         LDKHolderCommitmentTransaction orig_conv;
58306         orig_conv.inner = untag_ptr(orig);
58307         orig_conv.is_owned = ptr_is_owned(orig);
58308         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58309         orig_conv.is_owned = false;
58310         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
58311         uint64_t ret_ref = 0;
58312         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58313         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58314         return ret_ref;
58315 }
58316
58317 int8_tArray  __attribute__((export_name("TS_HolderCommitmentTransaction_write"))) TS_HolderCommitmentTransaction_write(uint64_t obj) {
58318         LDKHolderCommitmentTransaction obj_conv;
58319         obj_conv.inner = untag_ptr(obj);
58320         obj_conv.is_owned = ptr_is_owned(obj);
58321         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58322         obj_conv.is_owned = false;
58323         LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
58324         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58325         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58326         CVec_u8Z_free(ret_var);
58327         return ret_arr;
58328 }
58329
58330 uint64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_read"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
58331         LDKu8slice ser_ref;
58332         ser_ref.datalen = ser->arr_len;
58333         ser_ref.data = ser->elems;
58334         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
58335         *ret_conv = HolderCommitmentTransaction_read(ser_ref);
58336         FREE(ser);
58337         return tag_ptr(ret_conv, true);
58338 }
58339
58340 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) {
58341         LDKCommitmentTransaction commitment_tx_conv;
58342         commitment_tx_conv.inner = untag_ptr(commitment_tx);
58343         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
58344         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
58345         commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
58346         LDKECDSASignature counterparty_sig_ref;
58347         CHECK(counterparty_sig->arr_len == 64);
58348         memcpy(counterparty_sig_ref.compact_form, counterparty_sig->elems, 64); FREE(counterparty_sig);
58349         LDKCVec_ECDSASignatureZ counterparty_htlc_sigs_constr;
58350         counterparty_htlc_sigs_constr.datalen = counterparty_htlc_sigs->arr_len;
58351         if (counterparty_htlc_sigs_constr.datalen > 0)
58352                 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
58353         else
58354                 counterparty_htlc_sigs_constr.data = NULL;
58355         int8_tArray* counterparty_htlc_sigs_vals = (void*) counterparty_htlc_sigs->elems;
58356         for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
58357                 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
58358                 LDKECDSASignature counterparty_htlc_sigs_conv_12_ref;
58359                 CHECK(counterparty_htlc_sigs_conv_12->arr_len == 64);
58360                 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, counterparty_htlc_sigs_conv_12->elems, 64); FREE(counterparty_htlc_sigs_conv_12);
58361                 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
58362         }
58363         FREE(counterparty_htlc_sigs);
58364         LDKPublicKey holder_funding_key_ref;
58365         CHECK(holder_funding_key->arr_len == 33);
58366         memcpy(holder_funding_key_ref.compressed_form, holder_funding_key->elems, 33); FREE(holder_funding_key);
58367         LDKPublicKey counterparty_funding_key_ref;
58368         CHECK(counterparty_funding_key->arr_len == 33);
58369         memcpy(counterparty_funding_key_ref.compressed_form, counterparty_funding_key->elems, 33); FREE(counterparty_funding_key);
58370         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
58371         uint64_t ret_ref = 0;
58372         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58373         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58374         return ret_ref;
58375 }
58376
58377 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_free"))) TS_BuiltCommitmentTransaction_free(uint64_t this_obj) {
58378         LDKBuiltCommitmentTransaction this_obj_conv;
58379         this_obj_conv.inner = untag_ptr(this_obj);
58380         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58382         BuiltCommitmentTransaction_free(this_obj_conv);
58383 }
58384
58385 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_get_transaction"))) TS_BuiltCommitmentTransaction_get_transaction(uint64_t this_ptr) {
58386         LDKBuiltCommitmentTransaction this_ptr_conv;
58387         this_ptr_conv.inner = untag_ptr(this_ptr);
58388         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58390         this_ptr_conv.is_owned = false;
58391         LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
58392         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58393         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58394         Transaction_free(ret_var);
58395         return ret_arr;
58396 }
58397
58398 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_set_transaction"))) TS_BuiltCommitmentTransaction_set_transaction(uint64_t this_ptr, int8_tArray val) {
58399         LDKBuiltCommitmentTransaction 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         LDKTransaction val_ref;
58405         val_ref.datalen = val->arr_len;
58406         val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
58407         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
58408         val_ref.data_is_owned = true;
58409         BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
58410 }
58411
58412 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_get_txid"))) TS_BuiltCommitmentTransaction_get_txid(uint64_t this_ptr) {
58413         LDKBuiltCommitmentTransaction this_ptr_conv;
58414         this_ptr_conv.inner = untag_ptr(this_ptr);
58415         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58417         this_ptr_conv.is_owned = false;
58418         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
58419         memcpy(ret_arr->elems, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
58420         return ret_arr;
58421 }
58422
58423 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_set_txid"))) TS_BuiltCommitmentTransaction_set_txid(uint64_t this_ptr, int8_tArray val) {
58424         LDKBuiltCommitmentTransaction 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         LDKThirtyTwoBytes val_ref;
58430         CHECK(val->arr_len == 32);
58431         memcpy(val_ref.data, val->elems, 32); FREE(val);
58432         BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
58433 }
58434
58435 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_new"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
58436         LDKTransaction transaction_arg_ref;
58437         transaction_arg_ref.datalen = transaction_arg->arr_len;
58438         transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
58439         memcpy(transaction_arg_ref.data, transaction_arg->elems, transaction_arg_ref.datalen); FREE(transaction_arg);
58440         transaction_arg_ref.data_is_owned = true;
58441         LDKThirtyTwoBytes txid_arg_ref;
58442         CHECK(txid_arg->arr_len == 32);
58443         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
58444         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
58445         uint64_t ret_ref = 0;
58446         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58447         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58448         return ret_ref;
58449 }
58450
58451 static inline uint64_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
58452         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
58453         uint64_t ret_ref = 0;
58454         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58455         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58456         return ret_ref;
58457 }
58458 int64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_clone_ptr"))) TS_BuiltCommitmentTransaction_clone_ptr(uint64_t arg) {
58459         LDKBuiltCommitmentTransaction arg_conv;
58460         arg_conv.inner = untag_ptr(arg);
58461         arg_conv.is_owned = ptr_is_owned(arg);
58462         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58463         arg_conv.is_owned = false;
58464         int64_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
58465         return ret_conv;
58466 }
58467
58468 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_clone"))) TS_BuiltCommitmentTransaction_clone(uint64_t orig) {
58469         LDKBuiltCommitmentTransaction orig_conv;
58470         orig_conv.inner = untag_ptr(orig);
58471         orig_conv.is_owned = ptr_is_owned(orig);
58472         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58473         orig_conv.is_owned = false;
58474         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
58475         uint64_t ret_ref = 0;
58476         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58477         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58478         return ret_ref;
58479 }
58480
58481 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_write"))) TS_BuiltCommitmentTransaction_write(uint64_t obj) {
58482         LDKBuiltCommitmentTransaction obj_conv;
58483         obj_conv.inner = untag_ptr(obj);
58484         obj_conv.is_owned = ptr_is_owned(obj);
58485         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58486         obj_conv.is_owned = false;
58487         LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
58488         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58489         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58490         CVec_u8Z_free(ret_var);
58491         return ret_arr;
58492 }
58493
58494 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_read"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
58495         LDKu8slice ser_ref;
58496         ser_ref.datalen = ser->arr_len;
58497         ser_ref.data = ser->elems;
58498         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
58499         *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
58500         FREE(ser);
58501         return tag_ptr(ret_conv, true);
58502 }
58503
58504 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) {
58505         LDKBuiltCommitmentTransaction this_arg_conv;
58506         this_arg_conv.inner = untag_ptr(this_arg);
58507         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58509         this_arg_conv.is_owned = false;
58510         LDKu8slice funding_redeemscript_ref;
58511         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
58512         funding_redeemscript_ref.data = funding_redeemscript->elems;
58513         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
58514         memcpy(ret_arr->elems, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
58515         FREE(funding_redeemscript);
58516         return ret_arr;
58517 }
58518
58519 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) {
58520         LDKBuiltCommitmentTransaction this_arg_conv;
58521         this_arg_conv.inner = untag_ptr(this_arg);
58522         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58524         this_arg_conv.is_owned = false;
58525         uint8_t funding_key_arr[32];
58526         CHECK(funding_key->arr_len == 32);
58527         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
58528         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
58529         LDKu8slice funding_redeemscript_ref;
58530         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
58531         funding_redeemscript_ref.data = funding_redeemscript->elems;
58532         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
58533         memcpy(ret_arr->elems, BuiltCommitmentTransaction_sign_counterparty_commitment(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
58534         FREE(funding_redeemscript);
58535         return ret_arr;
58536 }
58537
58538 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) {
58539         LDKBuiltCommitmentTransaction this_arg_conv;
58540         this_arg_conv.inner = untag_ptr(this_arg);
58541         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58543         this_arg_conv.is_owned = false;
58544         uint8_t funding_key_arr[32];
58545         CHECK(funding_key->arr_len == 32);
58546         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
58547         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
58548         LDKu8slice funding_redeemscript_ref;
58549         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
58550         funding_redeemscript_ref.data = funding_redeemscript->elems;
58551         void* entropy_source_ptr = untag_ptr(entropy_source);
58552         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
58553         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
58554         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
58555         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);
58556         FREE(funding_redeemscript);
58557         return ret_arr;
58558 }
58559
58560 void  __attribute__((export_name("TS_ClosingTransaction_free"))) TS_ClosingTransaction_free(uint64_t this_obj) {
58561         LDKClosingTransaction this_obj_conv;
58562         this_obj_conv.inner = untag_ptr(this_obj);
58563         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58565         ClosingTransaction_free(this_obj_conv);
58566 }
58567
58568 static inline uint64_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
58569         LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
58570         uint64_t ret_ref = 0;
58571         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58572         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58573         return ret_ref;
58574 }
58575 int64_t  __attribute__((export_name("TS_ClosingTransaction_clone_ptr"))) TS_ClosingTransaction_clone_ptr(uint64_t arg) {
58576         LDKClosingTransaction arg_conv;
58577         arg_conv.inner = untag_ptr(arg);
58578         arg_conv.is_owned = ptr_is_owned(arg);
58579         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58580         arg_conv.is_owned = false;
58581         int64_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
58582         return ret_conv;
58583 }
58584
58585 uint64_t  __attribute__((export_name("TS_ClosingTransaction_clone"))) TS_ClosingTransaction_clone(uint64_t orig) {
58586         LDKClosingTransaction orig_conv;
58587         orig_conv.inner = untag_ptr(orig);
58588         orig_conv.is_owned = ptr_is_owned(orig);
58589         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58590         orig_conv.is_owned = false;
58591         LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
58592         uint64_t ret_ref = 0;
58593         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58594         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58595         return ret_ref;
58596 }
58597
58598 int64_t  __attribute__((export_name("TS_ClosingTransaction_hash"))) TS_ClosingTransaction_hash(uint64_t o) {
58599         LDKClosingTransaction o_conv;
58600         o_conv.inner = untag_ptr(o);
58601         o_conv.is_owned = ptr_is_owned(o);
58602         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
58603         o_conv.is_owned = false;
58604         int64_t ret_conv = ClosingTransaction_hash(&o_conv);
58605         return ret_conv;
58606 }
58607
58608 jboolean  __attribute__((export_name("TS_ClosingTransaction_eq"))) TS_ClosingTransaction_eq(uint64_t a, uint64_t b) {
58609         LDKClosingTransaction a_conv;
58610         a_conv.inner = untag_ptr(a);
58611         a_conv.is_owned = ptr_is_owned(a);
58612         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58613         a_conv.is_owned = false;
58614         LDKClosingTransaction b_conv;
58615         b_conv.inner = untag_ptr(b);
58616         b_conv.is_owned = ptr_is_owned(b);
58617         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58618         b_conv.is_owned = false;
58619         jboolean ret_conv = ClosingTransaction_eq(&a_conv, &b_conv);
58620         return ret_conv;
58621 }
58622
58623 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) {
58624         LDKCVec_u8Z to_holder_script_ref;
58625         to_holder_script_ref.datalen = to_holder_script->arr_len;
58626         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
58627         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
58628         LDKCVec_u8Z to_counterparty_script_ref;
58629         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
58630         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
58631         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
58632         LDKOutPoint funding_outpoint_conv;
58633         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
58634         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
58635         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
58636         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
58637         LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
58638         uint64_t ret_ref = 0;
58639         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58640         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58641         return ret_ref;
58642 }
58643
58644 uint64_t  __attribute__((export_name("TS_ClosingTransaction_trust"))) TS_ClosingTransaction_trust(uint64_t this_arg) {
58645         LDKClosingTransaction this_arg_conv;
58646         this_arg_conv.inner = untag_ptr(this_arg);
58647         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58649         this_arg_conv.is_owned = false;
58650         LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
58651         uint64_t ret_ref = 0;
58652         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58653         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58654         return ret_ref;
58655 }
58656
58657 uint64_t  __attribute__((export_name("TS_ClosingTransaction_verify"))) TS_ClosingTransaction_verify(uint64_t this_arg, uint64_t funding_outpoint) {
58658         LDKClosingTransaction this_arg_conv;
58659         this_arg_conv.inner = untag_ptr(this_arg);
58660         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58662         this_arg_conv.is_owned = false;
58663         LDKOutPoint funding_outpoint_conv;
58664         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
58665         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
58666         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
58667         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
58668         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
58669         *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
58670         return tag_ptr(ret_conv, true);
58671 }
58672
58673 int64_t  __attribute__((export_name("TS_ClosingTransaction_to_holder_value_sat"))) TS_ClosingTransaction_to_holder_value_sat(uint64_t this_arg) {
58674         LDKClosingTransaction this_arg_conv;
58675         this_arg_conv.inner = untag_ptr(this_arg);
58676         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58678         this_arg_conv.is_owned = false;
58679         int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
58680         return ret_conv;
58681 }
58682
58683 int64_t  __attribute__((export_name("TS_ClosingTransaction_to_counterparty_value_sat"))) TS_ClosingTransaction_to_counterparty_value_sat(uint64_t this_arg) {
58684         LDKClosingTransaction this_arg_conv;
58685         this_arg_conv.inner = untag_ptr(this_arg);
58686         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58688         this_arg_conv.is_owned = false;
58689         int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
58690         return ret_conv;
58691 }
58692
58693 int8_tArray  __attribute__((export_name("TS_ClosingTransaction_to_holder_script"))) TS_ClosingTransaction_to_holder_script(uint64_t this_arg) {
58694         LDKClosingTransaction this_arg_conv;
58695         this_arg_conv.inner = untag_ptr(this_arg);
58696         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58698         this_arg_conv.is_owned = false;
58699         LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
58700         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58701         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58702         return ret_arr;
58703 }
58704
58705 int8_tArray  __attribute__((export_name("TS_ClosingTransaction_to_counterparty_script"))) TS_ClosingTransaction_to_counterparty_script(uint64_t this_arg) {
58706         LDKClosingTransaction this_arg_conv;
58707         this_arg_conv.inner = untag_ptr(this_arg);
58708         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58710         this_arg_conv.is_owned = false;
58711         LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
58712         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58713         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58714         return ret_arr;
58715 }
58716
58717 void  __attribute__((export_name("TS_TrustedClosingTransaction_free"))) TS_TrustedClosingTransaction_free(uint64_t this_obj) {
58718         LDKTrustedClosingTransaction this_obj_conv;
58719         this_obj_conv.inner = untag_ptr(this_obj);
58720         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58722         TrustedClosingTransaction_free(this_obj_conv);
58723 }
58724
58725 int8_tArray  __attribute__((export_name("TS_TrustedClosingTransaction_built_transaction"))) TS_TrustedClosingTransaction_built_transaction(uint64_t this_arg) {
58726         LDKTrustedClosingTransaction this_arg_conv;
58727         this_arg_conv.inner = untag_ptr(this_arg);
58728         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58730         this_arg_conv.is_owned = false;
58731         LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
58732         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58733         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58734         Transaction_free(ret_var);
58735         return ret_arr;
58736 }
58737
58738 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) {
58739         LDKTrustedClosingTransaction this_arg_conv;
58740         this_arg_conv.inner = untag_ptr(this_arg);
58741         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58743         this_arg_conv.is_owned = false;
58744         LDKu8slice funding_redeemscript_ref;
58745         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
58746         funding_redeemscript_ref.data = funding_redeemscript->elems;
58747         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
58748         memcpy(ret_arr->elems, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
58749         FREE(funding_redeemscript);
58750         return ret_arr;
58751 }
58752
58753 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) {
58754         LDKTrustedClosingTransaction this_arg_conv;
58755         this_arg_conv.inner = untag_ptr(this_arg);
58756         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58758         this_arg_conv.is_owned = false;
58759         uint8_t funding_key_arr[32];
58760         CHECK(funding_key->arr_len == 32);
58761         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
58762         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
58763         LDKu8slice funding_redeemscript_ref;
58764         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
58765         funding_redeemscript_ref.data = funding_redeemscript->elems;
58766         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
58767         memcpy(ret_arr->elems, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
58768         FREE(funding_redeemscript);
58769         return ret_arr;
58770 }
58771
58772 void  __attribute__((export_name("TS_CommitmentTransaction_free"))) TS_CommitmentTransaction_free(uint64_t this_obj) {
58773         LDKCommitmentTransaction this_obj_conv;
58774         this_obj_conv.inner = untag_ptr(this_obj);
58775         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58777         CommitmentTransaction_free(this_obj_conv);
58778 }
58779
58780 static inline uint64_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
58781         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
58782         uint64_t ret_ref = 0;
58783         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58784         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58785         return ret_ref;
58786 }
58787 int64_t  __attribute__((export_name("TS_CommitmentTransaction_clone_ptr"))) TS_CommitmentTransaction_clone_ptr(uint64_t arg) {
58788         LDKCommitmentTransaction arg_conv;
58789         arg_conv.inner = untag_ptr(arg);
58790         arg_conv.is_owned = ptr_is_owned(arg);
58791         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58792         arg_conv.is_owned = false;
58793         int64_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
58794         return ret_conv;
58795 }
58796
58797 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_clone"))) TS_CommitmentTransaction_clone(uint64_t orig) {
58798         LDKCommitmentTransaction orig_conv;
58799         orig_conv.inner = untag_ptr(orig);
58800         orig_conv.is_owned = ptr_is_owned(orig);
58801         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58802         orig_conv.is_owned = false;
58803         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
58804         uint64_t ret_ref = 0;
58805         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58806         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58807         return ret_ref;
58808 }
58809
58810 int8_tArray  __attribute__((export_name("TS_CommitmentTransaction_write"))) TS_CommitmentTransaction_write(uint64_t obj) {
58811         LDKCommitmentTransaction obj_conv;
58812         obj_conv.inner = untag_ptr(obj);
58813         obj_conv.is_owned = ptr_is_owned(obj);
58814         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58815         obj_conv.is_owned = false;
58816         LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
58817         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58818         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58819         CVec_u8Z_free(ret_var);
58820         return ret_arr;
58821 }
58822
58823 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_read"))) TS_CommitmentTransaction_read(int8_tArray ser) {
58824         LDKu8slice ser_ref;
58825         ser_ref.datalen = ser->arr_len;
58826         ser_ref.data = ser->elems;
58827         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
58828         *ret_conv = CommitmentTransaction_read(ser_ref);
58829         FREE(ser);
58830         return tag_ptr(ret_conv, true);
58831 }
58832
58833 int64_t  __attribute__((export_name("TS_CommitmentTransaction_commitment_number"))) TS_CommitmentTransaction_commitment_number(uint64_t this_arg) {
58834         LDKCommitmentTransaction this_arg_conv;
58835         this_arg_conv.inner = untag_ptr(this_arg);
58836         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58838         this_arg_conv.is_owned = false;
58839         int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
58840         return ret_conv;
58841 }
58842
58843 int8_tArray  __attribute__((export_name("TS_CommitmentTransaction_per_commitment_point"))) TS_CommitmentTransaction_per_commitment_point(uint64_t this_arg) {
58844         LDKCommitmentTransaction this_arg_conv;
58845         this_arg_conv.inner = untag_ptr(this_arg);
58846         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58848         this_arg_conv.is_owned = false;
58849         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
58850         memcpy(ret_arr->elems, CommitmentTransaction_per_commitment_point(&this_arg_conv).compressed_form, 33);
58851         return ret_arr;
58852 }
58853
58854 int64_t  __attribute__((export_name("TS_CommitmentTransaction_to_broadcaster_value_sat"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint64_t this_arg) {
58855         LDKCommitmentTransaction this_arg_conv;
58856         this_arg_conv.inner = untag_ptr(this_arg);
58857         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58859         this_arg_conv.is_owned = false;
58860         int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
58861         return ret_conv;
58862 }
58863
58864 int64_t  __attribute__((export_name("TS_CommitmentTransaction_to_countersignatory_value_sat"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint64_t this_arg) {
58865         LDKCommitmentTransaction this_arg_conv;
58866         this_arg_conv.inner = untag_ptr(this_arg);
58867         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58869         this_arg_conv.is_owned = false;
58870         int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
58871         return ret_conv;
58872 }
58873
58874 int32_t  __attribute__((export_name("TS_CommitmentTransaction_feerate_per_kw"))) TS_CommitmentTransaction_feerate_per_kw(uint64_t this_arg) {
58875         LDKCommitmentTransaction this_arg_conv;
58876         this_arg_conv.inner = untag_ptr(this_arg);
58877         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58879         this_arg_conv.is_owned = false;
58880         int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
58881         return ret_conv;
58882 }
58883
58884 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_trust"))) TS_CommitmentTransaction_trust(uint64_t this_arg) {
58885         LDKCommitmentTransaction this_arg_conv;
58886         this_arg_conv.inner = untag_ptr(this_arg);
58887         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58889         this_arg_conv.is_owned = false;
58890         LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
58891         uint64_t ret_ref = 0;
58892         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58893         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58894         return ret_ref;
58895 }
58896
58897 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) {
58898         LDKCommitmentTransaction this_arg_conv;
58899         this_arg_conv.inner = untag_ptr(this_arg);
58900         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58902         this_arg_conv.is_owned = false;
58903         LDKDirectedChannelTransactionParameters channel_parameters_conv;
58904         channel_parameters_conv.inner = untag_ptr(channel_parameters);
58905         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
58906         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
58907         channel_parameters_conv.is_owned = false;
58908         LDKChannelPublicKeys broadcaster_keys_conv;
58909         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
58910         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
58911         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
58912         broadcaster_keys_conv.is_owned = false;
58913         LDKChannelPublicKeys countersignatory_keys_conv;
58914         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
58915         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
58916         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
58917         countersignatory_keys_conv.is_owned = false;
58918         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
58919         *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
58920         return tag_ptr(ret_conv, true);
58921 }
58922
58923 void  __attribute__((export_name("TS_TrustedCommitmentTransaction_free"))) TS_TrustedCommitmentTransaction_free(uint64_t this_obj) {
58924         LDKTrustedCommitmentTransaction this_obj_conv;
58925         this_obj_conv.inner = untag_ptr(this_obj);
58926         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58928         TrustedCommitmentTransaction_free(this_obj_conv);
58929 }
58930
58931 int8_tArray  __attribute__((export_name("TS_TrustedCommitmentTransaction_txid"))) TS_TrustedCommitmentTransaction_txid(uint64_t this_arg) {
58932         LDKTrustedCommitmentTransaction this_arg_conv;
58933         this_arg_conv.inner = untag_ptr(this_arg);
58934         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58936         this_arg_conv.is_owned = false;
58937         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
58938         memcpy(ret_arr->elems, TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
58939         return ret_arr;
58940 }
58941
58942 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_built_transaction"))) TS_TrustedCommitmentTransaction_built_transaction(uint64_t this_arg) {
58943         LDKTrustedCommitmentTransaction this_arg_conv;
58944         this_arg_conv.inner = untag_ptr(this_arg);
58945         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58947         this_arg_conv.is_owned = false;
58948         LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
58949         uint64_t ret_ref = 0;
58950         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58951         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58952         return ret_ref;
58953 }
58954
58955 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_keys"))) TS_TrustedCommitmentTransaction_keys(uint64_t this_arg) {
58956         LDKTrustedCommitmentTransaction this_arg_conv;
58957         this_arg_conv.inner = untag_ptr(this_arg);
58958         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58960         this_arg_conv.is_owned = false;
58961         LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
58962         uint64_t ret_ref = 0;
58963         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58964         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58965         return ret_ref;
58966 }
58967
58968 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_channel_type_features"))) TS_TrustedCommitmentTransaction_channel_type_features(uint64_t this_arg) {
58969         LDKTrustedCommitmentTransaction this_arg_conv;
58970         this_arg_conv.inner = untag_ptr(this_arg);
58971         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58973         this_arg_conv.is_owned = false;
58974         LDKChannelTypeFeatures ret_var = TrustedCommitmentTransaction_channel_type_features(&this_arg_conv);
58975         uint64_t ret_ref = 0;
58976         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58977         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58978         return ret_ref;
58979 }
58980
58981 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) {
58982         LDKTrustedCommitmentTransaction this_arg_conv;
58983         this_arg_conv.inner = untag_ptr(this_arg);
58984         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58986         this_arg_conv.is_owned = false;
58987         uint8_t htlc_base_key_arr[32];
58988         CHECK(htlc_base_key->arr_len == 32);
58989         memcpy(htlc_base_key_arr, htlc_base_key->elems, 32); FREE(htlc_base_key);
58990         uint8_t (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
58991         LDKDirectedChannelTransactionParameters channel_parameters_conv;
58992         channel_parameters_conv.inner = untag_ptr(channel_parameters);
58993         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
58994         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
58995         channel_parameters_conv.is_owned = false;
58996         void* entropy_source_ptr = untag_ptr(entropy_source);
58997         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
58998         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
58999         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
59000         *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv, entropy_source_conv);
59001         return tag_ptr(ret_conv, true);
59002 }
59003
59004 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_revokeable_output_index"))) TS_TrustedCommitmentTransaction_revokeable_output_index(uint64_t this_arg) {
59005         LDKTrustedCommitmentTransaction this_arg_conv;
59006         this_arg_conv.inner = untag_ptr(this_arg);
59007         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59009         this_arg_conv.is_owned = false;
59010         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
59011         *ret_copy = TrustedCommitmentTransaction_revokeable_output_index(&this_arg_conv);
59012         uint64_t ret_ref = tag_ptr(ret_copy, true);
59013         return ret_ref;
59014 }
59015
59016 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) {
59017         LDKTrustedCommitmentTransaction this_arg_conv;
59018         this_arg_conv.inner = untag_ptr(this_arg);
59019         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59021         this_arg_conv.is_owned = false;
59022         LDKCVec_u8Z destination_script_ref;
59023         destination_script_ref.datalen = destination_script->arr_len;
59024         destination_script_ref.data = MALLOC(destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
59025         memcpy(destination_script_ref.data, destination_script->elems, destination_script_ref.datalen); FREE(destination_script);
59026         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
59027         *ret_conv = TrustedCommitmentTransaction_build_to_local_justice_tx(&this_arg_conv, feerate_per_kw, destination_script_ref);
59028         return tag_ptr(ret_conv, true);
59029 }
59030
59031 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) {
59032         LDKPublicKey broadcaster_payment_basepoint_ref;
59033         CHECK(broadcaster_payment_basepoint->arr_len == 33);
59034         memcpy(broadcaster_payment_basepoint_ref.compressed_form, broadcaster_payment_basepoint->elems, 33); FREE(broadcaster_payment_basepoint);
59035         LDKPublicKey countersignatory_payment_basepoint_ref;
59036         CHECK(countersignatory_payment_basepoint->arr_len == 33);
59037         memcpy(countersignatory_payment_basepoint_ref.compressed_form, countersignatory_payment_basepoint->elems, 33); FREE(countersignatory_payment_basepoint);
59038         int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
59039         return ret_conv;
59040 }
59041
59042 jboolean  __attribute__((export_name("TS_InitFeatures_eq"))) TS_InitFeatures_eq(uint64_t a, uint64_t b) {
59043         LDKInitFeatures a_conv;
59044         a_conv.inner = untag_ptr(a);
59045         a_conv.is_owned = ptr_is_owned(a);
59046         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59047         a_conv.is_owned = false;
59048         LDKInitFeatures b_conv;
59049         b_conv.inner = untag_ptr(b);
59050         b_conv.is_owned = ptr_is_owned(b);
59051         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59052         b_conv.is_owned = false;
59053         jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
59054         return ret_conv;
59055 }
59056
59057 jboolean  __attribute__((export_name("TS_NodeFeatures_eq"))) TS_NodeFeatures_eq(uint64_t a, uint64_t b) {
59058         LDKNodeFeatures a_conv;
59059         a_conv.inner = untag_ptr(a);
59060         a_conv.is_owned = ptr_is_owned(a);
59061         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59062         a_conv.is_owned = false;
59063         LDKNodeFeatures b_conv;
59064         b_conv.inner = untag_ptr(b);
59065         b_conv.is_owned = ptr_is_owned(b);
59066         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59067         b_conv.is_owned = false;
59068         jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
59069         return ret_conv;
59070 }
59071
59072 jboolean  __attribute__((export_name("TS_ChannelFeatures_eq"))) TS_ChannelFeatures_eq(uint64_t a, uint64_t b) {
59073         LDKChannelFeatures a_conv;
59074         a_conv.inner = untag_ptr(a);
59075         a_conv.is_owned = ptr_is_owned(a);
59076         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59077         a_conv.is_owned = false;
59078         LDKChannelFeatures b_conv;
59079         b_conv.inner = untag_ptr(b);
59080         b_conv.is_owned = ptr_is_owned(b);
59081         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59082         b_conv.is_owned = false;
59083         jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
59084         return ret_conv;
59085 }
59086
59087 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_eq"))) TS_Bolt11InvoiceFeatures_eq(uint64_t a, uint64_t b) {
59088         LDKBolt11InvoiceFeatures a_conv;
59089         a_conv.inner = untag_ptr(a);
59090         a_conv.is_owned = ptr_is_owned(a);
59091         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59092         a_conv.is_owned = false;
59093         LDKBolt11InvoiceFeatures b_conv;
59094         b_conv.inner = untag_ptr(b);
59095         b_conv.is_owned = ptr_is_owned(b);
59096         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59097         b_conv.is_owned = false;
59098         jboolean ret_conv = Bolt11InvoiceFeatures_eq(&a_conv, &b_conv);
59099         return ret_conv;
59100 }
59101
59102 jboolean  __attribute__((export_name("TS_OfferFeatures_eq"))) TS_OfferFeatures_eq(uint64_t a, uint64_t b) {
59103         LDKOfferFeatures a_conv;
59104         a_conv.inner = untag_ptr(a);
59105         a_conv.is_owned = ptr_is_owned(a);
59106         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59107         a_conv.is_owned = false;
59108         LDKOfferFeatures b_conv;
59109         b_conv.inner = untag_ptr(b);
59110         b_conv.is_owned = ptr_is_owned(b);
59111         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59112         b_conv.is_owned = false;
59113         jboolean ret_conv = OfferFeatures_eq(&a_conv, &b_conv);
59114         return ret_conv;
59115 }
59116
59117 jboolean  __attribute__((export_name("TS_InvoiceRequestFeatures_eq"))) TS_InvoiceRequestFeatures_eq(uint64_t a, uint64_t b) {
59118         LDKInvoiceRequestFeatures a_conv;
59119         a_conv.inner = untag_ptr(a);
59120         a_conv.is_owned = ptr_is_owned(a);
59121         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59122         a_conv.is_owned = false;
59123         LDKInvoiceRequestFeatures b_conv;
59124         b_conv.inner = untag_ptr(b);
59125         b_conv.is_owned = ptr_is_owned(b);
59126         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59127         b_conv.is_owned = false;
59128         jboolean ret_conv = InvoiceRequestFeatures_eq(&a_conv, &b_conv);
59129         return ret_conv;
59130 }
59131
59132 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_eq"))) TS_Bolt12InvoiceFeatures_eq(uint64_t a, uint64_t b) {
59133         LDKBolt12InvoiceFeatures a_conv;
59134         a_conv.inner = untag_ptr(a);
59135         a_conv.is_owned = ptr_is_owned(a);
59136         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59137         a_conv.is_owned = false;
59138         LDKBolt12InvoiceFeatures b_conv;
59139         b_conv.inner = untag_ptr(b);
59140         b_conv.is_owned = ptr_is_owned(b);
59141         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59142         b_conv.is_owned = false;
59143         jboolean ret_conv = Bolt12InvoiceFeatures_eq(&a_conv, &b_conv);
59144         return ret_conv;
59145 }
59146
59147 jboolean  __attribute__((export_name("TS_BlindedHopFeatures_eq"))) TS_BlindedHopFeatures_eq(uint64_t a, uint64_t b) {
59148         LDKBlindedHopFeatures a_conv;
59149         a_conv.inner = untag_ptr(a);
59150         a_conv.is_owned = ptr_is_owned(a);
59151         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59152         a_conv.is_owned = false;
59153         LDKBlindedHopFeatures b_conv;
59154         b_conv.inner = untag_ptr(b);
59155         b_conv.is_owned = ptr_is_owned(b);
59156         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59157         b_conv.is_owned = false;
59158         jboolean ret_conv = BlindedHopFeatures_eq(&a_conv, &b_conv);
59159         return ret_conv;
59160 }
59161
59162 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_eq"))) TS_ChannelTypeFeatures_eq(uint64_t a, uint64_t b) {
59163         LDKChannelTypeFeatures a_conv;
59164         a_conv.inner = untag_ptr(a);
59165         a_conv.is_owned = ptr_is_owned(a);
59166         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59167         a_conv.is_owned = false;
59168         LDKChannelTypeFeatures b_conv;
59169         b_conv.inner = untag_ptr(b);
59170         b_conv.is_owned = ptr_is_owned(b);
59171         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59172         b_conv.is_owned = false;
59173         jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
59174         return ret_conv;
59175 }
59176
59177 static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
59178         LDKInitFeatures ret_var = InitFeatures_clone(arg);
59179         uint64_t ret_ref = 0;
59180         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59181         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59182         return ret_ref;
59183 }
59184 int64_t  __attribute__((export_name("TS_InitFeatures_clone_ptr"))) TS_InitFeatures_clone_ptr(uint64_t arg) {
59185         LDKInitFeatures arg_conv;
59186         arg_conv.inner = untag_ptr(arg);
59187         arg_conv.is_owned = ptr_is_owned(arg);
59188         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59189         arg_conv.is_owned = false;
59190         int64_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
59191         return ret_conv;
59192 }
59193
59194 uint64_t  __attribute__((export_name("TS_InitFeatures_clone"))) TS_InitFeatures_clone(uint64_t orig) {
59195         LDKInitFeatures orig_conv;
59196         orig_conv.inner = untag_ptr(orig);
59197         orig_conv.is_owned = ptr_is_owned(orig);
59198         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59199         orig_conv.is_owned = false;
59200         LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
59201         uint64_t ret_ref = 0;
59202         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59203         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59204         return ret_ref;
59205 }
59206
59207 static inline uint64_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
59208         LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
59209         uint64_t ret_ref = 0;
59210         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59211         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59212         return ret_ref;
59213 }
59214 int64_t  __attribute__((export_name("TS_NodeFeatures_clone_ptr"))) TS_NodeFeatures_clone_ptr(uint64_t arg) {
59215         LDKNodeFeatures arg_conv;
59216         arg_conv.inner = untag_ptr(arg);
59217         arg_conv.is_owned = ptr_is_owned(arg);
59218         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59219         arg_conv.is_owned = false;
59220         int64_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
59221         return ret_conv;
59222 }
59223
59224 uint64_t  __attribute__((export_name("TS_NodeFeatures_clone"))) TS_NodeFeatures_clone(uint64_t orig) {
59225         LDKNodeFeatures orig_conv;
59226         orig_conv.inner = untag_ptr(orig);
59227         orig_conv.is_owned = ptr_is_owned(orig);
59228         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59229         orig_conv.is_owned = false;
59230         LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
59231         uint64_t ret_ref = 0;
59232         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59233         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59234         return ret_ref;
59235 }
59236
59237 static inline uint64_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
59238         LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
59239         uint64_t ret_ref = 0;
59240         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59241         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59242         return ret_ref;
59243 }
59244 int64_t  __attribute__((export_name("TS_ChannelFeatures_clone_ptr"))) TS_ChannelFeatures_clone_ptr(uint64_t arg) {
59245         LDKChannelFeatures arg_conv;
59246         arg_conv.inner = untag_ptr(arg);
59247         arg_conv.is_owned = ptr_is_owned(arg);
59248         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59249         arg_conv.is_owned = false;
59250         int64_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
59251         return ret_conv;
59252 }
59253
59254 uint64_t  __attribute__((export_name("TS_ChannelFeatures_clone"))) TS_ChannelFeatures_clone(uint64_t orig) {
59255         LDKChannelFeatures orig_conv;
59256         orig_conv.inner = untag_ptr(orig);
59257         orig_conv.is_owned = ptr_is_owned(orig);
59258         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59259         orig_conv.is_owned = false;
59260         LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
59261         uint64_t ret_ref = 0;
59262         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59263         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59264         return ret_ref;
59265 }
59266
59267 static inline uint64_t Bolt11InvoiceFeatures_clone_ptr(LDKBolt11InvoiceFeatures *NONNULL_PTR arg) {
59268         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_clone(arg);
59269         uint64_t ret_ref = 0;
59270         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59271         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59272         return ret_ref;
59273 }
59274 int64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_clone_ptr"))) TS_Bolt11InvoiceFeatures_clone_ptr(uint64_t arg) {
59275         LDKBolt11InvoiceFeatures arg_conv;
59276         arg_conv.inner = untag_ptr(arg);
59277         arg_conv.is_owned = ptr_is_owned(arg);
59278         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59279         arg_conv.is_owned = false;
59280         int64_t ret_conv = Bolt11InvoiceFeatures_clone_ptr(&arg_conv);
59281         return ret_conv;
59282 }
59283
59284 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_clone"))) TS_Bolt11InvoiceFeatures_clone(uint64_t orig) {
59285         LDKBolt11InvoiceFeatures orig_conv;
59286         orig_conv.inner = untag_ptr(orig);
59287         orig_conv.is_owned = ptr_is_owned(orig);
59288         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59289         orig_conv.is_owned = false;
59290         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_clone(&orig_conv);
59291         uint64_t ret_ref = 0;
59292         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59293         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59294         return ret_ref;
59295 }
59296
59297 static inline uint64_t OfferFeatures_clone_ptr(LDKOfferFeatures *NONNULL_PTR arg) {
59298         LDKOfferFeatures ret_var = OfferFeatures_clone(arg);
59299         uint64_t ret_ref = 0;
59300         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59301         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59302         return ret_ref;
59303 }
59304 int64_t  __attribute__((export_name("TS_OfferFeatures_clone_ptr"))) TS_OfferFeatures_clone_ptr(uint64_t arg) {
59305         LDKOfferFeatures arg_conv;
59306         arg_conv.inner = untag_ptr(arg);
59307         arg_conv.is_owned = ptr_is_owned(arg);
59308         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59309         arg_conv.is_owned = false;
59310         int64_t ret_conv = OfferFeatures_clone_ptr(&arg_conv);
59311         return ret_conv;
59312 }
59313
59314 uint64_t  __attribute__((export_name("TS_OfferFeatures_clone"))) TS_OfferFeatures_clone(uint64_t orig) {
59315         LDKOfferFeatures orig_conv;
59316         orig_conv.inner = untag_ptr(orig);
59317         orig_conv.is_owned = ptr_is_owned(orig);
59318         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59319         orig_conv.is_owned = false;
59320         LDKOfferFeatures ret_var = OfferFeatures_clone(&orig_conv);
59321         uint64_t ret_ref = 0;
59322         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59323         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59324         return ret_ref;
59325 }
59326
59327 static inline uint64_t InvoiceRequestFeatures_clone_ptr(LDKInvoiceRequestFeatures *NONNULL_PTR arg) {
59328         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(arg);
59329         uint64_t ret_ref = 0;
59330         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59331         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59332         return ret_ref;
59333 }
59334 int64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_clone_ptr"))) TS_InvoiceRequestFeatures_clone_ptr(uint64_t arg) {
59335         LDKInvoiceRequestFeatures arg_conv;
59336         arg_conv.inner = untag_ptr(arg);
59337         arg_conv.is_owned = ptr_is_owned(arg);
59338         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59339         arg_conv.is_owned = false;
59340         int64_t ret_conv = InvoiceRequestFeatures_clone_ptr(&arg_conv);
59341         return ret_conv;
59342 }
59343
59344 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_clone"))) TS_InvoiceRequestFeatures_clone(uint64_t orig) {
59345         LDKInvoiceRequestFeatures orig_conv;
59346         orig_conv.inner = untag_ptr(orig);
59347         orig_conv.is_owned = ptr_is_owned(orig);
59348         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59349         orig_conv.is_owned = false;
59350         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(&orig_conv);
59351         uint64_t ret_ref = 0;
59352         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59353         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59354         return ret_ref;
59355 }
59356
59357 static inline uint64_t Bolt12InvoiceFeatures_clone_ptr(LDKBolt12InvoiceFeatures *NONNULL_PTR arg) {
59358         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(arg);
59359         uint64_t ret_ref = 0;
59360         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59361         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59362         return ret_ref;
59363 }
59364 int64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_clone_ptr"))) TS_Bolt12InvoiceFeatures_clone_ptr(uint64_t arg) {
59365         LDKBolt12InvoiceFeatures arg_conv;
59366         arg_conv.inner = untag_ptr(arg);
59367         arg_conv.is_owned = ptr_is_owned(arg);
59368         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59369         arg_conv.is_owned = false;
59370         int64_t ret_conv = Bolt12InvoiceFeatures_clone_ptr(&arg_conv);
59371         return ret_conv;
59372 }
59373
59374 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_clone"))) TS_Bolt12InvoiceFeatures_clone(uint64_t orig) {
59375         LDKBolt12InvoiceFeatures orig_conv;
59376         orig_conv.inner = untag_ptr(orig);
59377         orig_conv.is_owned = ptr_is_owned(orig);
59378         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59379         orig_conv.is_owned = false;
59380         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(&orig_conv);
59381         uint64_t ret_ref = 0;
59382         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59383         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59384         return ret_ref;
59385 }
59386
59387 static inline uint64_t BlindedHopFeatures_clone_ptr(LDKBlindedHopFeatures *NONNULL_PTR arg) {
59388         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(arg);
59389         uint64_t ret_ref = 0;
59390         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59391         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59392         return ret_ref;
59393 }
59394 int64_t  __attribute__((export_name("TS_BlindedHopFeatures_clone_ptr"))) TS_BlindedHopFeatures_clone_ptr(uint64_t arg) {
59395         LDKBlindedHopFeatures arg_conv;
59396         arg_conv.inner = untag_ptr(arg);
59397         arg_conv.is_owned = ptr_is_owned(arg);
59398         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59399         arg_conv.is_owned = false;
59400         int64_t ret_conv = BlindedHopFeatures_clone_ptr(&arg_conv);
59401         return ret_conv;
59402 }
59403
59404 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_clone"))) TS_BlindedHopFeatures_clone(uint64_t orig) {
59405         LDKBlindedHopFeatures orig_conv;
59406         orig_conv.inner = untag_ptr(orig);
59407         orig_conv.is_owned = ptr_is_owned(orig);
59408         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59409         orig_conv.is_owned = false;
59410         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(&orig_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 static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
59418         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
59419         uint64_t ret_ref = 0;
59420         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59421         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59422         return ret_ref;
59423 }
59424 int64_t  __attribute__((export_name("TS_ChannelTypeFeatures_clone_ptr"))) TS_ChannelTypeFeatures_clone_ptr(uint64_t arg) {
59425         LDKChannelTypeFeatures arg_conv;
59426         arg_conv.inner = untag_ptr(arg);
59427         arg_conv.is_owned = ptr_is_owned(arg);
59428         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59429         arg_conv.is_owned = false;
59430         int64_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
59431         return ret_conv;
59432 }
59433
59434 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_clone"))) TS_ChannelTypeFeatures_clone(uint64_t orig) {
59435         LDKChannelTypeFeatures orig_conv;
59436         orig_conv.inner = untag_ptr(orig);
59437         orig_conv.is_owned = ptr_is_owned(orig);
59438         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59439         orig_conv.is_owned = false;
59440         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
59441         uint64_t ret_ref = 0;
59442         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59443         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59444         return ret_ref;
59445 }
59446
59447 int64_t  __attribute__((export_name("TS_InitFeatures_hash"))) TS_InitFeatures_hash(uint64_t o) {
59448         LDKInitFeatures o_conv;
59449         o_conv.inner = untag_ptr(o);
59450         o_conv.is_owned = ptr_is_owned(o);
59451         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59452         o_conv.is_owned = false;
59453         int64_t ret_conv = InitFeatures_hash(&o_conv);
59454         return ret_conv;
59455 }
59456
59457 int64_t  __attribute__((export_name("TS_NodeFeatures_hash"))) TS_NodeFeatures_hash(uint64_t o) {
59458         LDKNodeFeatures o_conv;
59459         o_conv.inner = untag_ptr(o);
59460         o_conv.is_owned = ptr_is_owned(o);
59461         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59462         o_conv.is_owned = false;
59463         int64_t ret_conv = NodeFeatures_hash(&o_conv);
59464         return ret_conv;
59465 }
59466
59467 int64_t  __attribute__((export_name("TS_ChannelFeatures_hash"))) TS_ChannelFeatures_hash(uint64_t o) {
59468         LDKChannelFeatures o_conv;
59469         o_conv.inner = untag_ptr(o);
59470         o_conv.is_owned = ptr_is_owned(o);
59471         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59472         o_conv.is_owned = false;
59473         int64_t ret_conv = ChannelFeatures_hash(&o_conv);
59474         return ret_conv;
59475 }
59476
59477 int64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_hash"))) TS_Bolt11InvoiceFeatures_hash(uint64_t o) {
59478         LDKBolt11InvoiceFeatures o_conv;
59479         o_conv.inner = untag_ptr(o);
59480         o_conv.is_owned = ptr_is_owned(o);
59481         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59482         o_conv.is_owned = false;
59483         int64_t ret_conv = Bolt11InvoiceFeatures_hash(&o_conv);
59484         return ret_conv;
59485 }
59486
59487 int64_t  __attribute__((export_name("TS_OfferFeatures_hash"))) TS_OfferFeatures_hash(uint64_t o) {
59488         LDKOfferFeatures o_conv;
59489         o_conv.inner = untag_ptr(o);
59490         o_conv.is_owned = ptr_is_owned(o);
59491         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59492         o_conv.is_owned = false;
59493         int64_t ret_conv = OfferFeatures_hash(&o_conv);
59494         return ret_conv;
59495 }
59496
59497 int64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_hash"))) TS_InvoiceRequestFeatures_hash(uint64_t o) {
59498         LDKInvoiceRequestFeatures o_conv;
59499         o_conv.inner = untag_ptr(o);
59500         o_conv.is_owned = ptr_is_owned(o);
59501         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59502         o_conv.is_owned = false;
59503         int64_t ret_conv = InvoiceRequestFeatures_hash(&o_conv);
59504         return ret_conv;
59505 }
59506
59507 int64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_hash"))) TS_Bolt12InvoiceFeatures_hash(uint64_t o) {
59508         LDKBolt12InvoiceFeatures o_conv;
59509         o_conv.inner = untag_ptr(o);
59510         o_conv.is_owned = ptr_is_owned(o);
59511         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59512         o_conv.is_owned = false;
59513         int64_t ret_conv = Bolt12InvoiceFeatures_hash(&o_conv);
59514         return ret_conv;
59515 }
59516
59517 int64_t  __attribute__((export_name("TS_BlindedHopFeatures_hash"))) TS_BlindedHopFeatures_hash(uint64_t o) {
59518         LDKBlindedHopFeatures o_conv;
59519         o_conv.inner = untag_ptr(o);
59520         o_conv.is_owned = ptr_is_owned(o);
59521         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59522         o_conv.is_owned = false;
59523         int64_t ret_conv = BlindedHopFeatures_hash(&o_conv);
59524         return ret_conv;
59525 }
59526
59527 int64_t  __attribute__((export_name("TS_ChannelTypeFeatures_hash"))) TS_ChannelTypeFeatures_hash(uint64_t o) {
59528         LDKChannelTypeFeatures o_conv;
59529         o_conv.inner = untag_ptr(o);
59530         o_conv.is_owned = ptr_is_owned(o);
59531         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59532         o_conv.is_owned = false;
59533         int64_t ret_conv = ChannelTypeFeatures_hash(&o_conv);
59534         return ret_conv;
59535 }
59536
59537 void  __attribute__((export_name("TS_InitFeatures_free"))) TS_InitFeatures_free(uint64_t this_obj) {
59538         LDKInitFeatures this_obj_conv;
59539         this_obj_conv.inner = untag_ptr(this_obj);
59540         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59542         InitFeatures_free(this_obj_conv);
59543 }
59544
59545 void  __attribute__((export_name("TS_NodeFeatures_free"))) TS_NodeFeatures_free(uint64_t this_obj) {
59546         LDKNodeFeatures this_obj_conv;
59547         this_obj_conv.inner = untag_ptr(this_obj);
59548         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59550         NodeFeatures_free(this_obj_conv);
59551 }
59552
59553 void  __attribute__((export_name("TS_ChannelFeatures_free"))) TS_ChannelFeatures_free(uint64_t this_obj) {
59554         LDKChannelFeatures this_obj_conv;
59555         this_obj_conv.inner = untag_ptr(this_obj);
59556         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59558         ChannelFeatures_free(this_obj_conv);
59559 }
59560
59561 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_free"))) TS_Bolt11InvoiceFeatures_free(uint64_t this_obj) {
59562         LDKBolt11InvoiceFeatures this_obj_conv;
59563         this_obj_conv.inner = untag_ptr(this_obj);
59564         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59566         Bolt11InvoiceFeatures_free(this_obj_conv);
59567 }
59568
59569 void  __attribute__((export_name("TS_OfferFeatures_free"))) TS_OfferFeatures_free(uint64_t this_obj) {
59570         LDKOfferFeatures this_obj_conv;
59571         this_obj_conv.inner = untag_ptr(this_obj);
59572         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59574         OfferFeatures_free(this_obj_conv);
59575 }
59576
59577 void  __attribute__((export_name("TS_InvoiceRequestFeatures_free"))) TS_InvoiceRequestFeatures_free(uint64_t this_obj) {
59578         LDKInvoiceRequestFeatures this_obj_conv;
59579         this_obj_conv.inner = untag_ptr(this_obj);
59580         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59582         InvoiceRequestFeatures_free(this_obj_conv);
59583 }
59584
59585 void  __attribute__((export_name("TS_Bolt12InvoiceFeatures_free"))) TS_Bolt12InvoiceFeatures_free(uint64_t this_obj) {
59586         LDKBolt12InvoiceFeatures this_obj_conv;
59587         this_obj_conv.inner = untag_ptr(this_obj);
59588         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59590         Bolt12InvoiceFeatures_free(this_obj_conv);
59591 }
59592
59593 void  __attribute__((export_name("TS_BlindedHopFeatures_free"))) TS_BlindedHopFeatures_free(uint64_t this_obj) {
59594         LDKBlindedHopFeatures this_obj_conv;
59595         this_obj_conv.inner = untag_ptr(this_obj);
59596         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59598         BlindedHopFeatures_free(this_obj_conv);
59599 }
59600
59601 void  __attribute__((export_name("TS_ChannelTypeFeatures_free"))) TS_ChannelTypeFeatures_free(uint64_t this_obj) {
59602         LDKChannelTypeFeatures this_obj_conv;
59603         this_obj_conv.inner = untag_ptr(this_obj);
59604         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59606         ChannelTypeFeatures_free(this_obj_conv);
59607 }
59608
59609 uint64_t  __attribute__((export_name("TS_InitFeatures_empty"))) TS_InitFeatures_empty() {
59610         LDKInitFeatures ret_var = InitFeatures_empty();
59611         uint64_t ret_ref = 0;
59612         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59613         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59614         return ret_ref;
59615 }
59616
59617 jboolean  __attribute__((export_name("TS_InitFeatures_requires_unknown_bits_from"))) TS_InitFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
59618         LDKInitFeatures this_arg_conv;
59619         this_arg_conv.inner = untag_ptr(this_arg);
59620         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59622         this_arg_conv.is_owned = false;
59623         LDKInitFeatures other_conv;
59624         other_conv.inner = untag_ptr(other);
59625         other_conv.is_owned = ptr_is_owned(other);
59626         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
59627         other_conv.is_owned = false;
59628         jboolean ret_conv = InitFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
59629         return ret_conv;
59630 }
59631
59632 jboolean  __attribute__((export_name("TS_InitFeatures_requires_unknown_bits"))) TS_InitFeatures_requires_unknown_bits(uint64_t this_arg) {
59633         LDKInitFeatures this_arg_conv;
59634         this_arg_conv.inner = untag_ptr(this_arg);
59635         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59637         this_arg_conv.is_owned = false;
59638         jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
59639         return ret_conv;
59640 }
59641
59642 uint64_t  __attribute__((export_name("TS_InitFeatures_set_required_feature_bit"))) TS_InitFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
59643         LDKInitFeatures this_arg_conv;
59644         this_arg_conv.inner = untag_ptr(this_arg);
59645         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59647         this_arg_conv.is_owned = false;
59648         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
59649         *ret_conv = InitFeatures_set_required_feature_bit(&this_arg_conv, bit);
59650         return tag_ptr(ret_conv, true);
59651 }
59652
59653 uint64_t  __attribute__((export_name("TS_InitFeatures_set_optional_feature_bit"))) TS_InitFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
59654         LDKInitFeatures this_arg_conv;
59655         this_arg_conv.inner = untag_ptr(this_arg);
59656         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59658         this_arg_conv.is_owned = false;
59659         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
59660         *ret_conv = InitFeatures_set_optional_feature_bit(&this_arg_conv, bit);
59661         return tag_ptr(ret_conv, true);
59662 }
59663
59664 uint64_t  __attribute__((export_name("TS_InitFeatures_set_required_custom_bit"))) TS_InitFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
59665         LDKInitFeatures this_arg_conv;
59666         this_arg_conv.inner = untag_ptr(this_arg);
59667         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59669         this_arg_conv.is_owned = false;
59670         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
59671         *ret_conv = InitFeatures_set_required_custom_bit(&this_arg_conv, bit);
59672         return tag_ptr(ret_conv, true);
59673 }
59674
59675 uint64_t  __attribute__((export_name("TS_InitFeatures_set_optional_custom_bit"))) TS_InitFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
59676         LDKInitFeatures this_arg_conv;
59677         this_arg_conv.inner = untag_ptr(this_arg);
59678         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59680         this_arg_conv.is_owned = false;
59681         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
59682         *ret_conv = InitFeatures_set_optional_custom_bit(&this_arg_conv, bit);
59683         return tag_ptr(ret_conv, true);
59684 }
59685
59686 uint64_t  __attribute__((export_name("TS_NodeFeatures_empty"))) TS_NodeFeatures_empty() {
59687         LDKNodeFeatures ret_var = NodeFeatures_empty();
59688         uint64_t ret_ref = 0;
59689         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59690         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59691         return ret_ref;
59692 }
59693
59694 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_unknown_bits_from"))) TS_NodeFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
59695         LDKNodeFeatures this_arg_conv;
59696         this_arg_conv.inner = untag_ptr(this_arg);
59697         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59699         this_arg_conv.is_owned = false;
59700         LDKNodeFeatures other_conv;
59701         other_conv.inner = untag_ptr(other);
59702         other_conv.is_owned = ptr_is_owned(other);
59703         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
59704         other_conv.is_owned = false;
59705         jboolean ret_conv = NodeFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
59706         return ret_conv;
59707 }
59708
59709 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_unknown_bits"))) TS_NodeFeatures_requires_unknown_bits(uint64_t this_arg) {
59710         LDKNodeFeatures this_arg_conv;
59711         this_arg_conv.inner = untag_ptr(this_arg);
59712         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59714         this_arg_conv.is_owned = false;
59715         jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
59716         return ret_conv;
59717 }
59718
59719 uint64_t  __attribute__((export_name("TS_NodeFeatures_set_required_feature_bit"))) TS_NodeFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
59720         LDKNodeFeatures this_arg_conv;
59721         this_arg_conv.inner = untag_ptr(this_arg);
59722         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59724         this_arg_conv.is_owned = false;
59725         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
59726         *ret_conv = NodeFeatures_set_required_feature_bit(&this_arg_conv, bit);
59727         return tag_ptr(ret_conv, true);
59728 }
59729
59730 uint64_t  __attribute__((export_name("TS_NodeFeatures_set_optional_feature_bit"))) TS_NodeFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
59731         LDKNodeFeatures this_arg_conv;
59732         this_arg_conv.inner = untag_ptr(this_arg);
59733         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59735         this_arg_conv.is_owned = false;
59736         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
59737         *ret_conv = NodeFeatures_set_optional_feature_bit(&this_arg_conv, bit);
59738         return tag_ptr(ret_conv, true);
59739 }
59740
59741 uint64_t  __attribute__((export_name("TS_NodeFeatures_set_required_custom_bit"))) TS_NodeFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
59742         LDKNodeFeatures this_arg_conv;
59743         this_arg_conv.inner = untag_ptr(this_arg);
59744         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59746         this_arg_conv.is_owned = false;
59747         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
59748         *ret_conv = NodeFeatures_set_required_custom_bit(&this_arg_conv, bit);
59749         return tag_ptr(ret_conv, true);
59750 }
59751
59752 uint64_t  __attribute__((export_name("TS_NodeFeatures_set_optional_custom_bit"))) TS_NodeFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
59753         LDKNodeFeatures this_arg_conv;
59754         this_arg_conv.inner = untag_ptr(this_arg);
59755         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59757         this_arg_conv.is_owned = false;
59758         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
59759         *ret_conv = NodeFeatures_set_optional_custom_bit(&this_arg_conv, bit);
59760         return tag_ptr(ret_conv, true);
59761 }
59762
59763 uint64_t  __attribute__((export_name("TS_ChannelFeatures_empty"))) TS_ChannelFeatures_empty() {
59764         LDKChannelFeatures ret_var = ChannelFeatures_empty();
59765         uint64_t ret_ref = 0;
59766         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59767         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59768         return ret_ref;
59769 }
59770
59771 jboolean  __attribute__((export_name("TS_ChannelFeatures_requires_unknown_bits_from"))) TS_ChannelFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
59772         LDKChannelFeatures this_arg_conv;
59773         this_arg_conv.inner = untag_ptr(this_arg);
59774         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59776         this_arg_conv.is_owned = false;
59777         LDKChannelFeatures other_conv;
59778         other_conv.inner = untag_ptr(other);
59779         other_conv.is_owned = ptr_is_owned(other);
59780         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
59781         other_conv.is_owned = false;
59782         jboolean ret_conv = ChannelFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
59783         return ret_conv;
59784 }
59785
59786 jboolean  __attribute__((export_name("TS_ChannelFeatures_requires_unknown_bits"))) TS_ChannelFeatures_requires_unknown_bits(uint64_t this_arg) {
59787         LDKChannelFeatures this_arg_conv;
59788         this_arg_conv.inner = untag_ptr(this_arg);
59789         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59791         this_arg_conv.is_owned = false;
59792         jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
59793         return ret_conv;
59794 }
59795
59796 uint64_t  __attribute__((export_name("TS_ChannelFeatures_set_required_feature_bit"))) TS_ChannelFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
59797         LDKChannelFeatures this_arg_conv;
59798         this_arg_conv.inner = untag_ptr(this_arg);
59799         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59801         this_arg_conv.is_owned = false;
59802         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
59803         *ret_conv = ChannelFeatures_set_required_feature_bit(&this_arg_conv, bit);
59804         return tag_ptr(ret_conv, true);
59805 }
59806
59807 uint64_t  __attribute__((export_name("TS_ChannelFeatures_set_optional_feature_bit"))) TS_ChannelFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
59808         LDKChannelFeatures this_arg_conv;
59809         this_arg_conv.inner = untag_ptr(this_arg);
59810         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59812         this_arg_conv.is_owned = false;
59813         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
59814         *ret_conv = ChannelFeatures_set_optional_feature_bit(&this_arg_conv, bit);
59815         return tag_ptr(ret_conv, true);
59816 }
59817
59818 uint64_t  __attribute__((export_name("TS_ChannelFeatures_set_required_custom_bit"))) TS_ChannelFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
59819         LDKChannelFeatures this_arg_conv;
59820         this_arg_conv.inner = untag_ptr(this_arg);
59821         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59823         this_arg_conv.is_owned = false;
59824         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
59825         *ret_conv = ChannelFeatures_set_required_custom_bit(&this_arg_conv, bit);
59826         return tag_ptr(ret_conv, true);
59827 }
59828
59829 uint64_t  __attribute__((export_name("TS_ChannelFeatures_set_optional_custom_bit"))) TS_ChannelFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
59830         LDKChannelFeatures this_arg_conv;
59831         this_arg_conv.inner = untag_ptr(this_arg);
59832         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59834         this_arg_conv.is_owned = false;
59835         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
59836         *ret_conv = ChannelFeatures_set_optional_custom_bit(&this_arg_conv, bit);
59837         return tag_ptr(ret_conv, true);
59838 }
59839
59840 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_empty"))) TS_Bolt11InvoiceFeatures_empty() {
59841         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_empty();
59842         uint64_t ret_ref = 0;
59843         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59844         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59845         return ret_ref;
59846 }
59847
59848 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_unknown_bits_from"))) TS_Bolt11InvoiceFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
59849         LDKBolt11InvoiceFeatures 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         LDKBolt11InvoiceFeatures other_conv;
59855         other_conv.inner = untag_ptr(other);
59856         other_conv.is_owned = ptr_is_owned(other);
59857         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
59858         other_conv.is_owned = false;
59859         jboolean ret_conv = Bolt11InvoiceFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
59860         return ret_conv;
59861 }
59862
59863 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_unknown_bits"))) TS_Bolt11InvoiceFeatures_requires_unknown_bits(uint64_t this_arg) {
59864         LDKBolt11InvoiceFeatures 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         jboolean ret_conv = Bolt11InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
59870         return ret_conv;
59871 }
59872
59873 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_required_feature_bit"))) TS_Bolt11InvoiceFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
59874         LDKBolt11InvoiceFeatures this_arg_conv;
59875         this_arg_conv.inner = untag_ptr(this_arg);
59876         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59878         this_arg_conv.is_owned = false;
59879         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
59880         *ret_conv = Bolt11InvoiceFeatures_set_required_feature_bit(&this_arg_conv, bit);
59881         return tag_ptr(ret_conv, true);
59882 }
59883
59884 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_optional_feature_bit"))) TS_Bolt11InvoiceFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
59885         LDKBolt11InvoiceFeatures this_arg_conv;
59886         this_arg_conv.inner = untag_ptr(this_arg);
59887         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59889         this_arg_conv.is_owned = false;
59890         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
59891         *ret_conv = Bolt11InvoiceFeatures_set_optional_feature_bit(&this_arg_conv, bit);
59892         return tag_ptr(ret_conv, true);
59893 }
59894
59895 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_required_custom_bit"))) TS_Bolt11InvoiceFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
59896         LDKBolt11InvoiceFeatures this_arg_conv;
59897         this_arg_conv.inner = untag_ptr(this_arg);
59898         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59900         this_arg_conv.is_owned = false;
59901         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
59902         *ret_conv = Bolt11InvoiceFeatures_set_required_custom_bit(&this_arg_conv, bit);
59903         return tag_ptr(ret_conv, true);
59904 }
59905
59906 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_optional_custom_bit"))) TS_Bolt11InvoiceFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
59907         LDKBolt11InvoiceFeatures this_arg_conv;
59908         this_arg_conv.inner = untag_ptr(this_arg);
59909         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59911         this_arg_conv.is_owned = false;
59912         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
59913         *ret_conv = Bolt11InvoiceFeatures_set_optional_custom_bit(&this_arg_conv, bit);
59914         return tag_ptr(ret_conv, true);
59915 }
59916
59917 uint64_t  __attribute__((export_name("TS_OfferFeatures_empty"))) TS_OfferFeatures_empty() {
59918         LDKOfferFeatures ret_var = OfferFeatures_empty();
59919         uint64_t ret_ref = 0;
59920         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59921         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59922         return ret_ref;
59923 }
59924
59925 jboolean  __attribute__((export_name("TS_OfferFeatures_requires_unknown_bits_from"))) TS_OfferFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
59926         LDKOfferFeatures this_arg_conv;
59927         this_arg_conv.inner = untag_ptr(this_arg);
59928         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59930         this_arg_conv.is_owned = false;
59931         LDKOfferFeatures other_conv;
59932         other_conv.inner = untag_ptr(other);
59933         other_conv.is_owned = ptr_is_owned(other);
59934         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
59935         other_conv.is_owned = false;
59936         jboolean ret_conv = OfferFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
59937         return ret_conv;
59938 }
59939
59940 jboolean  __attribute__((export_name("TS_OfferFeatures_requires_unknown_bits"))) TS_OfferFeatures_requires_unknown_bits(uint64_t this_arg) {
59941         LDKOfferFeatures this_arg_conv;
59942         this_arg_conv.inner = untag_ptr(this_arg);
59943         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59945         this_arg_conv.is_owned = false;
59946         jboolean ret_conv = OfferFeatures_requires_unknown_bits(&this_arg_conv);
59947         return ret_conv;
59948 }
59949
59950 uint64_t  __attribute__((export_name("TS_OfferFeatures_set_required_feature_bit"))) TS_OfferFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
59951         LDKOfferFeatures this_arg_conv;
59952         this_arg_conv.inner = untag_ptr(this_arg);
59953         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59955         this_arg_conv.is_owned = false;
59956         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
59957         *ret_conv = OfferFeatures_set_required_feature_bit(&this_arg_conv, bit);
59958         return tag_ptr(ret_conv, true);
59959 }
59960
59961 uint64_t  __attribute__((export_name("TS_OfferFeatures_set_optional_feature_bit"))) TS_OfferFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
59962         LDKOfferFeatures this_arg_conv;
59963         this_arg_conv.inner = untag_ptr(this_arg);
59964         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59966         this_arg_conv.is_owned = false;
59967         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
59968         *ret_conv = OfferFeatures_set_optional_feature_bit(&this_arg_conv, bit);
59969         return tag_ptr(ret_conv, true);
59970 }
59971
59972 uint64_t  __attribute__((export_name("TS_OfferFeatures_set_required_custom_bit"))) TS_OfferFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
59973         LDKOfferFeatures this_arg_conv;
59974         this_arg_conv.inner = untag_ptr(this_arg);
59975         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59977         this_arg_conv.is_owned = false;
59978         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
59979         *ret_conv = OfferFeatures_set_required_custom_bit(&this_arg_conv, bit);
59980         return tag_ptr(ret_conv, true);
59981 }
59982
59983 uint64_t  __attribute__((export_name("TS_OfferFeatures_set_optional_custom_bit"))) TS_OfferFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
59984         LDKOfferFeatures this_arg_conv;
59985         this_arg_conv.inner = untag_ptr(this_arg);
59986         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59988         this_arg_conv.is_owned = false;
59989         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
59990         *ret_conv = OfferFeatures_set_optional_custom_bit(&this_arg_conv, bit);
59991         return tag_ptr(ret_conv, true);
59992 }
59993
59994 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_empty"))) TS_InvoiceRequestFeatures_empty() {
59995         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_empty();
59996         uint64_t ret_ref = 0;
59997         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59998         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59999         return ret_ref;
60000 }
60001
60002 jboolean  __attribute__((export_name("TS_InvoiceRequestFeatures_requires_unknown_bits_from"))) TS_InvoiceRequestFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
60003         LDKInvoiceRequestFeatures this_arg_conv;
60004         this_arg_conv.inner = untag_ptr(this_arg);
60005         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60007         this_arg_conv.is_owned = false;
60008         LDKInvoiceRequestFeatures other_conv;
60009         other_conv.inner = untag_ptr(other);
60010         other_conv.is_owned = ptr_is_owned(other);
60011         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
60012         other_conv.is_owned = false;
60013         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
60014         return ret_conv;
60015 }
60016
60017 jboolean  __attribute__((export_name("TS_InvoiceRequestFeatures_requires_unknown_bits"))) TS_InvoiceRequestFeatures_requires_unknown_bits(uint64_t this_arg) {
60018         LDKInvoiceRequestFeatures 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         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits(&this_arg_conv);
60024         return ret_conv;
60025 }
60026
60027 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_set_required_feature_bit"))) TS_InvoiceRequestFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
60028         LDKInvoiceRequestFeatures 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         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60034         *ret_conv = InvoiceRequestFeatures_set_required_feature_bit(&this_arg_conv, bit);
60035         return tag_ptr(ret_conv, true);
60036 }
60037
60038 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_set_optional_feature_bit"))) TS_InvoiceRequestFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
60039         LDKInvoiceRequestFeatures this_arg_conv;
60040         this_arg_conv.inner = untag_ptr(this_arg);
60041         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60043         this_arg_conv.is_owned = false;
60044         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60045         *ret_conv = InvoiceRequestFeatures_set_optional_feature_bit(&this_arg_conv, bit);
60046         return tag_ptr(ret_conv, true);
60047 }
60048
60049 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_set_required_custom_bit"))) TS_InvoiceRequestFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
60050         LDKInvoiceRequestFeatures 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         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60056         *ret_conv = InvoiceRequestFeatures_set_required_custom_bit(&this_arg_conv, bit);
60057         return tag_ptr(ret_conv, true);
60058 }
60059
60060 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_set_optional_custom_bit"))) TS_InvoiceRequestFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
60061         LDKInvoiceRequestFeatures this_arg_conv;
60062         this_arg_conv.inner = untag_ptr(this_arg);
60063         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60065         this_arg_conv.is_owned = false;
60066         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60067         *ret_conv = InvoiceRequestFeatures_set_optional_custom_bit(&this_arg_conv, bit);
60068         return tag_ptr(ret_conv, true);
60069 }
60070
60071 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_empty"))) TS_Bolt12InvoiceFeatures_empty() {
60072         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_empty();
60073         uint64_t ret_ref = 0;
60074         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60075         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60076         return ret_ref;
60077 }
60078
60079 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_requires_unknown_bits_from"))) TS_Bolt12InvoiceFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
60080         LDKBolt12InvoiceFeatures this_arg_conv;
60081         this_arg_conv.inner = untag_ptr(this_arg);
60082         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60084         this_arg_conv.is_owned = false;
60085         LDKBolt12InvoiceFeatures other_conv;
60086         other_conv.inner = untag_ptr(other);
60087         other_conv.is_owned = ptr_is_owned(other);
60088         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
60089         other_conv.is_owned = false;
60090         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
60091         return ret_conv;
60092 }
60093
60094 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_requires_unknown_bits"))) TS_Bolt12InvoiceFeatures_requires_unknown_bits(uint64_t this_arg) {
60095         LDKBolt12InvoiceFeatures this_arg_conv;
60096         this_arg_conv.inner = untag_ptr(this_arg);
60097         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60099         this_arg_conv.is_owned = false;
60100         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
60101         return ret_conv;
60102 }
60103
60104 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_required_feature_bit"))) TS_Bolt12InvoiceFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
60105         LDKBolt12InvoiceFeatures this_arg_conv;
60106         this_arg_conv.inner = untag_ptr(this_arg);
60107         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60109         this_arg_conv.is_owned = false;
60110         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60111         *ret_conv = Bolt12InvoiceFeatures_set_required_feature_bit(&this_arg_conv, bit);
60112         return tag_ptr(ret_conv, true);
60113 }
60114
60115 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_optional_feature_bit"))) TS_Bolt12InvoiceFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
60116         LDKBolt12InvoiceFeatures this_arg_conv;
60117         this_arg_conv.inner = untag_ptr(this_arg);
60118         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60120         this_arg_conv.is_owned = false;
60121         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60122         *ret_conv = Bolt12InvoiceFeatures_set_optional_feature_bit(&this_arg_conv, bit);
60123         return tag_ptr(ret_conv, true);
60124 }
60125
60126 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_required_custom_bit"))) TS_Bolt12InvoiceFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
60127         LDKBolt12InvoiceFeatures this_arg_conv;
60128         this_arg_conv.inner = untag_ptr(this_arg);
60129         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60131         this_arg_conv.is_owned = false;
60132         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60133         *ret_conv = Bolt12InvoiceFeatures_set_required_custom_bit(&this_arg_conv, bit);
60134         return tag_ptr(ret_conv, true);
60135 }
60136
60137 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_optional_custom_bit"))) TS_Bolt12InvoiceFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
60138         LDKBolt12InvoiceFeatures this_arg_conv;
60139         this_arg_conv.inner = untag_ptr(this_arg);
60140         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60142         this_arg_conv.is_owned = false;
60143         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60144         *ret_conv = Bolt12InvoiceFeatures_set_optional_custom_bit(&this_arg_conv, bit);
60145         return tag_ptr(ret_conv, true);
60146 }
60147
60148 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_empty"))) TS_BlindedHopFeatures_empty() {
60149         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_empty();
60150         uint64_t ret_ref = 0;
60151         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60152         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60153         return ret_ref;
60154 }
60155
60156 jboolean  __attribute__((export_name("TS_BlindedHopFeatures_requires_unknown_bits_from"))) TS_BlindedHopFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
60157         LDKBlindedHopFeatures this_arg_conv;
60158         this_arg_conv.inner = untag_ptr(this_arg);
60159         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60161         this_arg_conv.is_owned = false;
60162         LDKBlindedHopFeatures other_conv;
60163         other_conv.inner = untag_ptr(other);
60164         other_conv.is_owned = ptr_is_owned(other);
60165         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
60166         other_conv.is_owned = false;
60167         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
60168         return ret_conv;
60169 }
60170
60171 jboolean  __attribute__((export_name("TS_BlindedHopFeatures_requires_unknown_bits"))) TS_BlindedHopFeatures_requires_unknown_bits(uint64_t this_arg) {
60172         LDKBlindedHopFeatures this_arg_conv;
60173         this_arg_conv.inner = untag_ptr(this_arg);
60174         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60176         this_arg_conv.is_owned = false;
60177         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits(&this_arg_conv);
60178         return ret_conv;
60179 }
60180
60181 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_set_required_feature_bit"))) TS_BlindedHopFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
60182         LDKBlindedHopFeatures this_arg_conv;
60183         this_arg_conv.inner = untag_ptr(this_arg);
60184         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60186         this_arg_conv.is_owned = false;
60187         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60188         *ret_conv = BlindedHopFeatures_set_required_feature_bit(&this_arg_conv, bit);
60189         return tag_ptr(ret_conv, true);
60190 }
60191
60192 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_set_optional_feature_bit"))) TS_BlindedHopFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
60193         LDKBlindedHopFeatures this_arg_conv;
60194         this_arg_conv.inner = untag_ptr(this_arg);
60195         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60197         this_arg_conv.is_owned = false;
60198         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60199         *ret_conv = BlindedHopFeatures_set_optional_feature_bit(&this_arg_conv, bit);
60200         return tag_ptr(ret_conv, true);
60201 }
60202
60203 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_set_required_custom_bit"))) TS_BlindedHopFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
60204         LDKBlindedHopFeatures this_arg_conv;
60205         this_arg_conv.inner = untag_ptr(this_arg);
60206         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60208         this_arg_conv.is_owned = false;
60209         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60210         *ret_conv = BlindedHopFeatures_set_required_custom_bit(&this_arg_conv, bit);
60211         return tag_ptr(ret_conv, true);
60212 }
60213
60214 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_set_optional_custom_bit"))) TS_BlindedHopFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
60215         LDKBlindedHopFeatures this_arg_conv;
60216         this_arg_conv.inner = untag_ptr(this_arg);
60217         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60219         this_arg_conv.is_owned = false;
60220         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60221         *ret_conv = BlindedHopFeatures_set_optional_custom_bit(&this_arg_conv, bit);
60222         return tag_ptr(ret_conv, true);
60223 }
60224
60225 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_empty"))) TS_ChannelTypeFeatures_empty() {
60226         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
60227         uint64_t ret_ref = 0;
60228         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60229         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60230         return ret_ref;
60231 }
60232
60233 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_unknown_bits_from"))) TS_ChannelTypeFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
60234         LDKChannelTypeFeatures this_arg_conv;
60235         this_arg_conv.inner = untag_ptr(this_arg);
60236         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60238         this_arg_conv.is_owned = false;
60239         LDKChannelTypeFeatures other_conv;
60240         other_conv.inner = untag_ptr(other);
60241         other_conv.is_owned = ptr_is_owned(other);
60242         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
60243         other_conv.is_owned = false;
60244         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
60245         return ret_conv;
60246 }
60247
60248 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_unknown_bits"))) TS_ChannelTypeFeatures_requires_unknown_bits(uint64_t this_arg) {
60249         LDKChannelTypeFeatures this_arg_conv;
60250         this_arg_conv.inner = untag_ptr(this_arg);
60251         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60253         this_arg_conv.is_owned = false;
60254         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
60255         return ret_conv;
60256 }
60257
60258 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_set_required_feature_bit"))) TS_ChannelTypeFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
60259         LDKChannelTypeFeatures this_arg_conv;
60260         this_arg_conv.inner = untag_ptr(this_arg);
60261         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60263         this_arg_conv.is_owned = false;
60264         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60265         *ret_conv = ChannelTypeFeatures_set_required_feature_bit(&this_arg_conv, bit);
60266         return tag_ptr(ret_conv, true);
60267 }
60268
60269 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_set_optional_feature_bit"))) TS_ChannelTypeFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
60270         LDKChannelTypeFeatures this_arg_conv;
60271         this_arg_conv.inner = untag_ptr(this_arg);
60272         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60274         this_arg_conv.is_owned = false;
60275         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60276         *ret_conv = ChannelTypeFeatures_set_optional_feature_bit(&this_arg_conv, bit);
60277         return tag_ptr(ret_conv, true);
60278 }
60279
60280 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_set_required_custom_bit"))) TS_ChannelTypeFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
60281         LDKChannelTypeFeatures this_arg_conv;
60282         this_arg_conv.inner = untag_ptr(this_arg);
60283         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60285         this_arg_conv.is_owned = false;
60286         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60287         *ret_conv = ChannelTypeFeatures_set_required_custom_bit(&this_arg_conv, bit);
60288         return tag_ptr(ret_conv, true);
60289 }
60290
60291 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_set_optional_custom_bit"))) TS_ChannelTypeFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
60292         LDKChannelTypeFeatures this_arg_conv;
60293         this_arg_conv.inner = untag_ptr(this_arg);
60294         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60296         this_arg_conv.is_owned = false;
60297         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60298         *ret_conv = ChannelTypeFeatures_set_optional_custom_bit(&this_arg_conv, bit);
60299         return tag_ptr(ret_conv, true);
60300 }
60301
60302 int8_tArray  __attribute__((export_name("TS_InitFeatures_write"))) TS_InitFeatures_write(uint64_t obj) {
60303         LDKInitFeatures obj_conv;
60304         obj_conv.inner = untag_ptr(obj);
60305         obj_conv.is_owned = ptr_is_owned(obj);
60306         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60307         obj_conv.is_owned = false;
60308         LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
60309         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60310         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60311         CVec_u8Z_free(ret_var);
60312         return ret_arr;
60313 }
60314
60315 uint64_t  __attribute__((export_name("TS_InitFeatures_read"))) TS_InitFeatures_read(int8_tArray ser) {
60316         LDKu8slice ser_ref;
60317         ser_ref.datalen = ser->arr_len;
60318         ser_ref.data = ser->elems;
60319         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
60320         *ret_conv = InitFeatures_read(ser_ref);
60321         FREE(ser);
60322         return tag_ptr(ret_conv, true);
60323 }
60324
60325 int8_tArray  __attribute__((export_name("TS_ChannelFeatures_write"))) TS_ChannelFeatures_write(uint64_t obj) {
60326         LDKChannelFeatures obj_conv;
60327         obj_conv.inner = untag_ptr(obj);
60328         obj_conv.is_owned = ptr_is_owned(obj);
60329         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60330         obj_conv.is_owned = false;
60331         LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
60332         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60333         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60334         CVec_u8Z_free(ret_var);
60335         return ret_arr;
60336 }
60337
60338 uint64_t  __attribute__((export_name("TS_ChannelFeatures_read"))) TS_ChannelFeatures_read(int8_tArray ser) {
60339         LDKu8slice ser_ref;
60340         ser_ref.datalen = ser->arr_len;
60341         ser_ref.data = ser->elems;
60342         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
60343         *ret_conv = ChannelFeatures_read(ser_ref);
60344         FREE(ser);
60345         return tag_ptr(ret_conv, true);
60346 }
60347
60348 int8_tArray  __attribute__((export_name("TS_NodeFeatures_write"))) TS_NodeFeatures_write(uint64_t obj) {
60349         LDKNodeFeatures obj_conv;
60350         obj_conv.inner = untag_ptr(obj);
60351         obj_conv.is_owned = ptr_is_owned(obj);
60352         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60353         obj_conv.is_owned = false;
60354         LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
60355         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60356         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60357         CVec_u8Z_free(ret_var);
60358         return ret_arr;
60359 }
60360
60361 uint64_t  __attribute__((export_name("TS_NodeFeatures_read"))) TS_NodeFeatures_read(int8_tArray ser) {
60362         LDKu8slice ser_ref;
60363         ser_ref.datalen = ser->arr_len;
60364         ser_ref.data = ser->elems;
60365         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
60366         *ret_conv = NodeFeatures_read(ser_ref);
60367         FREE(ser);
60368         return tag_ptr(ret_conv, true);
60369 }
60370
60371 int8_tArray  __attribute__((export_name("TS_Bolt11InvoiceFeatures_write"))) TS_Bolt11InvoiceFeatures_write(uint64_t obj) {
60372         LDKBolt11InvoiceFeatures obj_conv;
60373         obj_conv.inner = untag_ptr(obj);
60374         obj_conv.is_owned = ptr_is_owned(obj);
60375         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60376         obj_conv.is_owned = false;
60377         LDKCVec_u8Z ret_var = Bolt11InvoiceFeatures_write(&obj_conv);
60378         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60379         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60380         CVec_u8Z_free(ret_var);
60381         return ret_arr;
60382 }
60383
60384 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_read"))) TS_Bolt11InvoiceFeatures_read(int8_tArray ser) {
60385         LDKu8slice ser_ref;
60386         ser_ref.datalen = ser->arr_len;
60387         ser_ref.data = ser->elems;
60388         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
60389         *ret_conv = Bolt11InvoiceFeatures_read(ser_ref);
60390         FREE(ser);
60391         return tag_ptr(ret_conv, true);
60392 }
60393
60394 int8_tArray  __attribute__((export_name("TS_Bolt12InvoiceFeatures_write"))) TS_Bolt12InvoiceFeatures_write(uint64_t obj) {
60395         LDKBolt12InvoiceFeatures obj_conv;
60396         obj_conv.inner = untag_ptr(obj);
60397         obj_conv.is_owned = ptr_is_owned(obj);
60398         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60399         obj_conv.is_owned = false;
60400         LDKCVec_u8Z ret_var = Bolt12InvoiceFeatures_write(&obj_conv);
60401         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60402         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60403         CVec_u8Z_free(ret_var);
60404         return ret_arr;
60405 }
60406
60407 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_read"))) TS_Bolt12InvoiceFeatures_read(int8_tArray ser) {
60408         LDKu8slice ser_ref;
60409         ser_ref.datalen = ser->arr_len;
60410         ser_ref.data = ser->elems;
60411         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
60412         *ret_conv = Bolt12InvoiceFeatures_read(ser_ref);
60413         FREE(ser);
60414         return tag_ptr(ret_conv, true);
60415 }
60416
60417 int8_tArray  __attribute__((export_name("TS_BlindedHopFeatures_write"))) TS_BlindedHopFeatures_write(uint64_t obj) {
60418         LDKBlindedHopFeatures obj_conv;
60419         obj_conv.inner = untag_ptr(obj);
60420         obj_conv.is_owned = ptr_is_owned(obj);
60421         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60422         obj_conv.is_owned = false;
60423         LDKCVec_u8Z ret_var = BlindedHopFeatures_write(&obj_conv);
60424         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60425         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60426         CVec_u8Z_free(ret_var);
60427         return ret_arr;
60428 }
60429
60430 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_read"))) TS_BlindedHopFeatures_read(int8_tArray ser) {
60431         LDKu8slice ser_ref;
60432         ser_ref.datalen = ser->arr_len;
60433         ser_ref.data = ser->elems;
60434         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
60435         *ret_conv = BlindedHopFeatures_read(ser_ref);
60436         FREE(ser);
60437         return tag_ptr(ret_conv, true);
60438 }
60439
60440 int8_tArray  __attribute__((export_name("TS_ChannelTypeFeatures_write"))) TS_ChannelTypeFeatures_write(uint64_t obj) {
60441         LDKChannelTypeFeatures obj_conv;
60442         obj_conv.inner = untag_ptr(obj);
60443         obj_conv.is_owned = ptr_is_owned(obj);
60444         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60445         obj_conv.is_owned = false;
60446         LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
60447         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60448         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60449         CVec_u8Z_free(ret_var);
60450         return ret_arr;
60451 }
60452
60453 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_read"))) TS_ChannelTypeFeatures_read(int8_tArray ser) {
60454         LDKu8slice ser_ref;
60455         ser_ref.datalen = ser->arr_len;
60456         ser_ref.data = ser->elems;
60457         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
60458         *ret_conv = ChannelTypeFeatures_read(ser_ref);
60459         FREE(ser);
60460         return tag_ptr(ret_conv, true);
60461 }
60462
60463 void  __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_optional"))) TS_InitFeatures_set_data_loss_protect_optional(uint64_t this_arg) {
60464         LDKInitFeatures this_arg_conv;
60465         this_arg_conv.inner = untag_ptr(this_arg);
60466         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60468         this_arg_conv.is_owned = false;
60469         InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
60470 }
60471
60472 void  __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_required"))) TS_InitFeatures_set_data_loss_protect_required(uint64_t this_arg) {
60473         LDKInitFeatures this_arg_conv;
60474         this_arg_conv.inner = untag_ptr(this_arg);
60475         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60477         this_arg_conv.is_owned = false;
60478         InitFeatures_set_data_loss_protect_required(&this_arg_conv);
60479 }
60480
60481 jboolean  __attribute__((export_name("TS_InitFeatures_supports_data_loss_protect"))) TS_InitFeatures_supports_data_loss_protect(uint64_t this_arg) {
60482         LDKInitFeatures this_arg_conv;
60483         this_arg_conv.inner = untag_ptr(this_arg);
60484         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60486         this_arg_conv.is_owned = false;
60487         jboolean ret_conv = InitFeatures_supports_data_loss_protect(&this_arg_conv);
60488         return ret_conv;
60489 }
60490
60491 void  __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_optional"))) TS_NodeFeatures_set_data_loss_protect_optional(uint64_t this_arg) {
60492         LDKNodeFeatures this_arg_conv;
60493         this_arg_conv.inner = untag_ptr(this_arg);
60494         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60496         this_arg_conv.is_owned = false;
60497         NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
60498 }
60499
60500 void  __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_required"))) TS_NodeFeatures_set_data_loss_protect_required(uint64_t this_arg) {
60501         LDKNodeFeatures this_arg_conv;
60502         this_arg_conv.inner = untag_ptr(this_arg);
60503         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60505         this_arg_conv.is_owned = false;
60506         NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
60507 }
60508
60509 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_data_loss_protect"))) TS_NodeFeatures_supports_data_loss_protect(uint64_t this_arg) {
60510         LDKNodeFeatures this_arg_conv;
60511         this_arg_conv.inner = untag_ptr(this_arg);
60512         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60514         this_arg_conv.is_owned = false;
60515         jboolean ret_conv = NodeFeatures_supports_data_loss_protect(&this_arg_conv);
60516         return ret_conv;
60517 }
60518
60519 jboolean  __attribute__((export_name("TS_InitFeatures_requires_data_loss_protect"))) TS_InitFeatures_requires_data_loss_protect(uint64_t this_arg) {
60520         LDKInitFeatures this_arg_conv;
60521         this_arg_conv.inner = untag_ptr(this_arg);
60522         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60524         this_arg_conv.is_owned = false;
60525         jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
60526         return ret_conv;
60527 }
60528
60529 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_data_loss_protect"))) TS_NodeFeatures_requires_data_loss_protect(uint64_t this_arg) {
60530         LDKNodeFeatures this_arg_conv;
60531         this_arg_conv.inner = untag_ptr(this_arg);
60532         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60534         this_arg_conv.is_owned = false;
60535         jboolean ret_conv = NodeFeatures_requires_data_loss_protect(&this_arg_conv);
60536         return ret_conv;
60537 }
60538
60539 void  __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_optional"))) TS_InitFeatures_set_initial_routing_sync_optional(uint64_t this_arg) {
60540         LDKInitFeatures this_arg_conv;
60541         this_arg_conv.inner = untag_ptr(this_arg);
60542         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60544         this_arg_conv.is_owned = false;
60545         InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
60546 }
60547
60548 void  __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_required"))) TS_InitFeatures_set_initial_routing_sync_required(uint64_t this_arg) {
60549         LDKInitFeatures this_arg_conv;
60550         this_arg_conv.inner = untag_ptr(this_arg);
60551         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60553         this_arg_conv.is_owned = false;
60554         InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
60555 }
60556
60557 jboolean  __attribute__((export_name("TS_InitFeatures_initial_routing_sync"))) TS_InitFeatures_initial_routing_sync(uint64_t this_arg) {
60558         LDKInitFeatures this_arg_conv;
60559         this_arg_conv.inner = untag_ptr(this_arg);
60560         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60562         this_arg_conv.is_owned = false;
60563         jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
60564         return ret_conv;
60565 }
60566
60567 void  __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_optional"))) TS_InitFeatures_set_upfront_shutdown_script_optional(uint64_t this_arg) {
60568         LDKInitFeatures this_arg_conv;
60569         this_arg_conv.inner = untag_ptr(this_arg);
60570         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60572         this_arg_conv.is_owned = false;
60573         InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
60574 }
60575
60576 void  __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_required"))) TS_InitFeatures_set_upfront_shutdown_script_required(uint64_t this_arg) {
60577         LDKInitFeatures this_arg_conv;
60578         this_arg_conv.inner = untag_ptr(this_arg);
60579         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60581         this_arg_conv.is_owned = false;
60582         InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
60583 }
60584
60585 jboolean  __attribute__((export_name("TS_InitFeatures_supports_upfront_shutdown_script"))) TS_InitFeatures_supports_upfront_shutdown_script(uint64_t this_arg) {
60586         LDKInitFeatures this_arg_conv;
60587         this_arg_conv.inner = untag_ptr(this_arg);
60588         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60590         this_arg_conv.is_owned = false;
60591         jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
60592         return ret_conv;
60593 }
60594
60595 void  __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_optional"))) TS_NodeFeatures_set_upfront_shutdown_script_optional(uint64_t this_arg) {
60596         LDKNodeFeatures this_arg_conv;
60597         this_arg_conv.inner = untag_ptr(this_arg);
60598         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60600         this_arg_conv.is_owned = false;
60601         NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
60602 }
60603
60604 void  __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_required"))) TS_NodeFeatures_set_upfront_shutdown_script_required(uint64_t this_arg) {
60605         LDKNodeFeatures this_arg_conv;
60606         this_arg_conv.inner = untag_ptr(this_arg);
60607         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60609         this_arg_conv.is_owned = false;
60610         NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
60611 }
60612
60613 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_upfront_shutdown_script"))) TS_NodeFeatures_supports_upfront_shutdown_script(uint64_t this_arg) {
60614         LDKNodeFeatures this_arg_conv;
60615         this_arg_conv.inner = untag_ptr(this_arg);
60616         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60618         this_arg_conv.is_owned = false;
60619         jboolean ret_conv = NodeFeatures_supports_upfront_shutdown_script(&this_arg_conv);
60620         return ret_conv;
60621 }
60622
60623 jboolean  __attribute__((export_name("TS_InitFeatures_requires_upfront_shutdown_script"))) TS_InitFeatures_requires_upfront_shutdown_script(uint64_t this_arg) {
60624         LDKInitFeatures this_arg_conv;
60625         this_arg_conv.inner = untag_ptr(this_arg);
60626         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60628         this_arg_conv.is_owned = false;
60629         jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
60630         return ret_conv;
60631 }
60632
60633 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_upfront_shutdown_script"))) TS_NodeFeatures_requires_upfront_shutdown_script(uint64_t this_arg) {
60634         LDKNodeFeatures this_arg_conv;
60635         this_arg_conv.inner = untag_ptr(this_arg);
60636         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60638         this_arg_conv.is_owned = false;
60639         jboolean ret_conv = NodeFeatures_requires_upfront_shutdown_script(&this_arg_conv);
60640         return ret_conv;
60641 }
60642
60643 void  __attribute__((export_name("TS_InitFeatures_set_gossip_queries_optional"))) TS_InitFeatures_set_gossip_queries_optional(uint64_t this_arg) {
60644         LDKInitFeatures this_arg_conv;
60645         this_arg_conv.inner = untag_ptr(this_arg);
60646         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60648         this_arg_conv.is_owned = false;
60649         InitFeatures_set_gossip_queries_optional(&this_arg_conv);
60650 }
60651
60652 void  __attribute__((export_name("TS_InitFeatures_set_gossip_queries_required"))) TS_InitFeatures_set_gossip_queries_required(uint64_t this_arg) {
60653         LDKInitFeatures this_arg_conv;
60654         this_arg_conv.inner = untag_ptr(this_arg);
60655         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60657         this_arg_conv.is_owned = false;
60658         InitFeatures_set_gossip_queries_required(&this_arg_conv);
60659 }
60660
60661 jboolean  __attribute__((export_name("TS_InitFeatures_supports_gossip_queries"))) TS_InitFeatures_supports_gossip_queries(uint64_t this_arg) {
60662         LDKInitFeatures this_arg_conv;
60663         this_arg_conv.inner = untag_ptr(this_arg);
60664         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60666         this_arg_conv.is_owned = false;
60667         jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
60668         return ret_conv;
60669 }
60670
60671 void  __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_optional"))) TS_NodeFeatures_set_gossip_queries_optional(uint64_t this_arg) {
60672         LDKNodeFeatures this_arg_conv;
60673         this_arg_conv.inner = untag_ptr(this_arg);
60674         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60676         this_arg_conv.is_owned = false;
60677         NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
60678 }
60679
60680 void  __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_required"))) TS_NodeFeatures_set_gossip_queries_required(uint64_t this_arg) {
60681         LDKNodeFeatures this_arg_conv;
60682         this_arg_conv.inner = untag_ptr(this_arg);
60683         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60685         this_arg_conv.is_owned = false;
60686         NodeFeatures_set_gossip_queries_required(&this_arg_conv);
60687 }
60688
60689 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_gossip_queries"))) TS_NodeFeatures_supports_gossip_queries(uint64_t this_arg) {
60690         LDKNodeFeatures this_arg_conv;
60691         this_arg_conv.inner = untag_ptr(this_arg);
60692         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60694         this_arg_conv.is_owned = false;
60695         jboolean ret_conv = NodeFeatures_supports_gossip_queries(&this_arg_conv);
60696         return ret_conv;
60697 }
60698
60699 jboolean  __attribute__((export_name("TS_InitFeatures_requires_gossip_queries"))) TS_InitFeatures_requires_gossip_queries(uint64_t this_arg) {
60700         LDKInitFeatures this_arg_conv;
60701         this_arg_conv.inner = untag_ptr(this_arg);
60702         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60704         this_arg_conv.is_owned = false;
60705         jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
60706         return ret_conv;
60707 }
60708
60709 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_gossip_queries"))) TS_NodeFeatures_requires_gossip_queries(uint64_t this_arg) {
60710         LDKNodeFeatures this_arg_conv;
60711         this_arg_conv.inner = untag_ptr(this_arg);
60712         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60714         this_arg_conv.is_owned = false;
60715         jboolean ret_conv = NodeFeatures_requires_gossip_queries(&this_arg_conv);
60716         return ret_conv;
60717 }
60718
60719 void  __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_optional"))) TS_InitFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
60720         LDKInitFeatures this_arg_conv;
60721         this_arg_conv.inner = untag_ptr(this_arg);
60722         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60724         this_arg_conv.is_owned = false;
60725         InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
60726 }
60727
60728 void  __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_required"))) TS_InitFeatures_set_variable_length_onion_required(uint64_t this_arg) {
60729         LDKInitFeatures this_arg_conv;
60730         this_arg_conv.inner = untag_ptr(this_arg);
60731         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60733         this_arg_conv.is_owned = false;
60734         InitFeatures_set_variable_length_onion_required(&this_arg_conv);
60735 }
60736
60737 jboolean  __attribute__((export_name("TS_InitFeatures_supports_variable_length_onion"))) TS_InitFeatures_supports_variable_length_onion(uint64_t this_arg) {
60738         LDKInitFeatures this_arg_conv;
60739         this_arg_conv.inner = untag_ptr(this_arg);
60740         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60742         this_arg_conv.is_owned = false;
60743         jboolean ret_conv = InitFeatures_supports_variable_length_onion(&this_arg_conv);
60744         return ret_conv;
60745 }
60746
60747 void  __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_optional"))) TS_NodeFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
60748         LDKNodeFeatures this_arg_conv;
60749         this_arg_conv.inner = untag_ptr(this_arg);
60750         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60752         this_arg_conv.is_owned = false;
60753         NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
60754 }
60755
60756 void  __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_required"))) TS_NodeFeatures_set_variable_length_onion_required(uint64_t this_arg) {
60757         LDKNodeFeatures this_arg_conv;
60758         this_arg_conv.inner = untag_ptr(this_arg);
60759         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60761         this_arg_conv.is_owned = false;
60762         NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
60763 }
60764
60765 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_variable_length_onion"))) TS_NodeFeatures_supports_variable_length_onion(uint64_t this_arg) {
60766         LDKNodeFeatures this_arg_conv;
60767         this_arg_conv.inner = untag_ptr(this_arg);
60768         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60770         this_arg_conv.is_owned = false;
60771         jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
60772         return ret_conv;
60773 }
60774
60775 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_variable_length_onion_optional"))) TS_Bolt11InvoiceFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
60776         LDKBolt11InvoiceFeatures this_arg_conv;
60777         this_arg_conv.inner = untag_ptr(this_arg);
60778         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60780         this_arg_conv.is_owned = false;
60781         Bolt11InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
60782 }
60783
60784 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_variable_length_onion_required"))) TS_Bolt11InvoiceFeatures_set_variable_length_onion_required(uint64_t this_arg) {
60785         LDKBolt11InvoiceFeatures this_arg_conv;
60786         this_arg_conv.inner = untag_ptr(this_arg);
60787         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60789         this_arg_conv.is_owned = false;
60790         Bolt11InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
60791 }
60792
60793 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_supports_variable_length_onion"))) TS_Bolt11InvoiceFeatures_supports_variable_length_onion(uint64_t this_arg) {
60794         LDKBolt11InvoiceFeatures this_arg_conv;
60795         this_arg_conv.inner = untag_ptr(this_arg);
60796         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60798         this_arg_conv.is_owned = false;
60799         jboolean ret_conv = Bolt11InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
60800         return ret_conv;
60801 }
60802
60803 jboolean  __attribute__((export_name("TS_InitFeatures_requires_variable_length_onion"))) TS_InitFeatures_requires_variable_length_onion(uint64_t this_arg) {
60804         LDKInitFeatures this_arg_conv;
60805         this_arg_conv.inner = untag_ptr(this_arg);
60806         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60808         this_arg_conv.is_owned = false;
60809         jboolean ret_conv = InitFeatures_requires_variable_length_onion(&this_arg_conv);
60810         return ret_conv;
60811 }
60812
60813 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_variable_length_onion"))) TS_NodeFeatures_requires_variable_length_onion(uint64_t this_arg) {
60814         LDKNodeFeatures this_arg_conv;
60815         this_arg_conv.inner = untag_ptr(this_arg);
60816         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60818         this_arg_conv.is_owned = false;
60819         jboolean ret_conv = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
60820         return ret_conv;
60821 }
60822
60823 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_variable_length_onion"))) TS_Bolt11InvoiceFeatures_requires_variable_length_onion(uint64_t this_arg) {
60824         LDKBolt11InvoiceFeatures this_arg_conv;
60825         this_arg_conv.inner = untag_ptr(this_arg);
60826         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60828         this_arg_conv.is_owned = false;
60829         jboolean ret_conv = Bolt11InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
60830         return ret_conv;
60831 }
60832
60833 void  __attribute__((export_name("TS_InitFeatures_set_static_remote_key_optional"))) TS_InitFeatures_set_static_remote_key_optional(uint64_t this_arg) {
60834         LDKInitFeatures this_arg_conv;
60835         this_arg_conv.inner = untag_ptr(this_arg);
60836         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60838         this_arg_conv.is_owned = false;
60839         InitFeatures_set_static_remote_key_optional(&this_arg_conv);
60840 }
60841
60842 void  __attribute__((export_name("TS_InitFeatures_set_static_remote_key_required"))) TS_InitFeatures_set_static_remote_key_required(uint64_t this_arg) {
60843         LDKInitFeatures this_arg_conv;
60844         this_arg_conv.inner = untag_ptr(this_arg);
60845         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60847         this_arg_conv.is_owned = false;
60848         InitFeatures_set_static_remote_key_required(&this_arg_conv);
60849 }
60850
60851 jboolean  __attribute__((export_name("TS_InitFeatures_supports_static_remote_key"))) TS_InitFeatures_supports_static_remote_key(uint64_t this_arg) {
60852         LDKInitFeatures this_arg_conv;
60853         this_arg_conv.inner = untag_ptr(this_arg);
60854         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60856         this_arg_conv.is_owned = false;
60857         jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
60858         return ret_conv;
60859 }
60860
60861 void  __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_optional"))) TS_NodeFeatures_set_static_remote_key_optional(uint64_t this_arg) {
60862         LDKNodeFeatures this_arg_conv;
60863         this_arg_conv.inner = untag_ptr(this_arg);
60864         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60866         this_arg_conv.is_owned = false;
60867         NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
60868 }
60869
60870 void  __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_required"))) TS_NodeFeatures_set_static_remote_key_required(uint64_t this_arg) {
60871         LDKNodeFeatures this_arg_conv;
60872         this_arg_conv.inner = untag_ptr(this_arg);
60873         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60875         this_arg_conv.is_owned = false;
60876         NodeFeatures_set_static_remote_key_required(&this_arg_conv);
60877 }
60878
60879 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_static_remote_key"))) TS_NodeFeatures_supports_static_remote_key(uint64_t this_arg) {
60880         LDKNodeFeatures this_arg_conv;
60881         this_arg_conv.inner = untag_ptr(this_arg);
60882         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60884         this_arg_conv.is_owned = false;
60885         jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
60886         return ret_conv;
60887 }
60888
60889 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_optional"))) TS_ChannelTypeFeatures_set_static_remote_key_optional(uint64_t this_arg) {
60890         LDKChannelTypeFeatures this_arg_conv;
60891         this_arg_conv.inner = untag_ptr(this_arg);
60892         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60894         this_arg_conv.is_owned = false;
60895         ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
60896 }
60897
60898 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_required"))) TS_ChannelTypeFeatures_set_static_remote_key_required(uint64_t this_arg) {
60899         LDKChannelTypeFeatures this_arg_conv;
60900         this_arg_conv.inner = untag_ptr(this_arg);
60901         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60903         this_arg_conv.is_owned = false;
60904         ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
60905 }
60906
60907 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_static_remote_key"))) TS_ChannelTypeFeatures_supports_static_remote_key(uint64_t this_arg) {
60908         LDKChannelTypeFeatures this_arg_conv;
60909         this_arg_conv.inner = untag_ptr(this_arg);
60910         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60912         this_arg_conv.is_owned = false;
60913         jboolean ret_conv = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
60914         return ret_conv;
60915 }
60916
60917 jboolean  __attribute__((export_name("TS_InitFeatures_requires_static_remote_key"))) TS_InitFeatures_requires_static_remote_key(uint64_t this_arg) {
60918         LDKInitFeatures this_arg_conv;
60919         this_arg_conv.inner = untag_ptr(this_arg);
60920         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60922         this_arg_conv.is_owned = false;
60923         jboolean ret_conv = InitFeatures_requires_static_remote_key(&this_arg_conv);
60924         return ret_conv;
60925 }
60926
60927 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_static_remote_key"))) TS_NodeFeatures_requires_static_remote_key(uint64_t this_arg) {
60928         LDKNodeFeatures this_arg_conv;
60929         this_arg_conv.inner = untag_ptr(this_arg);
60930         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60932         this_arg_conv.is_owned = false;
60933         jboolean ret_conv = NodeFeatures_requires_static_remote_key(&this_arg_conv);
60934         return ret_conv;
60935 }
60936
60937 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_static_remote_key"))) TS_ChannelTypeFeatures_requires_static_remote_key(uint64_t this_arg) {
60938         LDKChannelTypeFeatures this_arg_conv;
60939         this_arg_conv.inner = untag_ptr(this_arg);
60940         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60942         this_arg_conv.is_owned = false;
60943         jboolean ret_conv = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
60944         return ret_conv;
60945 }
60946
60947 void  __attribute__((export_name("TS_InitFeatures_set_payment_secret_optional"))) TS_InitFeatures_set_payment_secret_optional(uint64_t this_arg) {
60948         LDKInitFeatures this_arg_conv;
60949         this_arg_conv.inner = untag_ptr(this_arg);
60950         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60952         this_arg_conv.is_owned = false;
60953         InitFeatures_set_payment_secret_optional(&this_arg_conv);
60954 }
60955
60956 void  __attribute__((export_name("TS_InitFeatures_set_payment_secret_required"))) TS_InitFeatures_set_payment_secret_required(uint64_t this_arg) {
60957         LDKInitFeatures this_arg_conv;
60958         this_arg_conv.inner = untag_ptr(this_arg);
60959         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60961         this_arg_conv.is_owned = false;
60962         InitFeatures_set_payment_secret_required(&this_arg_conv);
60963 }
60964
60965 jboolean  __attribute__((export_name("TS_InitFeatures_supports_payment_secret"))) TS_InitFeatures_supports_payment_secret(uint64_t this_arg) {
60966         LDKInitFeatures this_arg_conv;
60967         this_arg_conv.inner = untag_ptr(this_arg);
60968         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60970         this_arg_conv.is_owned = false;
60971         jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
60972         return ret_conv;
60973 }
60974
60975 void  __attribute__((export_name("TS_NodeFeatures_set_payment_secret_optional"))) TS_NodeFeatures_set_payment_secret_optional(uint64_t this_arg) {
60976         LDKNodeFeatures this_arg_conv;
60977         this_arg_conv.inner = untag_ptr(this_arg);
60978         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60980         this_arg_conv.is_owned = false;
60981         NodeFeatures_set_payment_secret_optional(&this_arg_conv);
60982 }
60983
60984 void  __attribute__((export_name("TS_NodeFeatures_set_payment_secret_required"))) TS_NodeFeatures_set_payment_secret_required(uint64_t this_arg) {
60985         LDKNodeFeatures this_arg_conv;
60986         this_arg_conv.inner = untag_ptr(this_arg);
60987         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60989         this_arg_conv.is_owned = false;
60990         NodeFeatures_set_payment_secret_required(&this_arg_conv);
60991 }
60992
60993 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_payment_secret"))) TS_NodeFeatures_supports_payment_secret(uint64_t this_arg) {
60994         LDKNodeFeatures this_arg_conv;
60995         this_arg_conv.inner = untag_ptr(this_arg);
60996         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60998         this_arg_conv.is_owned = false;
60999         jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
61000         return ret_conv;
61001 }
61002
61003 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_payment_secret_optional"))) TS_Bolt11InvoiceFeatures_set_payment_secret_optional(uint64_t this_arg) {
61004         LDKBolt11InvoiceFeatures this_arg_conv;
61005         this_arg_conv.inner = untag_ptr(this_arg);
61006         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61008         this_arg_conv.is_owned = false;
61009         Bolt11InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
61010 }
61011
61012 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_payment_secret_required"))) TS_Bolt11InvoiceFeatures_set_payment_secret_required(uint64_t this_arg) {
61013         LDKBolt11InvoiceFeatures this_arg_conv;
61014         this_arg_conv.inner = untag_ptr(this_arg);
61015         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61017         this_arg_conv.is_owned = false;
61018         Bolt11InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
61019 }
61020
61021 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_supports_payment_secret"))) TS_Bolt11InvoiceFeatures_supports_payment_secret(uint64_t this_arg) {
61022         LDKBolt11InvoiceFeatures this_arg_conv;
61023         this_arg_conv.inner = untag_ptr(this_arg);
61024         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61026         this_arg_conv.is_owned = false;
61027         jboolean ret_conv = Bolt11InvoiceFeatures_supports_payment_secret(&this_arg_conv);
61028         return ret_conv;
61029 }
61030
61031 jboolean  __attribute__((export_name("TS_InitFeatures_requires_payment_secret"))) TS_InitFeatures_requires_payment_secret(uint64_t this_arg) {
61032         LDKInitFeatures this_arg_conv;
61033         this_arg_conv.inner = untag_ptr(this_arg);
61034         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61036         this_arg_conv.is_owned = false;
61037         jboolean ret_conv = InitFeatures_requires_payment_secret(&this_arg_conv);
61038         return ret_conv;
61039 }
61040
61041 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_payment_secret"))) TS_NodeFeatures_requires_payment_secret(uint64_t this_arg) {
61042         LDKNodeFeatures this_arg_conv;
61043         this_arg_conv.inner = untag_ptr(this_arg);
61044         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61046         this_arg_conv.is_owned = false;
61047         jboolean ret_conv = NodeFeatures_requires_payment_secret(&this_arg_conv);
61048         return ret_conv;
61049 }
61050
61051 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_payment_secret"))) TS_Bolt11InvoiceFeatures_requires_payment_secret(uint64_t this_arg) {
61052         LDKBolt11InvoiceFeatures this_arg_conv;
61053         this_arg_conv.inner = untag_ptr(this_arg);
61054         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61056         this_arg_conv.is_owned = false;
61057         jboolean ret_conv = Bolt11InvoiceFeatures_requires_payment_secret(&this_arg_conv);
61058         return ret_conv;
61059 }
61060
61061 void  __attribute__((export_name("TS_InitFeatures_set_basic_mpp_optional"))) TS_InitFeatures_set_basic_mpp_optional(uint64_t this_arg) {
61062         LDKInitFeatures this_arg_conv;
61063         this_arg_conv.inner = untag_ptr(this_arg);
61064         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61066         this_arg_conv.is_owned = false;
61067         InitFeatures_set_basic_mpp_optional(&this_arg_conv);
61068 }
61069
61070 void  __attribute__((export_name("TS_InitFeatures_set_basic_mpp_required"))) TS_InitFeatures_set_basic_mpp_required(uint64_t this_arg) {
61071         LDKInitFeatures this_arg_conv;
61072         this_arg_conv.inner = untag_ptr(this_arg);
61073         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61075         this_arg_conv.is_owned = false;
61076         InitFeatures_set_basic_mpp_required(&this_arg_conv);
61077 }
61078
61079 jboolean  __attribute__((export_name("TS_InitFeatures_supports_basic_mpp"))) TS_InitFeatures_supports_basic_mpp(uint64_t this_arg) {
61080         LDKInitFeatures this_arg_conv;
61081         this_arg_conv.inner = untag_ptr(this_arg);
61082         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61084         this_arg_conv.is_owned = false;
61085         jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
61086         return ret_conv;
61087 }
61088
61089 void  __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_optional"))) TS_NodeFeatures_set_basic_mpp_optional(uint64_t this_arg) {
61090         LDKNodeFeatures this_arg_conv;
61091         this_arg_conv.inner = untag_ptr(this_arg);
61092         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61094         this_arg_conv.is_owned = false;
61095         NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
61096 }
61097
61098 void  __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_required"))) TS_NodeFeatures_set_basic_mpp_required(uint64_t this_arg) {
61099         LDKNodeFeatures this_arg_conv;
61100         this_arg_conv.inner = untag_ptr(this_arg);
61101         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61103         this_arg_conv.is_owned = false;
61104         NodeFeatures_set_basic_mpp_required(&this_arg_conv);
61105 }
61106
61107 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_basic_mpp"))) TS_NodeFeatures_supports_basic_mpp(uint64_t this_arg) {
61108         LDKNodeFeatures this_arg_conv;
61109         this_arg_conv.inner = untag_ptr(this_arg);
61110         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61112         this_arg_conv.is_owned = false;
61113         jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
61114         return ret_conv;
61115 }
61116
61117 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_basic_mpp_optional"))) TS_Bolt11InvoiceFeatures_set_basic_mpp_optional(uint64_t this_arg) {
61118         LDKBolt11InvoiceFeatures this_arg_conv;
61119         this_arg_conv.inner = untag_ptr(this_arg);
61120         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61122         this_arg_conv.is_owned = false;
61123         Bolt11InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
61124 }
61125
61126 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_basic_mpp_required"))) TS_Bolt11InvoiceFeatures_set_basic_mpp_required(uint64_t this_arg) {
61127         LDKBolt11InvoiceFeatures this_arg_conv;
61128         this_arg_conv.inner = untag_ptr(this_arg);
61129         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61131         this_arg_conv.is_owned = false;
61132         Bolt11InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
61133 }
61134
61135 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_supports_basic_mpp"))) TS_Bolt11InvoiceFeatures_supports_basic_mpp(uint64_t this_arg) {
61136         LDKBolt11InvoiceFeatures this_arg_conv;
61137         this_arg_conv.inner = untag_ptr(this_arg);
61138         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61140         this_arg_conv.is_owned = false;
61141         jboolean ret_conv = Bolt11InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
61142         return ret_conv;
61143 }
61144
61145 void  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_basic_mpp_optional"))) TS_Bolt12InvoiceFeatures_set_basic_mpp_optional(uint64_t this_arg) {
61146         LDKBolt12InvoiceFeatures this_arg_conv;
61147         this_arg_conv.inner = untag_ptr(this_arg);
61148         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61150         this_arg_conv.is_owned = false;
61151         Bolt12InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
61152 }
61153
61154 void  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_basic_mpp_required"))) TS_Bolt12InvoiceFeatures_set_basic_mpp_required(uint64_t this_arg) {
61155         LDKBolt12InvoiceFeatures this_arg_conv;
61156         this_arg_conv.inner = untag_ptr(this_arg);
61157         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61159         this_arg_conv.is_owned = false;
61160         Bolt12InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
61161 }
61162
61163 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_supports_basic_mpp"))) TS_Bolt12InvoiceFeatures_supports_basic_mpp(uint64_t this_arg) {
61164         LDKBolt12InvoiceFeatures this_arg_conv;
61165         this_arg_conv.inner = untag_ptr(this_arg);
61166         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61168         this_arg_conv.is_owned = false;
61169         jboolean ret_conv = Bolt12InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
61170         return ret_conv;
61171 }
61172
61173 jboolean  __attribute__((export_name("TS_InitFeatures_requires_basic_mpp"))) TS_InitFeatures_requires_basic_mpp(uint64_t this_arg) {
61174         LDKInitFeatures 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         jboolean ret_conv = InitFeatures_requires_basic_mpp(&this_arg_conv);
61180         return ret_conv;
61181 }
61182
61183 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_basic_mpp"))) TS_NodeFeatures_requires_basic_mpp(uint64_t this_arg) {
61184         LDKNodeFeatures this_arg_conv;
61185         this_arg_conv.inner = untag_ptr(this_arg);
61186         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61188         this_arg_conv.is_owned = false;
61189         jboolean ret_conv = NodeFeatures_requires_basic_mpp(&this_arg_conv);
61190         return ret_conv;
61191 }
61192
61193 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_basic_mpp"))) TS_Bolt11InvoiceFeatures_requires_basic_mpp(uint64_t this_arg) {
61194         LDKBolt11InvoiceFeatures this_arg_conv;
61195         this_arg_conv.inner = untag_ptr(this_arg);
61196         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61198         this_arg_conv.is_owned = false;
61199         jboolean ret_conv = Bolt11InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
61200         return ret_conv;
61201 }
61202
61203 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_requires_basic_mpp"))) TS_Bolt12InvoiceFeatures_requires_basic_mpp(uint64_t this_arg) {
61204         LDKBolt12InvoiceFeatures this_arg_conv;
61205         this_arg_conv.inner = untag_ptr(this_arg);
61206         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61208         this_arg_conv.is_owned = false;
61209         jboolean ret_conv = Bolt12InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
61210         return ret_conv;
61211 }
61212
61213 void  __attribute__((export_name("TS_InitFeatures_set_wumbo_optional"))) TS_InitFeatures_set_wumbo_optional(uint64_t this_arg) {
61214         LDKInitFeatures this_arg_conv;
61215         this_arg_conv.inner = untag_ptr(this_arg);
61216         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61218         this_arg_conv.is_owned = false;
61219         InitFeatures_set_wumbo_optional(&this_arg_conv);
61220 }
61221
61222 void  __attribute__((export_name("TS_InitFeatures_set_wumbo_required"))) TS_InitFeatures_set_wumbo_required(uint64_t this_arg) {
61223         LDKInitFeatures this_arg_conv;
61224         this_arg_conv.inner = untag_ptr(this_arg);
61225         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61227         this_arg_conv.is_owned = false;
61228         InitFeatures_set_wumbo_required(&this_arg_conv);
61229 }
61230
61231 jboolean  __attribute__((export_name("TS_InitFeatures_supports_wumbo"))) TS_InitFeatures_supports_wumbo(uint64_t this_arg) {
61232         LDKInitFeatures this_arg_conv;
61233         this_arg_conv.inner = untag_ptr(this_arg);
61234         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61236         this_arg_conv.is_owned = false;
61237         jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
61238         return ret_conv;
61239 }
61240
61241 void  __attribute__((export_name("TS_NodeFeatures_set_wumbo_optional"))) TS_NodeFeatures_set_wumbo_optional(uint64_t this_arg) {
61242         LDKNodeFeatures this_arg_conv;
61243         this_arg_conv.inner = untag_ptr(this_arg);
61244         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61246         this_arg_conv.is_owned = false;
61247         NodeFeatures_set_wumbo_optional(&this_arg_conv);
61248 }
61249
61250 void  __attribute__((export_name("TS_NodeFeatures_set_wumbo_required"))) TS_NodeFeatures_set_wumbo_required(uint64_t this_arg) {
61251         LDKNodeFeatures 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         NodeFeatures_set_wumbo_required(&this_arg_conv);
61257 }
61258
61259 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_wumbo"))) TS_NodeFeatures_supports_wumbo(uint64_t this_arg) {
61260         LDKNodeFeatures this_arg_conv;
61261         this_arg_conv.inner = untag_ptr(this_arg);
61262         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61264         this_arg_conv.is_owned = false;
61265         jboolean ret_conv = NodeFeatures_supports_wumbo(&this_arg_conv);
61266         return ret_conv;
61267 }
61268
61269 jboolean  __attribute__((export_name("TS_InitFeatures_requires_wumbo"))) TS_InitFeatures_requires_wumbo(uint64_t this_arg) {
61270         LDKInitFeatures 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         jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
61276         return ret_conv;
61277 }
61278
61279 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_wumbo"))) TS_NodeFeatures_requires_wumbo(uint64_t this_arg) {
61280         LDKNodeFeatures this_arg_conv;
61281         this_arg_conv.inner = untag_ptr(this_arg);
61282         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61284         this_arg_conv.is_owned = false;
61285         jboolean ret_conv = NodeFeatures_requires_wumbo(&this_arg_conv);
61286         return ret_conv;
61287 }
61288
61289 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) {
61290         LDKInitFeatures this_arg_conv;
61291         this_arg_conv.inner = untag_ptr(this_arg);
61292         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61294         this_arg_conv.is_owned = false;
61295         InitFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
61296 }
61297
61298 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) {
61299         LDKInitFeatures this_arg_conv;
61300         this_arg_conv.inner = untag_ptr(this_arg);
61301         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61303         this_arg_conv.is_owned = false;
61304         InitFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
61305 }
61306
61307 jboolean  __attribute__((export_name("TS_InitFeatures_supports_anchors_nonzero_fee_htlc_tx"))) TS_InitFeatures_supports_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
61308         LDKInitFeatures this_arg_conv;
61309         this_arg_conv.inner = untag_ptr(this_arg);
61310         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61312         this_arg_conv.is_owned = false;
61313         jboolean ret_conv = InitFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
61314         return ret_conv;
61315 }
61316
61317 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) {
61318         LDKNodeFeatures this_arg_conv;
61319         this_arg_conv.inner = untag_ptr(this_arg);
61320         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61322         this_arg_conv.is_owned = false;
61323         NodeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
61324 }
61325
61326 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) {
61327         LDKNodeFeatures this_arg_conv;
61328         this_arg_conv.inner = untag_ptr(this_arg);
61329         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61331         this_arg_conv.is_owned = false;
61332         NodeFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
61333 }
61334
61335 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_anchors_nonzero_fee_htlc_tx"))) TS_NodeFeatures_supports_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
61336         LDKNodeFeatures this_arg_conv;
61337         this_arg_conv.inner = untag_ptr(this_arg);
61338         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61340         this_arg_conv.is_owned = false;
61341         jboolean ret_conv = NodeFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
61342         return ret_conv;
61343 }
61344
61345 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) {
61346         LDKChannelTypeFeatures this_arg_conv;
61347         this_arg_conv.inner = untag_ptr(this_arg);
61348         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61350         this_arg_conv.is_owned = false;
61351         ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
61352 }
61353
61354 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) {
61355         LDKChannelTypeFeatures this_arg_conv;
61356         this_arg_conv.inner = untag_ptr(this_arg);
61357         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61359         this_arg_conv.is_owned = false;
61360         ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
61361 }
61362
61363 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx"))) TS_ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
61364         LDKChannelTypeFeatures this_arg_conv;
61365         this_arg_conv.inner = untag_ptr(this_arg);
61366         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61368         this_arg_conv.is_owned = false;
61369         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
61370         return ret_conv;
61371 }
61372
61373 jboolean  __attribute__((export_name("TS_InitFeatures_requires_anchors_nonzero_fee_htlc_tx"))) TS_InitFeatures_requires_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
61374         LDKInitFeatures this_arg_conv;
61375         this_arg_conv.inner = untag_ptr(this_arg);
61376         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61378         this_arg_conv.is_owned = false;
61379         jboolean ret_conv = InitFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
61380         return ret_conv;
61381 }
61382
61383 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_anchors_nonzero_fee_htlc_tx"))) TS_NodeFeatures_requires_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
61384         LDKNodeFeatures this_arg_conv;
61385         this_arg_conv.inner = untag_ptr(this_arg);
61386         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61388         this_arg_conv.is_owned = false;
61389         jboolean ret_conv = NodeFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
61390         return ret_conv;
61391 }
61392
61393 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx"))) TS_ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
61394         LDKChannelTypeFeatures 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         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
61400         return ret_conv;
61401 }
61402
61403 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) {
61404         LDKInitFeatures this_arg_conv;
61405         this_arg_conv.inner = untag_ptr(this_arg);
61406         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61408         this_arg_conv.is_owned = false;
61409         InitFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
61410 }
61411
61412 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) {
61413         LDKInitFeatures this_arg_conv;
61414         this_arg_conv.inner = untag_ptr(this_arg);
61415         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61417         this_arg_conv.is_owned = false;
61418         InitFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
61419 }
61420
61421 jboolean  __attribute__((export_name("TS_InitFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_InitFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
61422         LDKInitFeatures this_arg_conv;
61423         this_arg_conv.inner = untag_ptr(this_arg);
61424         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61426         this_arg_conv.is_owned = false;
61427         jboolean ret_conv = InitFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
61428         return ret_conv;
61429 }
61430
61431 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) {
61432         LDKNodeFeatures this_arg_conv;
61433         this_arg_conv.inner = untag_ptr(this_arg);
61434         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61436         this_arg_conv.is_owned = false;
61437         NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
61438 }
61439
61440 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) {
61441         LDKNodeFeatures this_arg_conv;
61442         this_arg_conv.inner = untag_ptr(this_arg);
61443         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61445         this_arg_conv.is_owned = false;
61446         NodeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
61447 }
61448
61449 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_NodeFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
61450         LDKNodeFeatures this_arg_conv;
61451         this_arg_conv.inner = untag_ptr(this_arg);
61452         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61454         this_arg_conv.is_owned = false;
61455         jboolean ret_conv = NodeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
61456         return ret_conv;
61457 }
61458
61459 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) {
61460         LDKChannelTypeFeatures 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         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
61466 }
61467
61468 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) {
61469         LDKChannelTypeFeatures this_arg_conv;
61470         this_arg_conv.inner = untag_ptr(this_arg);
61471         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61473         this_arg_conv.is_owned = false;
61474         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
61475 }
61476
61477 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
61478         LDKChannelTypeFeatures this_arg_conv;
61479         this_arg_conv.inner = untag_ptr(this_arg);
61480         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61482         this_arg_conv.is_owned = false;
61483         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
61484         return ret_conv;
61485 }
61486
61487 jboolean  __attribute__((export_name("TS_InitFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_InitFeatures_requires_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
61488         LDKInitFeatures this_arg_conv;
61489         this_arg_conv.inner = untag_ptr(this_arg);
61490         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61492         this_arg_conv.is_owned = false;
61493         jboolean ret_conv = InitFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
61494         return ret_conv;
61495 }
61496
61497 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_NodeFeatures_requires_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
61498         LDKNodeFeatures this_arg_conv;
61499         this_arg_conv.inner = untag_ptr(this_arg);
61500         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61502         this_arg_conv.is_owned = false;
61503         jboolean ret_conv = NodeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
61504         return ret_conv;
61505 }
61506
61507 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
61508         LDKChannelTypeFeatures this_arg_conv;
61509         this_arg_conv.inner = untag_ptr(this_arg);
61510         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61512         this_arg_conv.is_owned = false;
61513         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
61514         return ret_conv;
61515 }
61516
61517 void  __attribute__((export_name("TS_InitFeatures_set_route_blinding_optional"))) TS_InitFeatures_set_route_blinding_optional(uint64_t this_arg) {
61518         LDKInitFeatures this_arg_conv;
61519         this_arg_conv.inner = untag_ptr(this_arg);
61520         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61522         this_arg_conv.is_owned = false;
61523         InitFeatures_set_route_blinding_optional(&this_arg_conv);
61524 }
61525
61526 void  __attribute__((export_name("TS_InitFeatures_set_route_blinding_required"))) TS_InitFeatures_set_route_blinding_required(uint64_t this_arg) {
61527         LDKInitFeatures this_arg_conv;
61528         this_arg_conv.inner = untag_ptr(this_arg);
61529         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61531         this_arg_conv.is_owned = false;
61532         InitFeatures_set_route_blinding_required(&this_arg_conv);
61533 }
61534
61535 jboolean  __attribute__((export_name("TS_InitFeatures_supports_route_blinding"))) TS_InitFeatures_supports_route_blinding(uint64_t this_arg) {
61536         LDKInitFeatures this_arg_conv;
61537         this_arg_conv.inner = untag_ptr(this_arg);
61538         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61540         this_arg_conv.is_owned = false;
61541         jboolean ret_conv = InitFeatures_supports_route_blinding(&this_arg_conv);
61542         return ret_conv;
61543 }
61544
61545 void  __attribute__((export_name("TS_NodeFeatures_set_route_blinding_optional"))) TS_NodeFeatures_set_route_blinding_optional(uint64_t this_arg) {
61546         LDKNodeFeatures this_arg_conv;
61547         this_arg_conv.inner = untag_ptr(this_arg);
61548         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61550         this_arg_conv.is_owned = false;
61551         NodeFeatures_set_route_blinding_optional(&this_arg_conv);
61552 }
61553
61554 void  __attribute__((export_name("TS_NodeFeatures_set_route_blinding_required"))) TS_NodeFeatures_set_route_blinding_required(uint64_t this_arg) {
61555         LDKNodeFeatures this_arg_conv;
61556         this_arg_conv.inner = untag_ptr(this_arg);
61557         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61559         this_arg_conv.is_owned = false;
61560         NodeFeatures_set_route_blinding_required(&this_arg_conv);
61561 }
61562
61563 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_route_blinding"))) TS_NodeFeatures_supports_route_blinding(uint64_t this_arg) {
61564         LDKNodeFeatures this_arg_conv;
61565         this_arg_conv.inner = untag_ptr(this_arg);
61566         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61568         this_arg_conv.is_owned = false;
61569         jboolean ret_conv = NodeFeatures_supports_route_blinding(&this_arg_conv);
61570         return ret_conv;
61571 }
61572
61573 jboolean  __attribute__((export_name("TS_InitFeatures_requires_route_blinding"))) TS_InitFeatures_requires_route_blinding(uint64_t this_arg) {
61574         LDKInitFeatures this_arg_conv;
61575         this_arg_conv.inner = untag_ptr(this_arg);
61576         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61578         this_arg_conv.is_owned = false;
61579         jboolean ret_conv = InitFeatures_requires_route_blinding(&this_arg_conv);
61580         return ret_conv;
61581 }
61582
61583 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_route_blinding"))) TS_NodeFeatures_requires_route_blinding(uint64_t this_arg) {
61584         LDKNodeFeatures this_arg_conv;
61585         this_arg_conv.inner = untag_ptr(this_arg);
61586         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61588         this_arg_conv.is_owned = false;
61589         jboolean ret_conv = NodeFeatures_requires_route_blinding(&this_arg_conv);
61590         return ret_conv;
61591 }
61592
61593 void  __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_optional"))) TS_InitFeatures_set_shutdown_any_segwit_optional(uint64_t this_arg) {
61594         LDKInitFeatures this_arg_conv;
61595         this_arg_conv.inner = untag_ptr(this_arg);
61596         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61598         this_arg_conv.is_owned = false;
61599         InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
61600 }
61601
61602 void  __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_required"))) TS_InitFeatures_set_shutdown_any_segwit_required(uint64_t this_arg) {
61603         LDKInitFeatures 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         InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
61609 }
61610
61611 jboolean  __attribute__((export_name("TS_InitFeatures_supports_shutdown_anysegwit"))) TS_InitFeatures_supports_shutdown_anysegwit(uint64_t this_arg) {
61612         LDKInitFeatures this_arg_conv;
61613         this_arg_conv.inner = untag_ptr(this_arg);
61614         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61616         this_arg_conv.is_owned = false;
61617         jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
61618         return ret_conv;
61619 }
61620
61621 void  __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_optional"))) TS_NodeFeatures_set_shutdown_any_segwit_optional(uint64_t this_arg) {
61622         LDKNodeFeatures this_arg_conv;
61623         this_arg_conv.inner = untag_ptr(this_arg);
61624         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61626         this_arg_conv.is_owned = false;
61627         NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
61628 }
61629
61630 void  __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_required"))) TS_NodeFeatures_set_shutdown_any_segwit_required(uint64_t this_arg) {
61631         LDKNodeFeatures this_arg_conv;
61632         this_arg_conv.inner = untag_ptr(this_arg);
61633         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61635         this_arg_conv.is_owned = false;
61636         NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
61637 }
61638
61639 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_shutdown_anysegwit"))) TS_NodeFeatures_supports_shutdown_anysegwit(uint64_t this_arg) {
61640         LDKNodeFeatures this_arg_conv;
61641         this_arg_conv.inner = untag_ptr(this_arg);
61642         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61644         this_arg_conv.is_owned = false;
61645         jboolean ret_conv = NodeFeatures_supports_shutdown_anysegwit(&this_arg_conv);
61646         return ret_conv;
61647 }
61648
61649 jboolean  __attribute__((export_name("TS_InitFeatures_requires_shutdown_anysegwit"))) TS_InitFeatures_requires_shutdown_anysegwit(uint64_t this_arg) {
61650         LDKInitFeatures this_arg_conv;
61651         this_arg_conv.inner = untag_ptr(this_arg);
61652         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61654         this_arg_conv.is_owned = false;
61655         jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
61656         return ret_conv;
61657 }
61658
61659 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_shutdown_anysegwit"))) TS_NodeFeatures_requires_shutdown_anysegwit(uint64_t this_arg) {
61660         LDKNodeFeatures this_arg_conv;
61661         this_arg_conv.inner = untag_ptr(this_arg);
61662         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61664         this_arg_conv.is_owned = false;
61665         jboolean ret_conv = NodeFeatures_requires_shutdown_anysegwit(&this_arg_conv);
61666         return ret_conv;
61667 }
61668
61669 void  __attribute__((export_name("TS_InitFeatures_set_taproot_optional"))) TS_InitFeatures_set_taproot_optional(uint64_t this_arg) {
61670         LDKInitFeatures this_arg_conv;
61671         this_arg_conv.inner = untag_ptr(this_arg);
61672         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61674         this_arg_conv.is_owned = false;
61675         InitFeatures_set_taproot_optional(&this_arg_conv);
61676 }
61677
61678 void  __attribute__((export_name("TS_InitFeatures_set_taproot_required"))) TS_InitFeatures_set_taproot_required(uint64_t this_arg) {
61679         LDKInitFeatures this_arg_conv;
61680         this_arg_conv.inner = untag_ptr(this_arg);
61681         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61683         this_arg_conv.is_owned = false;
61684         InitFeatures_set_taproot_required(&this_arg_conv);
61685 }
61686
61687 jboolean  __attribute__((export_name("TS_InitFeatures_supports_taproot"))) TS_InitFeatures_supports_taproot(uint64_t this_arg) {
61688         LDKInitFeatures this_arg_conv;
61689         this_arg_conv.inner = untag_ptr(this_arg);
61690         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61692         this_arg_conv.is_owned = false;
61693         jboolean ret_conv = InitFeatures_supports_taproot(&this_arg_conv);
61694         return ret_conv;
61695 }
61696
61697 void  __attribute__((export_name("TS_NodeFeatures_set_taproot_optional"))) TS_NodeFeatures_set_taproot_optional(uint64_t this_arg) {
61698         LDKNodeFeatures this_arg_conv;
61699         this_arg_conv.inner = untag_ptr(this_arg);
61700         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61702         this_arg_conv.is_owned = false;
61703         NodeFeatures_set_taproot_optional(&this_arg_conv);
61704 }
61705
61706 void  __attribute__((export_name("TS_NodeFeatures_set_taproot_required"))) TS_NodeFeatures_set_taproot_required(uint64_t this_arg) {
61707         LDKNodeFeatures this_arg_conv;
61708         this_arg_conv.inner = untag_ptr(this_arg);
61709         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61711         this_arg_conv.is_owned = false;
61712         NodeFeatures_set_taproot_required(&this_arg_conv);
61713 }
61714
61715 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_taproot"))) TS_NodeFeatures_supports_taproot(uint64_t this_arg) {
61716         LDKNodeFeatures this_arg_conv;
61717         this_arg_conv.inner = untag_ptr(this_arg);
61718         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61720         this_arg_conv.is_owned = false;
61721         jboolean ret_conv = NodeFeatures_supports_taproot(&this_arg_conv);
61722         return ret_conv;
61723 }
61724
61725 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_taproot_optional"))) TS_ChannelTypeFeatures_set_taproot_optional(uint64_t this_arg) {
61726         LDKChannelTypeFeatures this_arg_conv;
61727         this_arg_conv.inner = untag_ptr(this_arg);
61728         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61730         this_arg_conv.is_owned = false;
61731         ChannelTypeFeatures_set_taproot_optional(&this_arg_conv);
61732 }
61733
61734 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_taproot_required"))) TS_ChannelTypeFeatures_set_taproot_required(uint64_t this_arg) {
61735         LDKChannelTypeFeatures this_arg_conv;
61736         this_arg_conv.inner = untag_ptr(this_arg);
61737         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61739         this_arg_conv.is_owned = false;
61740         ChannelTypeFeatures_set_taproot_required(&this_arg_conv);
61741 }
61742
61743 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_taproot"))) TS_ChannelTypeFeatures_supports_taproot(uint64_t this_arg) {
61744         LDKChannelTypeFeatures this_arg_conv;
61745         this_arg_conv.inner = untag_ptr(this_arg);
61746         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61748         this_arg_conv.is_owned = false;
61749         jboolean ret_conv = ChannelTypeFeatures_supports_taproot(&this_arg_conv);
61750         return ret_conv;
61751 }
61752
61753 jboolean  __attribute__((export_name("TS_InitFeatures_requires_taproot"))) TS_InitFeatures_requires_taproot(uint64_t this_arg) {
61754         LDKInitFeatures this_arg_conv;
61755         this_arg_conv.inner = untag_ptr(this_arg);
61756         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61758         this_arg_conv.is_owned = false;
61759         jboolean ret_conv = InitFeatures_requires_taproot(&this_arg_conv);
61760         return ret_conv;
61761 }
61762
61763 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_taproot"))) TS_NodeFeatures_requires_taproot(uint64_t this_arg) {
61764         LDKNodeFeatures this_arg_conv;
61765         this_arg_conv.inner = untag_ptr(this_arg);
61766         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61768         this_arg_conv.is_owned = false;
61769         jboolean ret_conv = NodeFeatures_requires_taproot(&this_arg_conv);
61770         return ret_conv;
61771 }
61772
61773 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_taproot"))) TS_ChannelTypeFeatures_requires_taproot(uint64_t this_arg) {
61774         LDKChannelTypeFeatures this_arg_conv;
61775         this_arg_conv.inner = untag_ptr(this_arg);
61776         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61778         this_arg_conv.is_owned = false;
61779         jboolean ret_conv = ChannelTypeFeatures_requires_taproot(&this_arg_conv);
61780         return ret_conv;
61781 }
61782
61783 void  __attribute__((export_name("TS_InitFeatures_set_onion_messages_optional"))) TS_InitFeatures_set_onion_messages_optional(uint64_t this_arg) {
61784         LDKInitFeatures this_arg_conv;
61785         this_arg_conv.inner = untag_ptr(this_arg);
61786         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61788         this_arg_conv.is_owned = false;
61789         InitFeatures_set_onion_messages_optional(&this_arg_conv);
61790 }
61791
61792 void  __attribute__((export_name("TS_InitFeatures_set_onion_messages_required"))) TS_InitFeatures_set_onion_messages_required(uint64_t this_arg) {
61793         LDKInitFeatures this_arg_conv;
61794         this_arg_conv.inner = untag_ptr(this_arg);
61795         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61797         this_arg_conv.is_owned = false;
61798         InitFeatures_set_onion_messages_required(&this_arg_conv);
61799 }
61800
61801 jboolean  __attribute__((export_name("TS_InitFeatures_supports_onion_messages"))) TS_InitFeatures_supports_onion_messages(uint64_t this_arg) {
61802         LDKInitFeatures this_arg_conv;
61803         this_arg_conv.inner = untag_ptr(this_arg);
61804         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61806         this_arg_conv.is_owned = false;
61807         jboolean ret_conv = InitFeatures_supports_onion_messages(&this_arg_conv);
61808         return ret_conv;
61809 }
61810
61811 void  __attribute__((export_name("TS_NodeFeatures_set_onion_messages_optional"))) TS_NodeFeatures_set_onion_messages_optional(uint64_t this_arg) {
61812         LDKNodeFeatures this_arg_conv;
61813         this_arg_conv.inner = untag_ptr(this_arg);
61814         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61816         this_arg_conv.is_owned = false;
61817         NodeFeatures_set_onion_messages_optional(&this_arg_conv);
61818 }
61819
61820 void  __attribute__((export_name("TS_NodeFeatures_set_onion_messages_required"))) TS_NodeFeatures_set_onion_messages_required(uint64_t this_arg) {
61821         LDKNodeFeatures this_arg_conv;
61822         this_arg_conv.inner = untag_ptr(this_arg);
61823         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61825         this_arg_conv.is_owned = false;
61826         NodeFeatures_set_onion_messages_required(&this_arg_conv);
61827 }
61828
61829 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_onion_messages"))) TS_NodeFeatures_supports_onion_messages(uint64_t this_arg) {
61830         LDKNodeFeatures this_arg_conv;
61831         this_arg_conv.inner = untag_ptr(this_arg);
61832         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61834         this_arg_conv.is_owned = false;
61835         jboolean ret_conv = NodeFeatures_supports_onion_messages(&this_arg_conv);
61836         return ret_conv;
61837 }
61838
61839 jboolean  __attribute__((export_name("TS_InitFeatures_requires_onion_messages"))) TS_InitFeatures_requires_onion_messages(uint64_t this_arg) {
61840         LDKInitFeatures this_arg_conv;
61841         this_arg_conv.inner = untag_ptr(this_arg);
61842         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61844         this_arg_conv.is_owned = false;
61845         jboolean ret_conv = InitFeatures_requires_onion_messages(&this_arg_conv);
61846         return ret_conv;
61847 }
61848
61849 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_onion_messages"))) TS_NodeFeatures_requires_onion_messages(uint64_t this_arg) {
61850         LDKNodeFeatures this_arg_conv;
61851         this_arg_conv.inner = untag_ptr(this_arg);
61852         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61854         this_arg_conv.is_owned = false;
61855         jboolean ret_conv = NodeFeatures_requires_onion_messages(&this_arg_conv);
61856         return ret_conv;
61857 }
61858
61859 void  __attribute__((export_name("TS_InitFeatures_set_channel_type_optional"))) TS_InitFeatures_set_channel_type_optional(uint64_t this_arg) {
61860         LDKInitFeatures this_arg_conv;
61861         this_arg_conv.inner = untag_ptr(this_arg);
61862         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61864         this_arg_conv.is_owned = false;
61865         InitFeatures_set_channel_type_optional(&this_arg_conv);
61866 }
61867
61868 void  __attribute__((export_name("TS_InitFeatures_set_channel_type_required"))) TS_InitFeatures_set_channel_type_required(uint64_t this_arg) {
61869         LDKInitFeatures this_arg_conv;
61870         this_arg_conv.inner = untag_ptr(this_arg);
61871         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61873         this_arg_conv.is_owned = false;
61874         InitFeatures_set_channel_type_required(&this_arg_conv);
61875 }
61876
61877 jboolean  __attribute__((export_name("TS_InitFeatures_supports_channel_type"))) TS_InitFeatures_supports_channel_type(uint64_t this_arg) {
61878         LDKInitFeatures this_arg_conv;
61879         this_arg_conv.inner = untag_ptr(this_arg);
61880         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61882         this_arg_conv.is_owned = false;
61883         jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
61884         return ret_conv;
61885 }
61886
61887 void  __attribute__((export_name("TS_NodeFeatures_set_channel_type_optional"))) TS_NodeFeatures_set_channel_type_optional(uint64_t this_arg) {
61888         LDKNodeFeatures this_arg_conv;
61889         this_arg_conv.inner = untag_ptr(this_arg);
61890         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61892         this_arg_conv.is_owned = false;
61893         NodeFeatures_set_channel_type_optional(&this_arg_conv);
61894 }
61895
61896 void  __attribute__((export_name("TS_NodeFeatures_set_channel_type_required"))) TS_NodeFeatures_set_channel_type_required(uint64_t this_arg) {
61897         LDKNodeFeatures this_arg_conv;
61898         this_arg_conv.inner = untag_ptr(this_arg);
61899         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61901         this_arg_conv.is_owned = false;
61902         NodeFeatures_set_channel_type_required(&this_arg_conv);
61903 }
61904
61905 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_channel_type"))) TS_NodeFeatures_supports_channel_type(uint64_t this_arg) {
61906         LDKNodeFeatures this_arg_conv;
61907         this_arg_conv.inner = untag_ptr(this_arg);
61908         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61910         this_arg_conv.is_owned = false;
61911         jboolean ret_conv = NodeFeatures_supports_channel_type(&this_arg_conv);
61912         return ret_conv;
61913 }
61914
61915 jboolean  __attribute__((export_name("TS_InitFeatures_requires_channel_type"))) TS_InitFeatures_requires_channel_type(uint64_t this_arg) {
61916         LDKInitFeatures this_arg_conv;
61917         this_arg_conv.inner = untag_ptr(this_arg);
61918         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61920         this_arg_conv.is_owned = false;
61921         jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
61922         return ret_conv;
61923 }
61924
61925 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_channel_type"))) TS_NodeFeatures_requires_channel_type(uint64_t this_arg) {
61926         LDKNodeFeatures this_arg_conv;
61927         this_arg_conv.inner = untag_ptr(this_arg);
61928         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61930         this_arg_conv.is_owned = false;
61931         jboolean ret_conv = NodeFeatures_requires_channel_type(&this_arg_conv);
61932         return ret_conv;
61933 }
61934
61935 void  __attribute__((export_name("TS_InitFeatures_set_scid_privacy_optional"))) TS_InitFeatures_set_scid_privacy_optional(uint64_t this_arg) {
61936         LDKInitFeatures this_arg_conv;
61937         this_arg_conv.inner = untag_ptr(this_arg);
61938         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61940         this_arg_conv.is_owned = false;
61941         InitFeatures_set_scid_privacy_optional(&this_arg_conv);
61942 }
61943
61944 void  __attribute__((export_name("TS_InitFeatures_set_scid_privacy_required"))) TS_InitFeatures_set_scid_privacy_required(uint64_t this_arg) {
61945         LDKInitFeatures this_arg_conv;
61946         this_arg_conv.inner = untag_ptr(this_arg);
61947         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61949         this_arg_conv.is_owned = false;
61950         InitFeatures_set_scid_privacy_required(&this_arg_conv);
61951 }
61952
61953 jboolean  __attribute__((export_name("TS_InitFeatures_supports_scid_privacy"))) TS_InitFeatures_supports_scid_privacy(uint64_t this_arg) {
61954         LDKInitFeatures this_arg_conv;
61955         this_arg_conv.inner = untag_ptr(this_arg);
61956         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61958         this_arg_conv.is_owned = false;
61959         jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
61960         return ret_conv;
61961 }
61962
61963 void  __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_optional"))) TS_NodeFeatures_set_scid_privacy_optional(uint64_t this_arg) {
61964         LDKNodeFeatures this_arg_conv;
61965         this_arg_conv.inner = untag_ptr(this_arg);
61966         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61968         this_arg_conv.is_owned = false;
61969         NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
61970 }
61971
61972 void  __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_required"))) TS_NodeFeatures_set_scid_privacy_required(uint64_t this_arg) {
61973         LDKNodeFeatures this_arg_conv;
61974         this_arg_conv.inner = untag_ptr(this_arg);
61975         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61977         this_arg_conv.is_owned = false;
61978         NodeFeatures_set_scid_privacy_required(&this_arg_conv);
61979 }
61980
61981 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_scid_privacy"))) TS_NodeFeatures_supports_scid_privacy(uint64_t this_arg) {
61982         LDKNodeFeatures this_arg_conv;
61983         this_arg_conv.inner = untag_ptr(this_arg);
61984         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61986         this_arg_conv.is_owned = false;
61987         jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
61988         return ret_conv;
61989 }
61990
61991 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_optional"))) TS_ChannelTypeFeatures_set_scid_privacy_optional(uint64_t this_arg) {
61992         LDKChannelTypeFeatures this_arg_conv;
61993         this_arg_conv.inner = untag_ptr(this_arg);
61994         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61996         this_arg_conv.is_owned = false;
61997         ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
61998 }
61999
62000 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_required"))) TS_ChannelTypeFeatures_set_scid_privacy_required(uint64_t this_arg) {
62001         LDKChannelTypeFeatures this_arg_conv;
62002         this_arg_conv.inner = untag_ptr(this_arg);
62003         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62005         this_arg_conv.is_owned = false;
62006         ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
62007 }
62008
62009 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_scid_privacy"))) TS_ChannelTypeFeatures_supports_scid_privacy(uint64_t this_arg) {
62010         LDKChannelTypeFeatures this_arg_conv;
62011         this_arg_conv.inner = untag_ptr(this_arg);
62012         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62014         this_arg_conv.is_owned = false;
62015         jboolean ret_conv = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
62016         return ret_conv;
62017 }
62018
62019 jboolean  __attribute__((export_name("TS_InitFeatures_requires_scid_privacy"))) TS_InitFeatures_requires_scid_privacy(uint64_t this_arg) {
62020         LDKInitFeatures this_arg_conv;
62021         this_arg_conv.inner = untag_ptr(this_arg);
62022         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62024         this_arg_conv.is_owned = false;
62025         jboolean ret_conv = InitFeatures_requires_scid_privacy(&this_arg_conv);
62026         return ret_conv;
62027 }
62028
62029 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_scid_privacy"))) TS_NodeFeatures_requires_scid_privacy(uint64_t this_arg) {
62030         LDKNodeFeatures this_arg_conv;
62031         this_arg_conv.inner = untag_ptr(this_arg);
62032         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62034         this_arg_conv.is_owned = false;
62035         jboolean ret_conv = NodeFeatures_requires_scid_privacy(&this_arg_conv);
62036         return ret_conv;
62037 }
62038
62039 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_scid_privacy"))) TS_ChannelTypeFeatures_requires_scid_privacy(uint64_t this_arg) {
62040         LDKChannelTypeFeatures this_arg_conv;
62041         this_arg_conv.inner = untag_ptr(this_arg);
62042         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62044         this_arg_conv.is_owned = false;
62045         jboolean ret_conv = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
62046         return ret_conv;
62047 }
62048
62049 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_payment_metadata_optional"))) TS_Bolt11InvoiceFeatures_set_payment_metadata_optional(uint64_t this_arg) {
62050         LDKBolt11InvoiceFeatures this_arg_conv;
62051         this_arg_conv.inner = untag_ptr(this_arg);
62052         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62054         this_arg_conv.is_owned = false;
62055         Bolt11InvoiceFeatures_set_payment_metadata_optional(&this_arg_conv);
62056 }
62057
62058 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_payment_metadata_required"))) TS_Bolt11InvoiceFeatures_set_payment_metadata_required(uint64_t this_arg) {
62059         LDKBolt11InvoiceFeatures this_arg_conv;
62060         this_arg_conv.inner = untag_ptr(this_arg);
62061         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62063         this_arg_conv.is_owned = false;
62064         Bolt11InvoiceFeatures_set_payment_metadata_required(&this_arg_conv);
62065 }
62066
62067 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_supports_payment_metadata"))) TS_Bolt11InvoiceFeatures_supports_payment_metadata(uint64_t this_arg) {
62068         LDKBolt11InvoiceFeatures this_arg_conv;
62069         this_arg_conv.inner = untag_ptr(this_arg);
62070         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62072         this_arg_conv.is_owned = false;
62073         jboolean ret_conv = Bolt11InvoiceFeatures_supports_payment_metadata(&this_arg_conv);
62074         return ret_conv;
62075 }
62076
62077 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_payment_metadata"))) TS_Bolt11InvoiceFeatures_requires_payment_metadata(uint64_t this_arg) {
62078         LDKBolt11InvoiceFeatures this_arg_conv;
62079         this_arg_conv.inner = untag_ptr(this_arg);
62080         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62082         this_arg_conv.is_owned = false;
62083         jboolean ret_conv = Bolt11InvoiceFeatures_requires_payment_metadata(&this_arg_conv);
62084         return ret_conv;
62085 }
62086
62087 void  __attribute__((export_name("TS_InitFeatures_set_zero_conf_optional"))) TS_InitFeatures_set_zero_conf_optional(uint64_t this_arg) {
62088         LDKInitFeatures this_arg_conv;
62089         this_arg_conv.inner = untag_ptr(this_arg);
62090         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62092         this_arg_conv.is_owned = false;
62093         InitFeatures_set_zero_conf_optional(&this_arg_conv);
62094 }
62095
62096 void  __attribute__((export_name("TS_InitFeatures_set_zero_conf_required"))) TS_InitFeatures_set_zero_conf_required(uint64_t this_arg) {
62097         LDKInitFeatures this_arg_conv;
62098         this_arg_conv.inner = untag_ptr(this_arg);
62099         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62101         this_arg_conv.is_owned = false;
62102         InitFeatures_set_zero_conf_required(&this_arg_conv);
62103 }
62104
62105 jboolean  __attribute__((export_name("TS_InitFeatures_supports_zero_conf"))) TS_InitFeatures_supports_zero_conf(uint64_t this_arg) {
62106         LDKInitFeatures this_arg_conv;
62107         this_arg_conv.inner = untag_ptr(this_arg);
62108         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62110         this_arg_conv.is_owned = false;
62111         jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
62112         return ret_conv;
62113 }
62114
62115 void  __attribute__((export_name("TS_NodeFeatures_set_zero_conf_optional"))) TS_NodeFeatures_set_zero_conf_optional(uint64_t this_arg) {
62116         LDKNodeFeatures this_arg_conv;
62117         this_arg_conv.inner = untag_ptr(this_arg);
62118         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62120         this_arg_conv.is_owned = false;
62121         NodeFeatures_set_zero_conf_optional(&this_arg_conv);
62122 }
62123
62124 void  __attribute__((export_name("TS_NodeFeatures_set_zero_conf_required"))) TS_NodeFeatures_set_zero_conf_required(uint64_t this_arg) {
62125         LDKNodeFeatures this_arg_conv;
62126         this_arg_conv.inner = untag_ptr(this_arg);
62127         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62129         this_arg_conv.is_owned = false;
62130         NodeFeatures_set_zero_conf_required(&this_arg_conv);
62131 }
62132
62133 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_zero_conf"))) TS_NodeFeatures_supports_zero_conf(uint64_t this_arg) {
62134         LDKNodeFeatures this_arg_conv;
62135         this_arg_conv.inner = untag_ptr(this_arg);
62136         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62138         this_arg_conv.is_owned = false;
62139         jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
62140         return ret_conv;
62141 }
62142
62143 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_optional"))) TS_ChannelTypeFeatures_set_zero_conf_optional(uint64_t this_arg) {
62144         LDKChannelTypeFeatures this_arg_conv;
62145         this_arg_conv.inner = untag_ptr(this_arg);
62146         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62148         this_arg_conv.is_owned = false;
62149         ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
62150 }
62151
62152 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_required"))) TS_ChannelTypeFeatures_set_zero_conf_required(uint64_t this_arg) {
62153         LDKChannelTypeFeatures this_arg_conv;
62154         this_arg_conv.inner = untag_ptr(this_arg);
62155         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62157         this_arg_conv.is_owned = false;
62158         ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
62159 }
62160
62161 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_zero_conf"))) TS_ChannelTypeFeatures_supports_zero_conf(uint64_t this_arg) {
62162         LDKChannelTypeFeatures this_arg_conv;
62163         this_arg_conv.inner = untag_ptr(this_arg);
62164         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62166         this_arg_conv.is_owned = false;
62167         jboolean ret_conv = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
62168         return ret_conv;
62169 }
62170
62171 jboolean  __attribute__((export_name("TS_InitFeatures_requires_zero_conf"))) TS_InitFeatures_requires_zero_conf(uint64_t this_arg) {
62172         LDKInitFeatures this_arg_conv;
62173         this_arg_conv.inner = untag_ptr(this_arg);
62174         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62176         this_arg_conv.is_owned = false;
62177         jboolean ret_conv = InitFeatures_requires_zero_conf(&this_arg_conv);
62178         return ret_conv;
62179 }
62180
62181 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_zero_conf"))) TS_NodeFeatures_requires_zero_conf(uint64_t this_arg) {
62182         LDKNodeFeatures this_arg_conv;
62183         this_arg_conv.inner = untag_ptr(this_arg);
62184         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62186         this_arg_conv.is_owned = false;
62187         jboolean ret_conv = NodeFeatures_requires_zero_conf(&this_arg_conv);
62188         return ret_conv;
62189 }
62190
62191 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_zero_conf"))) TS_ChannelTypeFeatures_requires_zero_conf(uint64_t this_arg) {
62192         LDKChannelTypeFeatures this_arg_conv;
62193         this_arg_conv.inner = untag_ptr(this_arg);
62194         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62196         this_arg_conv.is_owned = false;
62197         jboolean ret_conv = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
62198         return ret_conv;
62199 }
62200
62201 void  __attribute__((export_name("TS_NodeFeatures_set_keysend_optional"))) TS_NodeFeatures_set_keysend_optional(uint64_t this_arg) {
62202         LDKNodeFeatures this_arg_conv;
62203         this_arg_conv.inner = untag_ptr(this_arg);
62204         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62206         this_arg_conv.is_owned = false;
62207         NodeFeatures_set_keysend_optional(&this_arg_conv);
62208 }
62209
62210 void  __attribute__((export_name("TS_NodeFeatures_set_keysend_required"))) TS_NodeFeatures_set_keysend_required(uint64_t this_arg) {
62211         LDKNodeFeatures this_arg_conv;
62212         this_arg_conv.inner = untag_ptr(this_arg);
62213         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62215         this_arg_conv.is_owned = false;
62216         NodeFeatures_set_keysend_required(&this_arg_conv);
62217 }
62218
62219 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_keysend"))) TS_NodeFeatures_supports_keysend(uint64_t this_arg) {
62220         LDKNodeFeatures this_arg_conv;
62221         this_arg_conv.inner = untag_ptr(this_arg);
62222         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62224         this_arg_conv.is_owned = false;
62225         jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
62226         return ret_conv;
62227 }
62228
62229 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_keysend"))) TS_NodeFeatures_requires_keysend(uint64_t this_arg) {
62230         LDKNodeFeatures this_arg_conv;
62231         this_arg_conv.inner = untag_ptr(this_arg);
62232         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62234         this_arg_conv.is_owned = false;
62235         jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
62236         return ret_conv;
62237 }
62238
62239 void  __attribute__((export_name("TS_InitFeatures_set_trampoline_routing_optional"))) TS_InitFeatures_set_trampoline_routing_optional(uint64_t this_arg) {
62240         LDKInitFeatures this_arg_conv;
62241         this_arg_conv.inner = untag_ptr(this_arg);
62242         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62244         this_arg_conv.is_owned = false;
62245         InitFeatures_set_trampoline_routing_optional(&this_arg_conv);
62246 }
62247
62248 void  __attribute__((export_name("TS_InitFeatures_set_trampoline_routing_required"))) TS_InitFeatures_set_trampoline_routing_required(uint64_t this_arg) {
62249         LDKInitFeatures this_arg_conv;
62250         this_arg_conv.inner = untag_ptr(this_arg);
62251         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62253         this_arg_conv.is_owned = false;
62254         InitFeatures_set_trampoline_routing_required(&this_arg_conv);
62255 }
62256
62257 jboolean  __attribute__((export_name("TS_InitFeatures_supports_trampoline_routing"))) TS_InitFeatures_supports_trampoline_routing(uint64_t this_arg) {
62258         LDKInitFeatures this_arg_conv;
62259         this_arg_conv.inner = untag_ptr(this_arg);
62260         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62262         this_arg_conv.is_owned = false;
62263         jboolean ret_conv = InitFeatures_supports_trampoline_routing(&this_arg_conv);
62264         return ret_conv;
62265 }
62266
62267 void  __attribute__((export_name("TS_NodeFeatures_set_trampoline_routing_optional"))) TS_NodeFeatures_set_trampoline_routing_optional(uint64_t this_arg) {
62268         LDKNodeFeatures this_arg_conv;
62269         this_arg_conv.inner = untag_ptr(this_arg);
62270         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62272         this_arg_conv.is_owned = false;
62273         NodeFeatures_set_trampoline_routing_optional(&this_arg_conv);
62274 }
62275
62276 void  __attribute__((export_name("TS_NodeFeatures_set_trampoline_routing_required"))) TS_NodeFeatures_set_trampoline_routing_required(uint64_t this_arg) {
62277         LDKNodeFeatures this_arg_conv;
62278         this_arg_conv.inner = untag_ptr(this_arg);
62279         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62281         this_arg_conv.is_owned = false;
62282         NodeFeatures_set_trampoline_routing_required(&this_arg_conv);
62283 }
62284
62285 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_trampoline_routing"))) TS_NodeFeatures_supports_trampoline_routing(uint64_t this_arg) {
62286         LDKNodeFeatures this_arg_conv;
62287         this_arg_conv.inner = untag_ptr(this_arg);
62288         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62290         this_arg_conv.is_owned = false;
62291         jboolean ret_conv = NodeFeatures_supports_trampoline_routing(&this_arg_conv);
62292         return ret_conv;
62293 }
62294
62295 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_trampoline_routing_optional"))) TS_Bolt11InvoiceFeatures_set_trampoline_routing_optional(uint64_t this_arg) {
62296         LDKBolt11InvoiceFeatures this_arg_conv;
62297         this_arg_conv.inner = untag_ptr(this_arg);
62298         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62300         this_arg_conv.is_owned = false;
62301         Bolt11InvoiceFeatures_set_trampoline_routing_optional(&this_arg_conv);
62302 }
62303
62304 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_trampoline_routing_required"))) TS_Bolt11InvoiceFeatures_set_trampoline_routing_required(uint64_t this_arg) {
62305         LDKBolt11InvoiceFeatures this_arg_conv;
62306         this_arg_conv.inner = untag_ptr(this_arg);
62307         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62309         this_arg_conv.is_owned = false;
62310         Bolt11InvoiceFeatures_set_trampoline_routing_required(&this_arg_conv);
62311 }
62312
62313 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_supports_trampoline_routing"))) TS_Bolt11InvoiceFeatures_supports_trampoline_routing(uint64_t this_arg) {
62314         LDKBolt11InvoiceFeatures this_arg_conv;
62315         this_arg_conv.inner = untag_ptr(this_arg);
62316         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62318         this_arg_conv.is_owned = false;
62319         jboolean ret_conv = Bolt11InvoiceFeatures_supports_trampoline_routing(&this_arg_conv);
62320         return ret_conv;
62321 }
62322
62323 jboolean  __attribute__((export_name("TS_InitFeatures_requires_trampoline_routing"))) TS_InitFeatures_requires_trampoline_routing(uint64_t this_arg) {
62324         LDKInitFeatures this_arg_conv;
62325         this_arg_conv.inner = untag_ptr(this_arg);
62326         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62328         this_arg_conv.is_owned = false;
62329         jboolean ret_conv = InitFeatures_requires_trampoline_routing(&this_arg_conv);
62330         return ret_conv;
62331 }
62332
62333 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_trampoline_routing"))) TS_NodeFeatures_requires_trampoline_routing(uint64_t this_arg) {
62334         LDKNodeFeatures this_arg_conv;
62335         this_arg_conv.inner = untag_ptr(this_arg);
62336         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62338         this_arg_conv.is_owned = false;
62339         jboolean ret_conv = NodeFeatures_requires_trampoline_routing(&this_arg_conv);
62340         return ret_conv;
62341 }
62342
62343 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_trampoline_routing"))) TS_Bolt11InvoiceFeatures_requires_trampoline_routing(uint64_t this_arg) {
62344         LDKBolt11InvoiceFeatures this_arg_conv;
62345         this_arg_conv.inner = untag_ptr(this_arg);
62346         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62348         this_arg_conv.is_owned = false;
62349         jboolean ret_conv = Bolt11InvoiceFeatures_requires_trampoline_routing(&this_arg_conv);
62350         return ret_conv;
62351 }
62352
62353 void  __attribute__((export_name("TS_ShutdownScript_free"))) TS_ShutdownScript_free(uint64_t this_obj) {
62354         LDKShutdownScript this_obj_conv;
62355         this_obj_conv.inner = untag_ptr(this_obj);
62356         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62358         ShutdownScript_free(this_obj_conv);
62359 }
62360
62361 static inline uint64_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
62362         LDKShutdownScript ret_var = ShutdownScript_clone(arg);
62363         uint64_t ret_ref = 0;
62364         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62365         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62366         return ret_ref;
62367 }
62368 int64_t  __attribute__((export_name("TS_ShutdownScript_clone_ptr"))) TS_ShutdownScript_clone_ptr(uint64_t arg) {
62369         LDKShutdownScript arg_conv;
62370         arg_conv.inner = untag_ptr(arg);
62371         arg_conv.is_owned = ptr_is_owned(arg);
62372         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62373         arg_conv.is_owned = false;
62374         int64_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
62375         return ret_conv;
62376 }
62377
62378 uint64_t  __attribute__((export_name("TS_ShutdownScript_clone"))) TS_ShutdownScript_clone(uint64_t orig) {
62379         LDKShutdownScript orig_conv;
62380         orig_conv.inner = untag_ptr(orig);
62381         orig_conv.is_owned = ptr_is_owned(orig);
62382         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62383         orig_conv.is_owned = false;
62384         LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
62385         uint64_t ret_ref = 0;
62386         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62387         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62388         return ret_ref;
62389 }
62390
62391 jboolean  __attribute__((export_name("TS_ShutdownScript_eq"))) TS_ShutdownScript_eq(uint64_t a, uint64_t b) {
62392         LDKShutdownScript a_conv;
62393         a_conv.inner = untag_ptr(a);
62394         a_conv.is_owned = ptr_is_owned(a);
62395         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62396         a_conv.is_owned = false;
62397         LDKShutdownScript b_conv;
62398         b_conv.inner = untag_ptr(b);
62399         b_conv.is_owned = ptr_is_owned(b);
62400         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62401         b_conv.is_owned = false;
62402         jboolean ret_conv = ShutdownScript_eq(&a_conv, &b_conv);
62403         return ret_conv;
62404 }
62405
62406 void  __attribute__((export_name("TS_InvalidShutdownScript_free"))) TS_InvalidShutdownScript_free(uint64_t this_obj) {
62407         LDKInvalidShutdownScript this_obj_conv;
62408         this_obj_conv.inner = untag_ptr(this_obj);
62409         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62411         InvalidShutdownScript_free(this_obj_conv);
62412 }
62413
62414 int8_tArray  __attribute__((export_name("TS_InvalidShutdownScript_get_script"))) TS_InvalidShutdownScript_get_script(uint64_t this_ptr) {
62415         LDKInvalidShutdownScript this_ptr_conv;
62416         this_ptr_conv.inner = untag_ptr(this_ptr);
62417         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62419         this_ptr_conv.is_owned = false;
62420         LDKCVec_u8Z ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
62421         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
62422         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
62423         CVec_u8Z_free(ret_var);
62424         return ret_arr;
62425 }
62426
62427 void  __attribute__((export_name("TS_InvalidShutdownScript_set_script"))) TS_InvalidShutdownScript_set_script(uint64_t this_ptr, int8_tArray val) {
62428         LDKInvalidShutdownScript this_ptr_conv;
62429         this_ptr_conv.inner = untag_ptr(this_ptr);
62430         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62432         this_ptr_conv.is_owned = false;
62433         LDKCVec_u8Z val_ref;
62434         val_ref.datalen = val->arr_len;
62435         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
62436         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
62437         InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
62438 }
62439
62440 uint64_t  __attribute__((export_name("TS_InvalidShutdownScript_new"))) TS_InvalidShutdownScript_new(int8_tArray script_arg) {
62441         LDKCVec_u8Z script_arg_ref;
62442         script_arg_ref.datalen = script_arg->arr_len;
62443         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
62444         memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen); FREE(script_arg);
62445         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
62446         uint64_t ret_ref = 0;
62447         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62448         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62449         return ret_ref;
62450 }
62451
62452 static inline uint64_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
62453         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
62454         uint64_t ret_ref = 0;
62455         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62456         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62457         return ret_ref;
62458 }
62459 int64_t  __attribute__((export_name("TS_InvalidShutdownScript_clone_ptr"))) TS_InvalidShutdownScript_clone_ptr(uint64_t arg) {
62460         LDKInvalidShutdownScript arg_conv;
62461         arg_conv.inner = untag_ptr(arg);
62462         arg_conv.is_owned = ptr_is_owned(arg);
62463         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62464         arg_conv.is_owned = false;
62465         int64_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
62466         return ret_conv;
62467 }
62468
62469 uint64_t  __attribute__((export_name("TS_InvalidShutdownScript_clone"))) TS_InvalidShutdownScript_clone(uint64_t orig) {
62470         LDKInvalidShutdownScript orig_conv;
62471         orig_conv.inner = untag_ptr(orig);
62472         orig_conv.is_owned = ptr_is_owned(orig);
62473         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62474         orig_conv.is_owned = false;
62475         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
62476         uint64_t ret_ref = 0;
62477         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62478         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62479         return ret_ref;
62480 }
62481
62482 int8_tArray  __attribute__((export_name("TS_ShutdownScript_write"))) TS_ShutdownScript_write(uint64_t obj) {
62483         LDKShutdownScript obj_conv;
62484         obj_conv.inner = untag_ptr(obj);
62485         obj_conv.is_owned = ptr_is_owned(obj);
62486         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62487         obj_conv.is_owned = false;
62488         LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
62489         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
62490         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
62491         CVec_u8Z_free(ret_var);
62492         return ret_arr;
62493 }
62494
62495 uint64_t  __attribute__((export_name("TS_ShutdownScript_read"))) TS_ShutdownScript_read(int8_tArray ser) {
62496         LDKu8slice ser_ref;
62497         ser_ref.datalen = ser->arr_len;
62498         ser_ref.data = ser->elems;
62499         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
62500         *ret_conv = ShutdownScript_read(ser_ref);
62501         FREE(ser);
62502         return tag_ptr(ret_conv, true);
62503 }
62504
62505 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_p2wpkh"))) TS_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) {
62506         uint8_t pubkey_hash_arr[20];
62507         CHECK(pubkey_hash->arr_len == 20);
62508         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
62509         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
62510         LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
62511         uint64_t ret_ref = 0;
62512         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62513         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62514         return ret_ref;
62515 }
62516
62517 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_p2wsh"))) TS_ShutdownScript_new_p2wsh(int8_tArray script_hash) {
62518         uint8_t script_hash_arr[32];
62519         CHECK(script_hash->arr_len == 32);
62520         memcpy(script_hash_arr, script_hash->elems, 32); FREE(script_hash);
62521         uint8_t (*script_hash_ref)[32] = &script_hash_arr;
62522         LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
62523         uint64_t ret_ref = 0;
62524         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62525         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62526         return ret_ref;
62527 }
62528
62529 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_witness_program"))) TS_ShutdownScript_new_witness_program(uint64_t witness_program) {
62530         void* witness_program_ptr = untag_ptr(witness_program);
62531         CHECK_ACCESS(witness_program_ptr);
62532         LDKWitnessProgram witness_program_conv = *(LDKWitnessProgram*)(witness_program_ptr);
62533         witness_program_conv = WitnessProgram_clone((LDKWitnessProgram*)untag_ptr(witness_program));
62534         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
62535         *ret_conv = ShutdownScript_new_witness_program(witness_program_conv);
62536         return tag_ptr(ret_conv, true);
62537 }
62538
62539 int8_tArray  __attribute__((export_name("TS_ShutdownScript_into_inner"))) TS_ShutdownScript_into_inner(uint64_t this_arg) {
62540         LDKShutdownScript this_arg_conv;
62541         this_arg_conv.inner = untag_ptr(this_arg);
62542         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62544         this_arg_conv = ShutdownScript_clone(&this_arg_conv);
62545         LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
62546         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
62547         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
62548         CVec_u8Z_free(ret_var);
62549         return ret_arr;
62550 }
62551
62552 int8_tArray  __attribute__((export_name("TS_ShutdownScript_as_legacy_pubkey"))) TS_ShutdownScript_as_legacy_pubkey(uint64_t this_arg) {
62553         LDKShutdownScript this_arg_conv;
62554         this_arg_conv.inner = untag_ptr(this_arg);
62555         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62557         this_arg_conv.is_owned = false;
62558         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
62559         memcpy(ret_arr->elems, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form, 33);
62560         return ret_arr;
62561 }
62562
62563 jboolean  __attribute__((export_name("TS_ShutdownScript_is_compatible"))) TS_ShutdownScript_is_compatible(uint64_t this_arg, uint64_t features) {
62564         LDKShutdownScript this_arg_conv;
62565         this_arg_conv.inner = untag_ptr(this_arg);
62566         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62568         this_arg_conv.is_owned = false;
62569         LDKInitFeatures features_conv;
62570         features_conv.inner = untag_ptr(features);
62571         features_conv.is_owned = ptr_is_owned(features);
62572         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
62573         features_conv.is_owned = false;
62574         jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
62575         return ret_conv;
62576 }
62577
62578 void  __attribute__((export_name("TS_ChannelId_free"))) TS_ChannelId_free(uint64_t this_obj) {
62579         LDKChannelId this_obj_conv;
62580         this_obj_conv.inner = untag_ptr(this_obj);
62581         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62583         ChannelId_free(this_obj_conv);
62584 }
62585
62586 int8_tArray  __attribute__((export_name("TS_ChannelId_get_a"))) TS_ChannelId_get_a(uint64_t this_ptr) {
62587         LDKChannelId this_ptr_conv;
62588         this_ptr_conv.inner = untag_ptr(this_ptr);
62589         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62591         this_ptr_conv.is_owned = false;
62592         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
62593         memcpy(ret_arr->elems, *ChannelId_get_a(&this_ptr_conv), 32);
62594         return ret_arr;
62595 }
62596
62597 void  __attribute__((export_name("TS_ChannelId_set_a"))) TS_ChannelId_set_a(uint64_t this_ptr, int8_tArray val) {
62598         LDKChannelId this_ptr_conv;
62599         this_ptr_conv.inner = untag_ptr(this_ptr);
62600         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62602         this_ptr_conv.is_owned = false;
62603         LDKThirtyTwoBytes val_ref;
62604         CHECK(val->arr_len == 32);
62605         memcpy(val_ref.data, val->elems, 32); FREE(val);
62606         ChannelId_set_a(&this_ptr_conv, val_ref);
62607 }
62608
62609 uint64_t  __attribute__((export_name("TS_ChannelId_new"))) TS_ChannelId_new(int8_tArray a_arg) {
62610         LDKThirtyTwoBytes a_arg_ref;
62611         CHECK(a_arg->arr_len == 32);
62612         memcpy(a_arg_ref.data, a_arg->elems, 32); FREE(a_arg);
62613         LDKChannelId ret_var = ChannelId_new(a_arg_ref);
62614         uint64_t ret_ref = 0;
62615         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62616         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62617         return ret_ref;
62618 }
62619
62620 static inline uint64_t ChannelId_clone_ptr(LDKChannelId *NONNULL_PTR arg) {
62621         LDKChannelId ret_var = ChannelId_clone(arg);
62622         uint64_t ret_ref = 0;
62623         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62624         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62625         return ret_ref;
62626 }
62627 int64_t  __attribute__((export_name("TS_ChannelId_clone_ptr"))) TS_ChannelId_clone_ptr(uint64_t arg) {
62628         LDKChannelId arg_conv;
62629         arg_conv.inner = untag_ptr(arg);
62630         arg_conv.is_owned = ptr_is_owned(arg);
62631         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62632         arg_conv.is_owned = false;
62633         int64_t ret_conv = ChannelId_clone_ptr(&arg_conv);
62634         return ret_conv;
62635 }
62636
62637 uint64_t  __attribute__((export_name("TS_ChannelId_clone"))) TS_ChannelId_clone(uint64_t orig) {
62638         LDKChannelId orig_conv;
62639         orig_conv.inner = untag_ptr(orig);
62640         orig_conv.is_owned = ptr_is_owned(orig);
62641         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62642         orig_conv.is_owned = false;
62643         LDKChannelId ret_var = ChannelId_clone(&orig_conv);
62644         uint64_t ret_ref = 0;
62645         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62646         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62647         return ret_ref;
62648 }
62649
62650 jboolean  __attribute__((export_name("TS_ChannelId_eq"))) TS_ChannelId_eq(uint64_t a, uint64_t b) {
62651         LDKChannelId a_conv;
62652         a_conv.inner = untag_ptr(a);
62653         a_conv.is_owned = ptr_is_owned(a);
62654         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62655         a_conv.is_owned = false;
62656         LDKChannelId b_conv;
62657         b_conv.inner = untag_ptr(b);
62658         b_conv.is_owned = ptr_is_owned(b);
62659         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62660         b_conv.is_owned = false;
62661         jboolean ret_conv = ChannelId_eq(&a_conv, &b_conv);
62662         return ret_conv;
62663 }
62664
62665 int64_t  __attribute__((export_name("TS_ChannelId_hash"))) TS_ChannelId_hash(uint64_t o) {
62666         LDKChannelId o_conv;
62667         o_conv.inner = untag_ptr(o);
62668         o_conv.is_owned = ptr_is_owned(o);
62669         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
62670         o_conv.is_owned = false;
62671         int64_t ret_conv = ChannelId_hash(&o_conv);
62672         return ret_conv;
62673 }
62674
62675 uint64_t  __attribute__((export_name("TS_ChannelId_v1_from_funding_txid"))) TS_ChannelId_v1_from_funding_txid(int8_tArray txid, int16_t output_index) {
62676         uint8_t txid_arr[32];
62677         CHECK(txid->arr_len == 32);
62678         memcpy(txid_arr, txid->elems, 32); FREE(txid);
62679         uint8_t (*txid_ref)[32] = &txid_arr;
62680         LDKChannelId ret_var = ChannelId_v1_from_funding_txid(txid_ref, output_index);
62681         uint64_t ret_ref = 0;
62682         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62683         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62684         return ret_ref;
62685 }
62686
62687 uint64_t  __attribute__((export_name("TS_ChannelId_v1_from_funding_outpoint"))) TS_ChannelId_v1_from_funding_outpoint(uint64_t outpoint) {
62688         LDKOutPoint outpoint_conv;
62689         outpoint_conv.inner = untag_ptr(outpoint);
62690         outpoint_conv.is_owned = ptr_is_owned(outpoint);
62691         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
62692         outpoint_conv = OutPoint_clone(&outpoint_conv);
62693         LDKChannelId ret_var = ChannelId_v1_from_funding_outpoint(outpoint_conv);
62694         uint64_t ret_ref = 0;
62695         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62696         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62697         return ret_ref;
62698 }
62699
62700 uint64_t  __attribute__((export_name("TS_ChannelId_temporary_from_entropy_source"))) TS_ChannelId_temporary_from_entropy_source(uint64_t entropy_source) {
62701         void* entropy_source_ptr = untag_ptr(entropy_source);
62702         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
62703         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
62704         LDKChannelId ret_var = ChannelId_temporary_from_entropy_source(entropy_source_conv);
62705         uint64_t ret_ref = 0;
62706         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62707         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62708         return ret_ref;
62709 }
62710
62711 uint64_t  __attribute__((export_name("TS_ChannelId_from_bytes"))) TS_ChannelId_from_bytes(int8_tArray data) {
62712         LDKThirtyTwoBytes data_ref;
62713         CHECK(data->arr_len == 32);
62714         memcpy(data_ref.data, data->elems, 32); FREE(data);
62715         LDKChannelId ret_var = ChannelId_from_bytes(data_ref);
62716         uint64_t ret_ref = 0;
62717         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62718         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62719         return ret_ref;
62720 }
62721
62722 uint64_t  __attribute__((export_name("TS_ChannelId_new_zero"))) TS_ChannelId_new_zero() {
62723         LDKChannelId ret_var = ChannelId_new_zero();
62724         uint64_t ret_ref = 0;
62725         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62726         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62727         return ret_ref;
62728 }
62729
62730 jboolean  __attribute__((export_name("TS_ChannelId_is_zero"))) TS_ChannelId_is_zero(uint64_t this_arg) {
62731         LDKChannelId this_arg_conv;
62732         this_arg_conv.inner = untag_ptr(this_arg);
62733         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62735         this_arg_conv.is_owned = false;
62736         jboolean ret_conv = ChannelId_is_zero(&this_arg_conv);
62737         return ret_conv;
62738 }
62739
62740 uint64_t  __attribute__((export_name("TS_ChannelId_v2_from_revocation_basepoints"))) TS_ChannelId_v2_from_revocation_basepoints(uint64_t ours, uint64_t theirs) {
62741         LDKRevocationBasepoint ours_conv;
62742         ours_conv.inner = untag_ptr(ours);
62743         ours_conv.is_owned = ptr_is_owned(ours);
62744         CHECK_INNER_FIELD_ACCESS_OR_NULL(ours_conv);
62745         ours_conv.is_owned = false;
62746         LDKRevocationBasepoint theirs_conv;
62747         theirs_conv.inner = untag_ptr(theirs);
62748         theirs_conv.is_owned = ptr_is_owned(theirs);
62749         CHECK_INNER_FIELD_ACCESS_OR_NULL(theirs_conv);
62750         theirs_conv.is_owned = false;
62751         LDKChannelId ret_var = ChannelId_v2_from_revocation_basepoints(&ours_conv, &theirs_conv);
62752         uint64_t ret_ref = 0;
62753         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62754         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62755         return ret_ref;
62756 }
62757
62758 uint64_t  __attribute__((export_name("TS_ChannelId_temporary_v2_from_revocation_basepoint"))) TS_ChannelId_temporary_v2_from_revocation_basepoint(uint64_t our_revocation_basepoint) {
62759         LDKRevocationBasepoint our_revocation_basepoint_conv;
62760         our_revocation_basepoint_conv.inner = untag_ptr(our_revocation_basepoint);
62761         our_revocation_basepoint_conv.is_owned = ptr_is_owned(our_revocation_basepoint);
62762         CHECK_INNER_FIELD_ACCESS_OR_NULL(our_revocation_basepoint_conv);
62763         our_revocation_basepoint_conv.is_owned = false;
62764         LDKChannelId ret_var = ChannelId_temporary_v2_from_revocation_basepoint(&our_revocation_basepoint_conv);
62765         uint64_t ret_ref = 0;
62766         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62767         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62768         return ret_ref;
62769 }
62770
62771 int8_tArray  __attribute__((export_name("TS_ChannelId_write"))) TS_ChannelId_write(uint64_t obj) {
62772         LDKChannelId obj_conv;
62773         obj_conv.inner = untag_ptr(obj);
62774         obj_conv.is_owned = ptr_is_owned(obj);
62775         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62776         obj_conv.is_owned = false;
62777         LDKCVec_u8Z ret_var = ChannelId_write(&obj_conv);
62778         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
62779         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
62780         CVec_u8Z_free(ret_var);
62781         return ret_arr;
62782 }
62783
62784 uint64_t  __attribute__((export_name("TS_ChannelId_read"))) TS_ChannelId_read(int8_tArray ser) {
62785         LDKu8slice ser_ref;
62786         ser_ref.datalen = ser->arr_len;
62787         ser_ref.data = ser->elems;
62788         LDKCResult_ChannelIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdDecodeErrorZ), "LDKCResult_ChannelIdDecodeErrorZ");
62789         *ret_conv = ChannelId_read(ser_ref);
62790         FREE(ser);
62791         return tag_ptr(ret_conv, true);
62792 }
62793
62794 void  __attribute__((export_name("TS_Retry_free"))) TS_Retry_free(uint64_t this_ptr) {
62795         if (!ptr_is_owned(this_ptr)) return;
62796         void* this_ptr_ptr = untag_ptr(this_ptr);
62797         CHECK_ACCESS(this_ptr_ptr);
62798         LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
62799         FREE(untag_ptr(this_ptr));
62800         Retry_free(this_ptr_conv);
62801 }
62802
62803 static inline uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
62804         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
62805         *ret_copy = Retry_clone(arg);
62806         uint64_t ret_ref = tag_ptr(ret_copy, true);
62807         return ret_ref;
62808 }
62809 int64_t  __attribute__((export_name("TS_Retry_clone_ptr"))) TS_Retry_clone_ptr(uint64_t arg) {
62810         LDKRetry* arg_conv = (LDKRetry*)untag_ptr(arg);
62811         int64_t ret_conv = Retry_clone_ptr(arg_conv);
62812         return ret_conv;
62813 }
62814
62815 uint64_t  __attribute__((export_name("TS_Retry_clone"))) TS_Retry_clone(uint64_t orig) {
62816         LDKRetry* orig_conv = (LDKRetry*)untag_ptr(orig);
62817         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
62818         *ret_copy = Retry_clone(orig_conv);
62819         uint64_t ret_ref = tag_ptr(ret_copy, true);
62820         return ret_ref;
62821 }
62822
62823 uint64_t  __attribute__((export_name("TS_Retry_attempts"))) TS_Retry_attempts(int32_t a) {
62824         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
62825         *ret_copy = Retry_attempts(a);
62826         uint64_t ret_ref = tag_ptr(ret_copy, true);
62827         return ret_ref;
62828 }
62829
62830 jboolean  __attribute__((export_name("TS_Retry_eq"))) TS_Retry_eq(uint64_t a, uint64_t b) {
62831         LDKRetry* a_conv = (LDKRetry*)untag_ptr(a);
62832         LDKRetry* b_conv = (LDKRetry*)untag_ptr(b);
62833         jboolean ret_conv = Retry_eq(a_conv, b_conv);
62834         return ret_conv;
62835 }
62836
62837 int64_t  __attribute__((export_name("TS_Retry_hash"))) TS_Retry_hash(uint64_t o) {
62838         LDKRetry* o_conv = (LDKRetry*)untag_ptr(o);
62839         int64_t ret_conv = Retry_hash(o_conv);
62840         return ret_conv;
62841 }
62842
62843 int8_tArray  __attribute__((export_name("TS_Retry_write"))) TS_Retry_write(uint64_t obj) {
62844         LDKRetry* obj_conv = (LDKRetry*)untag_ptr(obj);
62845         LDKCVec_u8Z ret_var = Retry_write(obj_conv);
62846         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
62847         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
62848         CVec_u8Z_free(ret_var);
62849         return ret_arr;
62850 }
62851
62852 uint64_t  __attribute__((export_name("TS_Retry_read"))) TS_Retry_read(int8_tArray ser) {
62853         LDKu8slice ser_ref;
62854         ser_ref.datalen = ser->arr_len;
62855         ser_ref.data = ser->elems;
62856         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
62857         *ret_conv = Retry_read(ser_ref);
62858         FREE(ser);
62859         return tag_ptr(ret_conv, true);
62860 }
62861
62862 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_clone"))) TS_RetryableSendFailure_clone(uint64_t orig) {
62863         LDKRetryableSendFailure* orig_conv = (LDKRetryableSendFailure*)untag_ptr(orig);
62864         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_clone(orig_conv));
62865         return ret_conv;
62866 }
62867
62868 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_payment_expired"))) TS_RetryableSendFailure_payment_expired() {
62869         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_payment_expired());
62870         return ret_conv;
62871 }
62872
62873 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_route_not_found"))) TS_RetryableSendFailure_route_not_found() {
62874         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_route_not_found());
62875         return ret_conv;
62876 }
62877
62878 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_duplicate_payment"))) TS_RetryableSendFailure_duplicate_payment() {
62879         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_duplicate_payment());
62880         return ret_conv;
62881 }
62882
62883 jboolean  __attribute__((export_name("TS_RetryableSendFailure_eq"))) TS_RetryableSendFailure_eq(uint64_t a, uint64_t b) {
62884         LDKRetryableSendFailure* a_conv = (LDKRetryableSendFailure*)untag_ptr(a);
62885         LDKRetryableSendFailure* b_conv = (LDKRetryableSendFailure*)untag_ptr(b);
62886         jboolean ret_conv = RetryableSendFailure_eq(a_conv, b_conv);
62887         return ret_conv;
62888 }
62889
62890 void  __attribute__((export_name("TS_PaymentSendFailure_free"))) TS_PaymentSendFailure_free(uint64_t this_ptr) {
62891         if (!ptr_is_owned(this_ptr)) return;
62892         void* this_ptr_ptr = untag_ptr(this_ptr);
62893         CHECK_ACCESS(this_ptr_ptr);
62894         LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
62895         FREE(untag_ptr(this_ptr));
62896         PaymentSendFailure_free(this_ptr_conv);
62897 }
62898
62899 static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
62900         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
62901         *ret_copy = PaymentSendFailure_clone(arg);
62902         uint64_t ret_ref = tag_ptr(ret_copy, true);
62903         return ret_ref;
62904 }
62905 int64_t  __attribute__((export_name("TS_PaymentSendFailure_clone_ptr"))) TS_PaymentSendFailure_clone_ptr(uint64_t arg) {
62906         LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)untag_ptr(arg);
62907         int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
62908         return ret_conv;
62909 }
62910
62911 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_clone"))) TS_PaymentSendFailure_clone(uint64_t orig) {
62912         LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)untag_ptr(orig);
62913         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
62914         *ret_copy = PaymentSendFailure_clone(orig_conv);
62915         uint64_t ret_ref = tag_ptr(ret_copy, true);
62916         return ret_ref;
62917 }
62918
62919 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_parameter_error"))) TS_PaymentSendFailure_parameter_error(uint64_t a) {
62920         void* a_ptr = untag_ptr(a);
62921         CHECK_ACCESS(a_ptr);
62922         LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
62923         a_conv = APIError_clone((LDKAPIError*)untag_ptr(a));
62924         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
62925         *ret_copy = PaymentSendFailure_parameter_error(a_conv);
62926         uint64_t ret_ref = tag_ptr(ret_copy, true);
62927         return ret_ref;
62928 }
62929
62930 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_path_parameter_error"))) TS_PaymentSendFailure_path_parameter_error(uint64_tArray a) {
62931         LDKCVec_CResult_NoneAPIErrorZZ a_constr;
62932         a_constr.datalen = a->arr_len;
62933         if (a_constr.datalen > 0)
62934                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
62935         else
62936                 a_constr.data = NULL;
62937         uint64_t* a_vals = a->elems;
62938         for (size_t w = 0; w < a_constr.datalen; w++) {
62939                 uint64_t a_conv_22 = a_vals[w];
62940                 void* a_conv_22_ptr = untag_ptr(a_conv_22);
62941                 CHECK_ACCESS(a_conv_22_ptr);
62942                 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
62943                 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)untag_ptr(a_conv_22));
62944                 a_constr.data[w] = a_conv_22_conv;
62945         }
62946         FREE(a);
62947         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
62948         *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
62949         uint64_t ret_ref = tag_ptr(ret_copy, true);
62950         return ret_ref;
62951 }
62952
62953 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_all_failed_resend_safe"))) TS_PaymentSendFailure_all_failed_resend_safe(uint64_tArray a) {
62954         LDKCVec_APIErrorZ a_constr;
62955         a_constr.datalen = a->arr_len;
62956         if (a_constr.datalen > 0)
62957                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
62958         else
62959                 a_constr.data = NULL;
62960         uint64_t* a_vals = a->elems;
62961         for (size_t k = 0; k < a_constr.datalen; k++) {
62962                 uint64_t a_conv_10 = a_vals[k];
62963                 void* a_conv_10_ptr = untag_ptr(a_conv_10);
62964                 CHECK_ACCESS(a_conv_10_ptr);
62965                 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
62966                 a_conv_10_conv = APIError_clone((LDKAPIError*)untag_ptr(a_conv_10));
62967                 a_constr.data[k] = a_conv_10_conv;
62968         }
62969         FREE(a);
62970         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
62971         *ret_copy = PaymentSendFailure_all_failed_resend_safe(a_constr);
62972         uint64_t ret_ref = tag_ptr(ret_copy, true);
62973         return ret_ref;
62974 }
62975
62976 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_duplicate_payment"))) TS_PaymentSendFailure_duplicate_payment() {
62977         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
62978         *ret_copy = PaymentSendFailure_duplicate_payment();
62979         uint64_t ret_ref = tag_ptr(ret_copy, true);
62980         return ret_ref;
62981 }
62982
62983 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) {
62984         LDKCVec_CResult_NoneAPIErrorZZ results_constr;
62985         results_constr.datalen = results->arr_len;
62986         if (results_constr.datalen > 0)
62987                 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
62988         else
62989                 results_constr.data = NULL;
62990         uint64_t* results_vals = results->elems;
62991         for (size_t w = 0; w < results_constr.datalen; w++) {
62992                 uint64_t results_conv_22 = results_vals[w];
62993                 void* results_conv_22_ptr = untag_ptr(results_conv_22);
62994                 CHECK_ACCESS(results_conv_22_ptr);
62995                 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
62996                 results_constr.data[w] = results_conv_22_conv;
62997         }
62998         FREE(results);
62999         LDKRouteParameters failed_paths_retry_conv;
63000         failed_paths_retry_conv.inner = untag_ptr(failed_paths_retry);
63001         failed_paths_retry_conv.is_owned = ptr_is_owned(failed_paths_retry);
63002         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
63003         failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
63004         LDKThirtyTwoBytes payment_id_ref;
63005         CHECK(payment_id->arr_len == 32);
63006         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
63007         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
63008         *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
63009         uint64_t ret_ref = tag_ptr(ret_copy, true);
63010         return ret_ref;
63011 }
63012
63013 jboolean  __attribute__((export_name("TS_PaymentSendFailure_eq"))) TS_PaymentSendFailure_eq(uint64_t a, uint64_t b) {
63014         LDKPaymentSendFailure* a_conv = (LDKPaymentSendFailure*)untag_ptr(a);
63015         LDKPaymentSendFailure* b_conv = (LDKPaymentSendFailure*)untag_ptr(b);
63016         jboolean ret_conv = PaymentSendFailure_eq(a_conv, b_conv);
63017         return ret_conv;
63018 }
63019
63020 void  __attribute__((export_name("TS_ProbeSendFailure_free"))) TS_ProbeSendFailure_free(uint64_t this_ptr) {
63021         if (!ptr_is_owned(this_ptr)) return;
63022         void* this_ptr_ptr = untag_ptr(this_ptr);
63023         CHECK_ACCESS(this_ptr_ptr);
63024         LDKProbeSendFailure this_ptr_conv = *(LDKProbeSendFailure*)(this_ptr_ptr);
63025         FREE(untag_ptr(this_ptr));
63026         ProbeSendFailure_free(this_ptr_conv);
63027 }
63028
63029 static inline uint64_t ProbeSendFailure_clone_ptr(LDKProbeSendFailure *NONNULL_PTR arg) {
63030         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
63031         *ret_copy = ProbeSendFailure_clone(arg);
63032         uint64_t ret_ref = tag_ptr(ret_copy, true);
63033         return ret_ref;
63034 }
63035 int64_t  __attribute__((export_name("TS_ProbeSendFailure_clone_ptr"))) TS_ProbeSendFailure_clone_ptr(uint64_t arg) {
63036         LDKProbeSendFailure* arg_conv = (LDKProbeSendFailure*)untag_ptr(arg);
63037         int64_t ret_conv = ProbeSendFailure_clone_ptr(arg_conv);
63038         return ret_conv;
63039 }
63040
63041 uint64_t  __attribute__((export_name("TS_ProbeSendFailure_clone"))) TS_ProbeSendFailure_clone(uint64_t orig) {
63042         LDKProbeSendFailure* orig_conv = (LDKProbeSendFailure*)untag_ptr(orig);
63043         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
63044         *ret_copy = ProbeSendFailure_clone(orig_conv);
63045         uint64_t ret_ref = tag_ptr(ret_copy, true);
63046         return ret_ref;
63047 }
63048
63049 uint64_t  __attribute__((export_name("TS_ProbeSendFailure_route_not_found"))) TS_ProbeSendFailure_route_not_found() {
63050         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
63051         *ret_copy = ProbeSendFailure_route_not_found();
63052         uint64_t ret_ref = tag_ptr(ret_copy, true);
63053         return ret_ref;
63054 }
63055
63056 uint64_t  __attribute__((export_name("TS_ProbeSendFailure_sending_failed"))) TS_ProbeSendFailure_sending_failed(uint64_t a) {
63057         void* a_ptr = untag_ptr(a);
63058         CHECK_ACCESS(a_ptr);
63059         LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
63060         a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(a));
63061         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
63062         *ret_copy = ProbeSendFailure_sending_failed(a_conv);
63063         uint64_t ret_ref = tag_ptr(ret_copy, true);
63064         return ret_ref;
63065 }
63066
63067 jboolean  __attribute__((export_name("TS_ProbeSendFailure_eq"))) TS_ProbeSendFailure_eq(uint64_t a, uint64_t b) {
63068         LDKProbeSendFailure* a_conv = (LDKProbeSendFailure*)untag_ptr(a);
63069         LDKProbeSendFailure* b_conv = (LDKProbeSendFailure*)untag_ptr(b);
63070         jboolean ret_conv = ProbeSendFailure_eq(a_conv, b_conv);
63071         return ret_conv;
63072 }
63073
63074 void  __attribute__((export_name("TS_RecipientOnionFields_free"))) TS_RecipientOnionFields_free(uint64_t this_obj) {
63075         LDKRecipientOnionFields this_obj_conv;
63076         this_obj_conv.inner = untag_ptr(this_obj);
63077         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63079         RecipientOnionFields_free(this_obj_conv);
63080 }
63081
63082 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_get_payment_secret"))) TS_RecipientOnionFields_get_payment_secret(uint64_t this_ptr) {
63083         LDKRecipientOnionFields this_ptr_conv;
63084         this_ptr_conv.inner = untag_ptr(this_ptr);
63085         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63087         this_ptr_conv.is_owned = false;
63088         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
63089         *ret_copy = RecipientOnionFields_get_payment_secret(&this_ptr_conv);
63090         uint64_t ret_ref = tag_ptr(ret_copy, true);
63091         return ret_ref;
63092 }
63093
63094 void  __attribute__((export_name("TS_RecipientOnionFields_set_payment_secret"))) TS_RecipientOnionFields_set_payment_secret(uint64_t this_ptr, uint64_t val) {
63095         LDKRecipientOnionFields this_ptr_conv;
63096         this_ptr_conv.inner = untag_ptr(this_ptr);
63097         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63099         this_ptr_conv.is_owned = false;
63100         void* val_ptr = untag_ptr(val);
63101         CHECK_ACCESS(val_ptr);
63102         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
63103         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
63104         RecipientOnionFields_set_payment_secret(&this_ptr_conv, val_conv);
63105 }
63106
63107 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_get_payment_metadata"))) TS_RecipientOnionFields_get_payment_metadata(uint64_t this_ptr) {
63108         LDKRecipientOnionFields this_ptr_conv;
63109         this_ptr_conv.inner = untag_ptr(this_ptr);
63110         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63112         this_ptr_conv.is_owned = false;
63113         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
63114         *ret_copy = RecipientOnionFields_get_payment_metadata(&this_ptr_conv);
63115         uint64_t ret_ref = tag_ptr(ret_copy, true);
63116         return ret_ref;
63117 }
63118
63119 void  __attribute__((export_name("TS_RecipientOnionFields_set_payment_metadata"))) TS_RecipientOnionFields_set_payment_metadata(uint64_t this_ptr, uint64_t val) {
63120         LDKRecipientOnionFields this_ptr_conv;
63121         this_ptr_conv.inner = untag_ptr(this_ptr);
63122         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63124         this_ptr_conv.is_owned = false;
63125         void* val_ptr = untag_ptr(val);
63126         CHECK_ACCESS(val_ptr);
63127         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
63128         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
63129         RecipientOnionFields_set_payment_metadata(&this_ptr_conv, val_conv);
63130 }
63131
63132 static inline uint64_t RecipientOnionFields_clone_ptr(LDKRecipientOnionFields *NONNULL_PTR arg) {
63133         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(arg);
63134         uint64_t ret_ref = 0;
63135         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63136         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63137         return ret_ref;
63138 }
63139 int64_t  __attribute__((export_name("TS_RecipientOnionFields_clone_ptr"))) TS_RecipientOnionFields_clone_ptr(uint64_t arg) {
63140         LDKRecipientOnionFields arg_conv;
63141         arg_conv.inner = untag_ptr(arg);
63142         arg_conv.is_owned = ptr_is_owned(arg);
63143         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63144         arg_conv.is_owned = false;
63145         int64_t ret_conv = RecipientOnionFields_clone_ptr(&arg_conv);
63146         return ret_conv;
63147 }
63148
63149 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_clone"))) TS_RecipientOnionFields_clone(uint64_t orig) {
63150         LDKRecipientOnionFields orig_conv;
63151         orig_conv.inner = untag_ptr(orig);
63152         orig_conv.is_owned = ptr_is_owned(orig);
63153         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63154         orig_conv.is_owned = false;
63155         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(&orig_conv);
63156         uint64_t ret_ref = 0;
63157         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63158         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63159         return ret_ref;
63160 }
63161
63162 jboolean  __attribute__((export_name("TS_RecipientOnionFields_eq"))) TS_RecipientOnionFields_eq(uint64_t a, uint64_t b) {
63163         LDKRecipientOnionFields a_conv;
63164         a_conv.inner = untag_ptr(a);
63165         a_conv.is_owned = ptr_is_owned(a);
63166         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63167         a_conv.is_owned = false;
63168         LDKRecipientOnionFields b_conv;
63169         b_conv.inner = untag_ptr(b);
63170         b_conv.is_owned = ptr_is_owned(b);
63171         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63172         b_conv.is_owned = false;
63173         jboolean ret_conv = RecipientOnionFields_eq(&a_conv, &b_conv);
63174         return ret_conv;
63175 }
63176
63177 int8_tArray  __attribute__((export_name("TS_RecipientOnionFields_write"))) TS_RecipientOnionFields_write(uint64_t obj) {
63178         LDKRecipientOnionFields obj_conv;
63179         obj_conv.inner = untag_ptr(obj);
63180         obj_conv.is_owned = ptr_is_owned(obj);
63181         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63182         obj_conv.is_owned = false;
63183         LDKCVec_u8Z ret_var = RecipientOnionFields_write(&obj_conv);
63184         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
63185         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
63186         CVec_u8Z_free(ret_var);
63187         return ret_arr;
63188 }
63189
63190 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_read"))) TS_RecipientOnionFields_read(int8_tArray ser) {
63191         LDKu8slice ser_ref;
63192         ser_ref.datalen = ser->arr_len;
63193         ser_ref.data = ser->elems;
63194         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
63195         *ret_conv = RecipientOnionFields_read(ser_ref);
63196         FREE(ser);
63197         return tag_ptr(ret_conv, true);
63198 }
63199
63200 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_secret_only"))) TS_RecipientOnionFields_secret_only(int8_tArray payment_secret) {
63201         LDKThirtyTwoBytes payment_secret_ref;
63202         CHECK(payment_secret->arr_len == 32);
63203         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
63204         LDKRecipientOnionFields ret_var = RecipientOnionFields_secret_only(payment_secret_ref);
63205         uint64_t ret_ref = 0;
63206         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63207         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63208         return ret_ref;
63209 }
63210
63211 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_spontaneous_empty"))) TS_RecipientOnionFields_spontaneous_empty() {
63212         LDKRecipientOnionFields ret_var = RecipientOnionFields_spontaneous_empty();
63213         uint64_t ret_ref = 0;
63214         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63215         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63216         return ret_ref;
63217 }
63218
63219 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_with_custom_tlvs"))) TS_RecipientOnionFields_with_custom_tlvs(uint64_t this_arg, uint64_tArray custom_tlvs) {
63220         LDKRecipientOnionFields this_arg_conv;
63221         this_arg_conv.inner = untag_ptr(this_arg);
63222         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63224         this_arg_conv = RecipientOnionFields_clone(&this_arg_conv);
63225         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_constr;
63226         custom_tlvs_constr.datalen = custom_tlvs->arr_len;
63227         if (custom_tlvs_constr.datalen > 0)
63228                 custom_tlvs_constr.data = MALLOC(custom_tlvs_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
63229         else
63230                 custom_tlvs_constr.data = NULL;
63231         uint64_t* custom_tlvs_vals = custom_tlvs->elems;
63232         for (size_t x = 0; x < custom_tlvs_constr.datalen; x++) {
63233                 uint64_t custom_tlvs_conv_23 = custom_tlvs_vals[x];
63234                 void* custom_tlvs_conv_23_ptr = untag_ptr(custom_tlvs_conv_23);
63235                 CHECK_ACCESS(custom_tlvs_conv_23_ptr);
63236                 LDKC2Tuple_u64CVec_u8ZZ custom_tlvs_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(custom_tlvs_conv_23_ptr);
63237                 custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone((LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(custom_tlvs_conv_23));
63238                 custom_tlvs_constr.data[x] = custom_tlvs_conv_23_conv;
63239         }
63240         FREE(custom_tlvs);
63241         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
63242         *ret_conv = RecipientOnionFields_with_custom_tlvs(this_arg_conv, custom_tlvs_constr);
63243         return tag_ptr(ret_conv, true);
63244 }
63245
63246 uint64_tArray  __attribute__((export_name("TS_RecipientOnionFields_custom_tlvs"))) TS_RecipientOnionFields_custom_tlvs(uint64_t this_arg) {
63247         LDKRecipientOnionFields this_arg_conv;
63248         this_arg_conv.inner = untag_ptr(this_arg);
63249         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63251         this_arg_conv.is_owned = false;
63252         LDKCVec_C2Tuple_u64CVec_u8ZZZ ret_var = RecipientOnionFields_custom_tlvs(&this_arg_conv);
63253         uint64_tArray ret_arr = NULL;
63254         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
63255         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
63256         for (size_t x = 0; x < ret_var.datalen; x++) {
63257                 LDKC2Tuple_u64CVec_u8ZZ* ret_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
63258                 *ret_conv_23_conv = ret_var.data[x];
63259                 ret_arr_ptr[x] = tag_ptr(ret_conv_23_conv, true);
63260         }
63261         
63262         FREE(ret_var.data);
63263         return ret_arr;
63264 }
63265
63266 void  __attribute__((export_name("TS_CustomMessageReader_free"))) TS_CustomMessageReader_free(uint64_t this_ptr) {
63267         if (!ptr_is_owned(this_ptr)) return;
63268         void* this_ptr_ptr = untag_ptr(this_ptr);
63269         CHECK_ACCESS(this_ptr_ptr);
63270         LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
63271         FREE(untag_ptr(this_ptr));
63272         CustomMessageReader_free(this_ptr_conv);
63273 }
63274
63275 static inline uint64_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
63276         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
63277         *ret_ret = Type_clone(arg);
63278         return tag_ptr(ret_ret, true);
63279 }
63280 int64_t  __attribute__((export_name("TS_Type_clone_ptr"))) TS_Type_clone_ptr(uint64_t arg) {
63281         void* arg_ptr = untag_ptr(arg);
63282         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
63283         LDKType* arg_conv = (LDKType*)arg_ptr;
63284         int64_t ret_conv = Type_clone_ptr(arg_conv);
63285         return ret_conv;
63286 }
63287
63288 uint64_t  __attribute__((export_name("TS_Type_clone"))) TS_Type_clone(uint64_t orig) {
63289         void* orig_ptr = untag_ptr(orig);
63290         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
63291         LDKType* orig_conv = (LDKType*)orig_ptr;
63292         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
63293         *ret_ret = Type_clone(orig_conv);
63294         return tag_ptr(ret_ret, true);
63295 }
63296
63297 void  __attribute__((export_name("TS_Type_free"))) TS_Type_free(uint64_t this_ptr) {
63298         if (!ptr_is_owned(this_ptr)) return;
63299         void* this_ptr_ptr = untag_ptr(this_ptr);
63300         CHECK_ACCESS(this_ptr_ptr);
63301         LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
63302         FREE(untag_ptr(this_ptr));
63303         Type_free(this_ptr_conv);
63304 }
63305
63306 void  __attribute__((export_name("TS_OfferId_free"))) TS_OfferId_free(uint64_t this_obj) {
63307         LDKOfferId this_obj_conv;
63308         this_obj_conv.inner = untag_ptr(this_obj);
63309         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63311         OfferId_free(this_obj_conv);
63312 }
63313
63314 int8_tArray  __attribute__((export_name("TS_OfferId_get_a"))) TS_OfferId_get_a(uint64_t this_ptr) {
63315         LDKOfferId this_ptr_conv;
63316         this_ptr_conv.inner = untag_ptr(this_ptr);
63317         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63319         this_ptr_conv.is_owned = false;
63320         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
63321         memcpy(ret_arr->elems, *OfferId_get_a(&this_ptr_conv), 32);
63322         return ret_arr;
63323 }
63324
63325 void  __attribute__((export_name("TS_OfferId_set_a"))) TS_OfferId_set_a(uint64_t this_ptr, int8_tArray val) {
63326         LDKOfferId this_ptr_conv;
63327         this_ptr_conv.inner = untag_ptr(this_ptr);
63328         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63330         this_ptr_conv.is_owned = false;
63331         LDKThirtyTwoBytes val_ref;
63332         CHECK(val->arr_len == 32);
63333         memcpy(val_ref.data, val->elems, 32); FREE(val);
63334         OfferId_set_a(&this_ptr_conv, val_ref);
63335 }
63336
63337 uint64_t  __attribute__((export_name("TS_OfferId_new"))) TS_OfferId_new(int8_tArray a_arg) {
63338         LDKThirtyTwoBytes a_arg_ref;
63339         CHECK(a_arg->arr_len == 32);
63340         memcpy(a_arg_ref.data, a_arg->elems, 32); FREE(a_arg);
63341         LDKOfferId ret_var = OfferId_new(a_arg_ref);
63342         uint64_t ret_ref = 0;
63343         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63344         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63345         return ret_ref;
63346 }
63347
63348 static inline uint64_t OfferId_clone_ptr(LDKOfferId *NONNULL_PTR arg) {
63349         LDKOfferId ret_var = OfferId_clone(arg);
63350         uint64_t ret_ref = 0;
63351         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63352         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63353         return ret_ref;
63354 }
63355 int64_t  __attribute__((export_name("TS_OfferId_clone_ptr"))) TS_OfferId_clone_ptr(uint64_t arg) {
63356         LDKOfferId arg_conv;
63357         arg_conv.inner = untag_ptr(arg);
63358         arg_conv.is_owned = ptr_is_owned(arg);
63359         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63360         arg_conv.is_owned = false;
63361         int64_t ret_conv = OfferId_clone_ptr(&arg_conv);
63362         return ret_conv;
63363 }
63364
63365 uint64_t  __attribute__((export_name("TS_OfferId_clone"))) TS_OfferId_clone(uint64_t orig) {
63366         LDKOfferId orig_conv;
63367         orig_conv.inner = untag_ptr(orig);
63368         orig_conv.is_owned = ptr_is_owned(orig);
63369         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63370         orig_conv.is_owned = false;
63371         LDKOfferId ret_var = OfferId_clone(&orig_conv);
63372         uint64_t ret_ref = 0;
63373         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63374         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63375         return ret_ref;
63376 }
63377
63378 jboolean  __attribute__((export_name("TS_OfferId_eq"))) TS_OfferId_eq(uint64_t a, uint64_t b) {
63379         LDKOfferId a_conv;
63380         a_conv.inner = untag_ptr(a);
63381         a_conv.is_owned = ptr_is_owned(a);
63382         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63383         a_conv.is_owned = false;
63384         LDKOfferId b_conv;
63385         b_conv.inner = untag_ptr(b);
63386         b_conv.is_owned = ptr_is_owned(b);
63387         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63388         b_conv.is_owned = false;
63389         jboolean ret_conv = OfferId_eq(&a_conv, &b_conv);
63390         return ret_conv;
63391 }
63392
63393 int8_tArray  __attribute__((export_name("TS_OfferId_write"))) TS_OfferId_write(uint64_t obj) {
63394         LDKOfferId obj_conv;
63395         obj_conv.inner = untag_ptr(obj);
63396         obj_conv.is_owned = ptr_is_owned(obj);
63397         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63398         obj_conv.is_owned = false;
63399         LDKCVec_u8Z ret_var = OfferId_write(&obj_conv);
63400         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
63401         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
63402         CVec_u8Z_free(ret_var);
63403         return ret_arr;
63404 }
63405
63406 uint64_t  __attribute__((export_name("TS_OfferId_read"))) TS_OfferId_read(int8_tArray ser) {
63407         LDKu8slice ser_ref;
63408         ser_ref.datalen = ser->arr_len;
63409         ser_ref.data = ser->elems;
63410         LDKCResult_OfferIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferIdDecodeErrorZ), "LDKCResult_OfferIdDecodeErrorZ");
63411         *ret_conv = OfferId_read(ser_ref);
63412         FREE(ser);
63413         return tag_ptr(ret_conv, true);
63414 }
63415
63416 void  __attribute__((export_name("TS_OfferWithExplicitMetadataBuilder_free"))) TS_OfferWithExplicitMetadataBuilder_free(uint64_t this_obj) {
63417         LDKOfferWithExplicitMetadataBuilder this_obj_conv;
63418         this_obj_conv.inner = untag_ptr(this_obj);
63419         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63421         OfferWithExplicitMetadataBuilder_free(this_obj_conv);
63422 }
63423
63424 static inline uint64_t OfferWithExplicitMetadataBuilder_clone_ptr(LDKOfferWithExplicitMetadataBuilder *NONNULL_PTR arg) {
63425         LDKOfferWithExplicitMetadataBuilder ret_var = OfferWithExplicitMetadataBuilder_clone(arg);
63426         uint64_t ret_ref = 0;
63427         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63428         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63429         return ret_ref;
63430 }
63431 int64_t  __attribute__((export_name("TS_OfferWithExplicitMetadataBuilder_clone_ptr"))) TS_OfferWithExplicitMetadataBuilder_clone_ptr(uint64_t arg) {
63432         LDKOfferWithExplicitMetadataBuilder arg_conv;
63433         arg_conv.inner = untag_ptr(arg);
63434         arg_conv.is_owned = ptr_is_owned(arg);
63435         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63436         arg_conv.is_owned = false;
63437         int64_t ret_conv = OfferWithExplicitMetadataBuilder_clone_ptr(&arg_conv);
63438         return ret_conv;
63439 }
63440
63441 uint64_t  __attribute__((export_name("TS_OfferWithExplicitMetadataBuilder_clone"))) TS_OfferWithExplicitMetadataBuilder_clone(uint64_t orig) {
63442         LDKOfferWithExplicitMetadataBuilder orig_conv;
63443         orig_conv.inner = untag_ptr(orig);
63444         orig_conv.is_owned = ptr_is_owned(orig);
63445         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63446         orig_conv.is_owned = false;
63447         LDKOfferWithExplicitMetadataBuilder ret_var = OfferWithExplicitMetadataBuilder_clone(&orig_conv);
63448         uint64_t ret_ref = 0;
63449         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63450         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63451         return ret_ref;
63452 }
63453
63454 void  __attribute__((export_name("TS_OfferWithDerivedMetadataBuilder_free"))) TS_OfferWithDerivedMetadataBuilder_free(uint64_t this_obj) {
63455         LDKOfferWithDerivedMetadataBuilder this_obj_conv;
63456         this_obj_conv.inner = untag_ptr(this_obj);
63457         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63459         OfferWithDerivedMetadataBuilder_free(this_obj_conv);
63460 }
63461
63462 static inline uint64_t OfferWithDerivedMetadataBuilder_clone_ptr(LDKOfferWithDerivedMetadataBuilder *NONNULL_PTR arg) {
63463         LDKOfferWithDerivedMetadataBuilder ret_var = OfferWithDerivedMetadataBuilder_clone(arg);
63464         uint64_t ret_ref = 0;
63465         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63466         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63467         return ret_ref;
63468 }
63469 int64_t  __attribute__((export_name("TS_OfferWithDerivedMetadataBuilder_clone_ptr"))) TS_OfferWithDerivedMetadataBuilder_clone_ptr(uint64_t arg) {
63470         LDKOfferWithDerivedMetadataBuilder arg_conv;
63471         arg_conv.inner = untag_ptr(arg);
63472         arg_conv.is_owned = ptr_is_owned(arg);
63473         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63474         arg_conv.is_owned = false;
63475         int64_t ret_conv = OfferWithDerivedMetadataBuilder_clone_ptr(&arg_conv);
63476         return ret_conv;
63477 }
63478
63479 uint64_t  __attribute__((export_name("TS_OfferWithDerivedMetadataBuilder_clone"))) TS_OfferWithDerivedMetadataBuilder_clone(uint64_t orig) {
63480         LDKOfferWithDerivedMetadataBuilder orig_conv;
63481         orig_conv.inner = untag_ptr(orig);
63482         orig_conv.is_owned = ptr_is_owned(orig);
63483         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63484         orig_conv.is_owned = false;
63485         LDKOfferWithDerivedMetadataBuilder ret_var = OfferWithDerivedMetadataBuilder_clone(&orig_conv);
63486         uint64_t ret_ref = 0;
63487         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63488         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63489         return ret_ref;
63490 }
63491
63492 uint64_t  __attribute__((export_name("TS_OfferWithExplicitMetadataBuilder_new"))) TS_OfferWithExplicitMetadataBuilder_new(int8_tArray signing_pubkey) {
63493         LDKPublicKey signing_pubkey_ref;
63494         CHECK(signing_pubkey->arr_len == 33);
63495         memcpy(signing_pubkey_ref.compressed_form, signing_pubkey->elems, 33); FREE(signing_pubkey);
63496         LDKOfferWithExplicitMetadataBuilder ret_var = OfferWithExplicitMetadataBuilder_new(signing_pubkey_ref);
63497         uint64_t ret_ref = 0;
63498         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63499         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63500         return ret_ref;
63501 }
63502
63503 uint64_t  __attribute__((export_name("TS_OfferWithExplicitMetadataBuilder_metadata"))) TS_OfferWithExplicitMetadataBuilder_metadata(uint64_t this_arg, int8_tArray metadata) {
63504         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
63505         this_arg_conv.inner = untag_ptr(this_arg);
63506         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63508         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
63509         LDKCVec_u8Z metadata_ref;
63510         metadata_ref.datalen = metadata->arr_len;
63511         metadata_ref.data = MALLOC(metadata_ref.datalen, "LDKCVec_u8Z Bytes");
63512         memcpy(metadata_ref.data, metadata->elems, metadata_ref.datalen); FREE(metadata);
63513         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
63514         *ret_conv = OfferWithExplicitMetadataBuilder_metadata(this_arg_conv, metadata_ref);
63515         return tag_ptr(ret_conv, true);
63516 }
63517
63518 void  __attribute__((export_name("TS_OfferWithExplicitMetadataBuilder_chain"))) TS_OfferWithExplicitMetadataBuilder_chain(uint64_t this_arg, uint32_t network) {
63519         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
63520         this_arg_conv.inner = untag_ptr(this_arg);
63521         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63523         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
63524         LDKNetwork network_conv = LDKNetwork_from_js(network);
63525         OfferWithExplicitMetadataBuilder_chain(this_arg_conv, network_conv);
63526 }
63527
63528 void  __attribute__((export_name("TS_OfferWithExplicitMetadataBuilder_amount_msats"))) TS_OfferWithExplicitMetadataBuilder_amount_msats(uint64_t this_arg, int64_t amount_msats) {
63529         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
63530         this_arg_conv.inner = untag_ptr(this_arg);
63531         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63533         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
63534         OfferWithExplicitMetadataBuilder_amount_msats(this_arg_conv, amount_msats);
63535 }
63536
63537 void  __attribute__((export_name("TS_OfferWithExplicitMetadataBuilder_absolute_expiry"))) TS_OfferWithExplicitMetadataBuilder_absolute_expiry(uint64_t this_arg, int64_t absolute_expiry) {
63538         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
63539         this_arg_conv.inner = untag_ptr(this_arg);
63540         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63542         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
63543         OfferWithExplicitMetadataBuilder_absolute_expiry(this_arg_conv, absolute_expiry);
63544 }
63545
63546 void  __attribute__((export_name("TS_OfferWithExplicitMetadataBuilder_description"))) TS_OfferWithExplicitMetadataBuilder_description(uint64_t this_arg, jstring description) {
63547         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
63548         this_arg_conv.inner = untag_ptr(this_arg);
63549         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63551         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
63552         LDKStr description_conv = str_ref_to_owned_c(description);
63553         OfferWithExplicitMetadataBuilder_description(this_arg_conv, description_conv);
63554 }
63555
63556 void  __attribute__((export_name("TS_OfferWithExplicitMetadataBuilder_issuer"))) TS_OfferWithExplicitMetadataBuilder_issuer(uint64_t this_arg, jstring issuer) {
63557         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
63558         this_arg_conv.inner = untag_ptr(this_arg);
63559         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63561         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
63562         LDKStr issuer_conv = str_ref_to_owned_c(issuer);
63563         OfferWithExplicitMetadataBuilder_issuer(this_arg_conv, issuer_conv);
63564 }
63565
63566 void  __attribute__((export_name("TS_OfferWithExplicitMetadataBuilder_path"))) TS_OfferWithExplicitMetadataBuilder_path(uint64_t this_arg, uint64_t path) {
63567         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
63568         this_arg_conv.inner = untag_ptr(this_arg);
63569         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63571         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
63572         LDKBlindedPath path_conv;
63573         path_conv.inner = untag_ptr(path);
63574         path_conv.is_owned = ptr_is_owned(path);
63575         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
63576         path_conv = BlindedPath_clone(&path_conv);
63577         OfferWithExplicitMetadataBuilder_path(this_arg_conv, path_conv);
63578 }
63579
63580 void  __attribute__((export_name("TS_OfferWithExplicitMetadataBuilder_supported_quantity"))) TS_OfferWithExplicitMetadataBuilder_supported_quantity(uint64_t this_arg, uint64_t quantity) {
63581         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
63582         this_arg_conv.inner = untag_ptr(this_arg);
63583         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63585         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
63586         void* quantity_ptr = untag_ptr(quantity);
63587         CHECK_ACCESS(quantity_ptr);
63588         LDKQuantity quantity_conv = *(LDKQuantity*)(quantity_ptr);
63589         quantity_conv = Quantity_clone((LDKQuantity*)untag_ptr(quantity));
63590         OfferWithExplicitMetadataBuilder_supported_quantity(this_arg_conv, quantity_conv);
63591 }
63592
63593 uint64_t  __attribute__((export_name("TS_OfferWithExplicitMetadataBuilder_build"))) TS_OfferWithExplicitMetadataBuilder_build(uint64_t this_arg) {
63594         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
63595         this_arg_conv.inner = untag_ptr(this_arg);
63596         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63598         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
63599         LDKCResult_OfferBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12SemanticErrorZ), "LDKCResult_OfferBolt12SemanticErrorZ");
63600         *ret_conv = OfferWithExplicitMetadataBuilder_build(this_arg_conv);
63601         return tag_ptr(ret_conv, true);
63602 }
63603
63604 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) {
63605         LDKPublicKey node_id_ref;
63606         CHECK(node_id->arr_len == 33);
63607         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
63608         LDKExpandedKey expanded_key_conv;
63609         expanded_key_conv.inner = untag_ptr(expanded_key);
63610         expanded_key_conv.is_owned = ptr_is_owned(expanded_key);
63611         CHECK_INNER_FIELD_ACCESS_OR_NULL(expanded_key_conv);
63612         expanded_key_conv.is_owned = false;
63613         void* entropy_source_ptr = untag_ptr(entropy_source);
63614         CHECK_ACCESS(entropy_source_ptr);
63615         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
63616         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
63617                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63618                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
63619         }
63620         LDKOfferWithDerivedMetadataBuilder ret_var = OfferWithDerivedMetadataBuilder_deriving_signing_pubkey(node_id_ref, &expanded_key_conv, entropy_source_conv);
63621         uint64_t ret_ref = 0;
63622         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63623         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63624         return ret_ref;
63625 }
63626
63627 void  __attribute__((export_name("TS_OfferWithDerivedMetadataBuilder_chain"))) TS_OfferWithDerivedMetadataBuilder_chain(uint64_t this_arg, uint32_t network) {
63628         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
63629         this_arg_conv.inner = untag_ptr(this_arg);
63630         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63632         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
63633         LDKNetwork network_conv = LDKNetwork_from_js(network);
63634         OfferWithDerivedMetadataBuilder_chain(this_arg_conv, network_conv);
63635 }
63636
63637 void  __attribute__((export_name("TS_OfferWithDerivedMetadataBuilder_amount_msats"))) TS_OfferWithDerivedMetadataBuilder_amount_msats(uint64_t this_arg, int64_t amount_msats) {
63638         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
63639         this_arg_conv.inner = untag_ptr(this_arg);
63640         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63642         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
63643         OfferWithDerivedMetadataBuilder_amount_msats(this_arg_conv, amount_msats);
63644 }
63645
63646 void  __attribute__((export_name("TS_OfferWithDerivedMetadataBuilder_absolute_expiry"))) TS_OfferWithDerivedMetadataBuilder_absolute_expiry(uint64_t this_arg, int64_t absolute_expiry) {
63647         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
63648         this_arg_conv.inner = untag_ptr(this_arg);
63649         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63651         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
63652         OfferWithDerivedMetadataBuilder_absolute_expiry(this_arg_conv, absolute_expiry);
63653 }
63654
63655 void  __attribute__((export_name("TS_OfferWithDerivedMetadataBuilder_description"))) TS_OfferWithDerivedMetadataBuilder_description(uint64_t this_arg, jstring description) {
63656         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
63657         this_arg_conv.inner = untag_ptr(this_arg);
63658         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63660         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
63661         LDKStr description_conv = str_ref_to_owned_c(description);
63662         OfferWithDerivedMetadataBuilder_description(this_arg_conv, description_conv);
63663 }
63664
63665 void  __attribute__((export_name("TS_OfferWithDerivedMetadataBuilder_issuer"))) TS_OfferWithDerivedMetadataBuilder_issuer(uint64_t this_arg, jstring issuer) {
63666         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
63667         this_arg_conv.inner = untag_ptr(this_arg);
63668         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63670         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
63671         LDKStr issuer_conv = str_ref_to_owned_c(issuer);
63672         OfferWithDerivedMetadataBuilder_issuer(this_arg_conv, issuer_conv);
63673 }
63674
63675 void  __attribute__((export_name("TS_OfferWithDerivedMetadataBuilder_path"))) TS_OfferWithDerivedMetadataBuilder_path(uint64_t this_arg, uint64_t path) {
63676         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
63677         this_arg_conv.inner = untag_ptr(this_arg);
63678         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63680         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
63681         LDKBlindedPath path_conv;
63682         path_conv.inner = untag_ptr(path);
63683         path_conv.is_owned = ptr_is_owned(path);
63684         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
63685         path_conv = BlindedPath_clone(&path_conv);
63686         OfferWithDerivedMetadataBuilder_path(this_arg_conv, path_conv);
63687 }
63688
63689 void  __attribute__((export_name("TS_OfferWithDerivedMetadataBuilder_supported_quantity"))) TS_OfferWithDerivedMetadataBuilder_supported_quantity(uint64_t this_arg, uint64_t quantity) {
63690         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
63691         this_arg_conv.inner = untag_ptr(this_arg);
63692         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63694         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
63695         void* quantity_ptr = untag_ptr(quantity);
63696         CHECK_ACCESS(quantity_ptr);
63697         LDKQuantity quantity_conv = *(LDKQuantity*)(quantity_ptr);
63698         quantity_conv = Quantity_clone((LDKQuantity*)untag_ptr(quantity));
63699         OfferWithDerivedMetadataBuilder_supported_quantity(this_arg_conv, quantity_conv);
63700 }
63701
63702 uint64_t  __attribute__((export_name("TS_OfferWithDerivedMetadataBuilder_build"))) TS_OfferWithDerivedMetadataBuilder_build(uint64_t this_arg) {
63703         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
63704         this_arg_conv.inner = untag_ptr(this_arg);
63705         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63707         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
63708         LDKCResult_OfferBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12SemanticErrorZ), "LDKCResult_OfferBolt12SemanticErrorZ");
63709         *ret_conv = OfferWithDerivedMetadataBuilder_build(this_arg_conv);
63710         return tag_ptr(ret_conv, true);
63711 }
63712
63713 void  __attribute__((export_name("TS_Offer_free"))) TS_Offer_free(uint64_t this_obj) {
63714         LDKOffer this_obj_conv;
63715         this_obj_conv.inner = untag_ptr(this_obj);
63716         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63718         Offer_free(this_obj_conv);
63719 }
63720
63721 static inline uint64_t Offer_clone_ptr(LDKOffer *NONNULL_PTR arg) {
63722         LDKOffer ret_var = Offer_clone(arg);
63723         uint64_t ret_ref = 0;
63724         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63725         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63726         return ret_ref;
63727 }
63728 int64_t  __attribute__((export_name("TS_Offer_clone_ptr"))) TS_Offer_clone_ptr(uint64_t arg) {
63729         LDKOffer arg_conv;
63730         arg_conv.inner = untag_ptr(arg);
63731         arg_conv.is_owned = ptr_is_owned(arg);
63732         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63733         arg_conv.is_owned = false;
63734         int64_t ret_conv = Offer_clone_ptr(&arg_conv);
63735         return ret_conv;
63736 }
63737
63738 uint64_t  __attribute__((export_name("TS_Offer_clone"))) TS_Offer_clone(uint64_t orig) {
63739         LDKOffer orig_conv;
63740         orig_conv.inner = untag_ptr(orig);
63741         orig_conv.is_owned = ptr_is_owned(orig);
63742         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63743         orig_conv.is_owned = false;
63744         LDKOffer ret_var = Offer_clone(&orig_conv);
63745         uint64_t ret_ref = 0;
63746         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63747         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63748         return ret_ref;
63749 }
63750
63751 ptrArray  __attribute__((export_name("TS_Offer_chains"))) TS_Offer_chains(uint64_t this_arg) {
63752         LDKOffer this_arg_conv;
63753         this_arg_conv.inner = untag_ptr(this_arg);
63754         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63756         this_arg_conv.is_owned = false;
63757         LDKCVec_ThirtyTwoBytesZ ret_var = Offer_chains(&this_arg_conv);
63758         ptrArray ret_arr = NULL;
63759         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
63760         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
63761         for (size_t m = 0; m < ret_var.datalen; m++) {
63762                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
63763                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
63764                 ret_arr_ptr[m] = ret_conv_12_arr;
63765         }
63766         
63767         FREE(ret_var.data);
63768         return ret_arr;
63769 }
63770
63771 uint64_t  __attribute__((export_name("TS_Offer_metadata"))) TS_Offer_metadata(uint64_t this_arg) {
63772         LDKOffer this_arg_conv;
63773         this_arg_conv.inner = untag_ptr(this_arg);
63774         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63776         this_arg_conv.is_owned = false;
63777         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
63778         *ret_copy = Offer_metadata(&this_arg_conv);
63779         uint64_t ret_ref = tag_ptr(ret_copy, true);
63780         return ret_ref;
63781 }
63782
63783 uint64_t  __attribute__((export_name("TS_Offer_amount"))) TS_Offer_amount(uint64_t this_arg) {
63784         LDKOffer this_arg_conv;
63785         this_arg_conv.inner = untag_ptr(this_arg);
63786         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63788         this_arg_conv.is_owned = false;
63789         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
63790         *ret_copy = Offer_amount(&this_arg_conv);
63791         uint64_t ret_ref = tag_ptr(ret_copy, true);
63792         return ret_ref;
63793 }
63794
63795 uint64_t  __attribute__((export_name("TS_Offer_description"))) TS_Offer_description(uint64_t this_arg) {
63796         LDKOffer this_arg_conv;
63797         this_arg_conv.inner = untag_ptr(this_arg);
63798         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63800         this_arg_conv.is_owned = false;
63801         LDKPrintableString ret_var = Offer_description(&this_arg_conv);
63802         uint64_t ret_ref = 0;
63803         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63804         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63805         return ret_ref;
63806 }
63807
63808 uint64_t  __attribute__((export_name("TS_Offer_offer_features"))) TS_Offer_offer_features(uint64_t this_arg) {
63809         LDKOffer this_arg_conv;
63810         this_arg_conv.inner = untag_ptr(this_arg);
63811         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63813         this_arg_conv.is_owned = false;
63814         LDKOfferFeatures ret_var = Offer_offer_features(&this_arg_conv);
63815         uint64_t ret_ref = 0;
63816         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63817         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63818         return ret_ref;
63819 }
63820
63821 uint64_t  __attribute__((export_name("TS_Offer_absolute_expiry"))) TS_Offer_absolute_expiry(uint64_t this_arg) {
63822         LDKOffer this_arg_conv;
63823         this_arg_conv.inner = untag_ptr(this_arg);
63824         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63826         this_arg_conv.is_owned = false;
63827         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
63828         *ret_copy = Offer_absolute_expiry(&this_arg_conv);
63829         uint64_t ret_ref = tag_ptr(ret_copy, true);
63830         return ret_ref;
63831 }
63832
63833 uint64_t  __attribute__((export_name("TS_Offer_issuer"))) TS_Offer_issuer(uint64_t this_arg) {
63834         LDKOffer this_arg_conv;
63835         this_arg_conv.inner = untag_ptr(this_arg);
63836         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63838         this_arg_conv.is_owned = false;
63839         LDKPrintableString ret_var = Offer_issuer(&this_arg_conv);
63840         uint64_t ret_ref = 0;
63841         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63842         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63843         return ret_ref;
63844 }
63845
63846 uint64_tArray  __attribute__((export_name("TS_Offer_paths"))) TS_Offer_paths(uint64_t this_arg) {
63847         LDKOffer this_arg_conv;
63848         this_arg_conv.inner = untag_ptr(this_arg);
63849         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63851         this_arg_conv.is_owned = false;
63852         LDKCVec_BlindedPathZ ret_var = Offer_paths(&this_arg_conv);
63853         uint64_tArray ret_arr = NULL;
63854         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
63855         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
63856         for (size_t n = 0; n < ret_var.datalen; n++) {
63857                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
63858                 uint64_t ret_conv_13_ref = 0;
63859                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
63860                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
63861                 ret_arr_ptr[n] = ret_conv_13_ref;
63862         }
63863         
63864         FREE(ret_var.data);
63865         return ret_arr;
63866 }
63867
63868 uint64_t  __attribute__((export_name("TS_Offer_supported_quantity"))) TS_Offer_supported_quantity(uint64_t this_arg) {
63869         LDKOffer this_arg_conv;
63870         this_arg_conv.inner = untag_ptr(this_arg);
63871         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63873         this_arg_conv.is_owned = false;
63874         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
63875         *ret_copy = Offer_supported_quantity(&this_arg_conv);
63876         uint64_t ret_ref = tag_ptr(ret_copy, true);
63877         return ret_ref;
63878 }
63879
63880 int8_tArray  __attribute__((export_name("TS_Offer_signing_pubkey"))) TS_Offer_signing_pubkey(uint64_t this_arg) {
63881         LDKOffer this_arg_conv;
63882         this_arg_conv.inner = untag_ptr(this_arg);
63883         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63885         this_arg_conv.is_owned = false;
63886         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
63887         memcpy(ret_arr->elems, Offer_signing_pubkey(&this_arg_conv).compressed_form, 33);
63888         return ret_arr;
63889 }
63890
63891 uint64_t  __attribute__((export_name("TS_Offer_id"))) TS_Offer_id(uint64_t this_arg) {
63892         LDKOffer this_arg_conv;
63893         this_arg_conv.inner = untag_ptr(this_arg);
63894         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63896         this_arg_conv.is_owned = false;
63897         LDKOfferId ret_var = Offer_id(&this_arg_conv);
63898         uint64_t ret_ref = 0;
63899         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63900         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63901         return ret_ref;
63902 }
63903
63904 jboolean  __attribute__((export_name("TS_Offer_supports_chain"))) TS_Offer_supports_chain(uint64_t this_arg, int8_tArray chain) {
63905         LDKOffer this_arg_conv;
63906         this_arg_conv.inner = untag_ptr(this_arg);
63907         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63909         this_arg_conv.is_owned = false;
63910         LDKThirtyTwoBytes chain_ref;
63911         CHECK(chain->arr_len == 32);
63912         memcpy(chain_ref.data, chain->elems, 32); FREE(chain);
63913         jboolean ret_conv = Offer_supports_chain(&this_arg_conv, chain_ref);
63914         return ret_conv;
63915 }
63916
63917 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) {
63918         LDKOffer this_arg_conv;
63919         this_arg_conv.inner = untag_ptr(this_arg);
63920         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63922         this_arg_conv.is_owned = false;
63923         jboolean ret_conv = Offer_is_expired_no_std(&this_arg_conv, duration_since_epoch);
63924         return ret_conv;
63925 }
63926
63927 jboolean  __attribute__((export_name("TS_Offer_is_valid_quantity"))) TS_Offer_is_valid_quantity(uint64_t this_arg, int64_t quantity) {
63928         LDKOffer this_arg_conv;
63929         this_arg_conv.inner = untag_ptr(this_arg);
63930         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63932         this_arg_conv.is_owned = false;
63933         jboolean ret_conv = Offer_is_valid_quantity(&this_arg_conv, quantity);
63934         return ret_conv;
63935 }
63936
63937 jboolean  __attribute__((export_name("TS_Offer_expects_quantity"))) TS_Offer_expects_quantity(uint64_t this_arg) {
63938         LDKOffer this_arg_conv;
63939         this_arg_conv.inner = untag_ptr(this_arg);
63940         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63942         this_arg_conv.is_owned = false;
63943         jboolean ret_conv = Offer_expects_quantity(&this_arg_conv);
63944         return ret_conv;
63945 }
63946
63947 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) {
63948         LDKOffer this_arg_conv;
63949         this_arg_conv.inner = untag_ptr(this_arg);
63950         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63952         this_arg_conv.is_owned = false;
63953         LDKExpandedKey expanded_key_conv;
63954         expanded_key_conv.inner = untag_ptr(expanded_key);
63955         expanded_key_conv.is_owned = ptr_is_owned(expanded_key);
63956         CHECK_INNER_FIELD_ACCESS_OR_NULL(expanded_key_conv);
63957         expanded_key_conv.is_owned = false;
63958         void* entropy_source_ptr = untag_ptr(entropy_source);
63959         CHECK_ACCESS(entropy_source_ptr);
63960         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
63961         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
63962                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63963                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
63964         }
63965         LDKThirtyTwoBytes payment_id_ref;
63966         CHECK(payment_id->arr_len == 32);
63967         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
63968         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ");
63969         *ret_conv = Offer_request_invoice_deriving_payer_id(&this_arg_conv, &expanded_key_conv, entropy_source_conv, payment_id_ref);
63970         return tag_ptr(ret_conv, true);
63971 }
63972
63973 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) {
63974         LDKOffer this_arg_conv;
63975         this_arg_conv.inner = untag_ptr(this_arg);
63976         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63978         this_arg_conv.is_owned = false;
63979         LDKPublicKey payer_id_ref;
63980         CHECK(payer_id->arr_len == 33);
63981         memcpy(payer_id_ref.compressed_form, payer_id->elems, 33); FREE(payer_id);
63982         LDKExpandedKey expanded_key_conv;
63983         expanded_key_conv.inner = untag_ptr(expanded_key);
63984         expanded_key_conv.is_owned = ptr_is_owned(expanded_key);
63985         CHECK_INNER_FIELD_ACCESS_OR_NULL(expanded_key_conv);
63986         expanded_key_conv.is_owned = false;
63987         void* entropy_source_ptr = untag_ptr(entropy_source);
63988         CHECK_ACCESS(entropy_source_ptr);
63989         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
63990         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
63991                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63992                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
63993         }
63994         LDKThirtyTwoBytes payment_id_ref;
63995         CHECK(payment_id->arr_len == 32);
63996         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
63997         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ");
63998         *ret_conv = Offer_request_invoice_deriving_metadata(&this_arg_conv, payer_id_ref, &expanded_key_conv, entropy_source_conv, payment_id_ref);
63999         return tag_ptr(ret_conv, true);
64000 }
64001
64002 uint64_t  __attribute__((export_name("TS_Offer_request_invoice"))) TS_Offer_request_invoice(uint64_t this_arg, int8_tArray metadata, int8_tArray payer_id) {
64003         LDKOffer this_arg_conv;
64004         this_arg_conv.inner = untag_ptr(this_arg);
64005         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64007         this_arg_conv.is_owned = false;
64008         LDKCVec_u8Z metadata_ref;
64009         metadata_ref.datalen = metadata->arr_len;
64010         metadata_ref.data = MALLOC(metadata_ref.datalen, "LDKCVec_u8Z Bytes");
64011         memcpy(metadata_ref.data, metadata->elems, metadata_ref.datalen); FREE(metadata);
64012         LDKPublicKey payer_id_ref;
64013         CHECK(payer_id->arr_len == 33);
64014         memcpy(payer_id_ref.compressed_form, payer_id->elems, 33); FREE(payer_id);
64015         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ");
64016         *ret_conv = Offer_request_invoice(&this_arg_conv, metadata_ref, payer_id_ref);
64017         return tag_ptr(ret_conv, true);
64018 }
64019
64020 int64_t  __attribute__((export_name("TS_Offer_hash"))) TS_Offer_hash(uint64_t o) {
64021         LDKOffer o_conv;
64022         o_conv.inner = untag_ptr(o);
64023         o_conv.is_owned = ptr_is_owned(o);
64024         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64025         o_conv.is_owned = false;
64026         int64_t ret_conv = Offer_hash(&o_conv);
64027         return ret_conv;
64028 }
64029
64030 int8_tArray  __attribute__((export_name("TS_Offer_write"))) TS_Offer_write(uint64_t obj) {
64031         LDKOffer obj_conv;
64032         obj_conv.inner = untag_ptr(obj);
64033         obj_conv.is_owned = ptr_is_owned(obj);
64034         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64035         obj_conv.is_owned = false;
64036         LDKCVec_u8Z ret_var = Offer_write(&obj_conv);
64037         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64038         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64039         CVec_u8Z_free(ret_var);
64040         return ret_arr;
64041 }
64042
64043 void  __attribute__((export_name("TS_Amount_free"))) TS_Amount_free(uint64_t this_ptr) {
64044         if (!ptr_is_owned(this_ptr)) return;
64045         void* this_ptr_ptr = untag_ptr(this_ptr);
64046         CHECK_ACCESS(this_ptr_ptr);
64047         LDKAmount this_ptr_conv = *(LDKAmount*)(this_ptr_ptr);
64048         FREE(untag_ptr(this_ptr));
64049         Amount_free(this_ptr_conv);
64050 }
64051
64052 static inline uint64_t Amount_clone_ptr(LDKAmount *NONNULL_PTR arg) {
64053         LDKAmount *ret_copy = MALLOC(sizeof(LDKAmount), "LDKAmount");
64054         *ret_copy = Amount_clone(arg);
64055         uint64_t ret_ref = tag_ptr(ret_copy, true);
64056         return ret_ref;
64057 }
64058 int64_t  __attribute__((export_name("TS_Amount_clone_ptr"))) TS_Amount_clone_ptr(uint64_t arg) {
64059         LDKAmount* arg_conv = (LDKAmount*)untag_ptr(arg);
64060         int64_t ret_conv = Amount_clone_ptr(arg_conv);
64061         return ret_conv;
64062 }
64063
64064 uint64_t  __attribute__((export_name("TS_Amount_clone"))) TS_Amount_clone(uint64_t orig) {
64065         LDKAmount* orig_conv = (LDKAmount*)untag_ptr(orig);
64066         LDKAmount *ret_copy = MALLOC(sizeof(LDKAmount), "LDKAmount");
64067         *ret_copy = Amount_clone(orig_conv);
64068         uint64_t ret_ref = tag_ptr(ret_copy, true);
64069         return ret_ref;
64070 }
64071
64072 uint64_t  __attribute__((export_name("TS_Amount_bitcoin"))) TS_Amount_bitcoin(int64_t amount_msats) {
64073         LDKAmount *ret_copy = MALLOC(sizeof(LDKAmount), "LDKAmount");
64074         *ret_copy = Amount_bitcoin(amount_msats);
64075         uint64_t ret_ref = tag_ptr(ret_copy, true);
64076         return ret_ref;
64077 }
64078
64079 uint64_t  __attribute__((export_name("TS_Amount_currency"))) TS_Amount_currency(int8_tArray iso4217_code, int64_t amount) {
64080         LDKThreeBytes iso4217_code_ref;
64081         CHECK(iso4217_code->arr_len == 3);
64082         memcpy(iso4217_code_ref.data, iso4217_code->elems, 3); FREE(iso4217_code);
64083         LDKAmount *ret_copy = MALLOC(sizeof(LDKAmount), "LDKAmount");
64084         *ret_copy = Amount_currency(iso4217_code_ref, amount);
64085         uint64_t ret_ref = tag_ptr(ret_copy, true);
64086         return ret_ref;
64087 }
64088
64089 void  __attribute__((export_name("TS_Quantity_free"))) TS_Quantity_free(uint64_t this_ptr) {
64090         if (!ptr_is_owned(this_ptr)) return;
64091         void* this_ptr_ptr = untag_ptr(this_ptr);
64092         CHECK_ACCESS(this_ptr_ptr);
64093         LDKQuantity this_ptr_conv = *(LDKQuantity*)(this_ptr_ptr);
64094         FREE(untag_ptr(this_ptr));
64095         Quantity_free(this_ptr_conv);
64096 }
64097
64098 static inline uint64_t Quantity_clone_ptr(LDKQuantity *NONNULL_PTR arg) {
64099         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
64100         *ret_copy = Quantity_clone(arg);
64101         uint64_t ret_ref = tag_ptr(ret_copy, true);
64102         return ret_ref;
64103 }
64104 int64_t  __attribute__((export_name("TS_Quantity_clone_ptr"))) TS_Quantity_clone_ptr(uint64_t arg) {
64105         LDKQuantity* arg_conv = (LDKQuantity*)untag_ptr(arg);
64106         int64_t ret_conv = Quantity_clone_ptr(arg_conv);
64107         return ret_conv;
64108 }
64109
64110 uint64_t  __attribute__((export_name("TS_Quantity_clone"))) TS_Quantity_clone(uint64_t orig) {
64111         LDKQuantity* orig_conv = (LDKQuantity*)untag_ptr(orig);
64112         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
64113         *ret_copy = Quantity_clone(orig_conv);
64114         uint64_t ret_ref = tag_ptr(ret_copy, true);
64115         return ret_ref;
64116 }
64117
64118 uint64_t  __attribute__((export_name("TS_Quantity_bounded"))) TS_Quantity_bounded(int64_t a) {
64119         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
64120         *ret_copy = Quantity_bounded(a);
64121         uint64_t ret_ref = tag_ptr(ret_copy, true);
64122         return ret_ref;
64123 }
64124
64125 uint64_t  __attribute__((export_name("TS_Quantity_unbounded"))) TS_Quantity_unbounded() {
64126         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
64127         *ret_copy = Quantity_unbounded();
64128         uint64_t ret_ref = tag_ptr(ret_copy, true);
64129         return ret_ref;
64130 }
64131
64132 uint64_t  __attribute__((export_name("TS_Quantity_one"))) TS_Quantity_one() {
64133         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
64134         *ret_copy = Quantity_one();
64135         uint64_t ret_ref = tag_ptr(ret_copy, true);
64136         return ret_ref;
64137 }
64138
64139 uint64_t  __attribute__((export_name("TS_Offer_from_str"))) TS_Offer_from_str(jstring s) {
64140         LDKStr s_conv = str_ref_to_owned_c(s);
64141         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
64142         *ret_conv = Offer_from_str(s_conv);
64143         return tag_ptr(ret_conv, true);
64144 }
64145
64146 void  __attribute__((export_name("TS_InvoiceWithExplicitSigningPubkeyBuilder_free"))) TS_InvoiceWithExplicitSigningPubkeyBuilder_free(uint64_t this_obj) {
64147         LDKInvoiceWithExplicitSigningPubkeyBuilder this_obj_conv;
64148         this_obj_conv.inner = untag_ptr(this_obj);
64149         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64151         InvoiceWithExplicitSigningPubkeyBuilder_free(this_obj_conv);
64152 }
64153
64154 void  __attribute__((export_name("TS_InvoiceWithDerivedSigningPubkeyBuilder_free"))) TS_InvoiceWithDerivedSigningPubkeyBuilder_free(uint64_t this_obj) {
64155         LDKInvoiceWithDerivedSigningPubkeyBuilder this_obj_conv;
64156         this_obj_conv.inner = untag_ptr(this_obj);
64157         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64159         InvoiceWithDerivedSigningPubkeyBuilder_free(this_obj_conv);
64160 }
64161
64162 uint64_t  __attribute__((export_name("TS_InvoiceWithExplicitSigningPubkeyBuilder_build"))) TS_InvoiceWithExplicitSigningPubkeyBuilder_build(uint64_t this_arg) {
64163         LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg_conv;
64164         this_arg_conv.inner = untag_ptr(this_arg);
64165         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64167         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
64168         
64169         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ");
64170         *ret_conv = InvoiceWithExplicitSigningPubkeyBuilder_build(this_arg_conv);
64171         return tag_ptr(ret_conv, true);
64172 }
64173
64174 void  __attribute__((export_name("TS_InvoiceWithExplicitSigningPubkeyBuilder_relative_expiry"))) TS_InvoiceWithExplicitSigningPubkeyBuilder_relative_expiry(uint64_t this_arg, int32_t relative_expiry_secs) {
64175         LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg_conv;
64176         this_arg_conv.inner = untag_ptr(this_arg);
64177         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64179         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
64180         
64181         InvoiceWithExplicitSigningPubkeyBuilder_relative_expiry(this_arg_conv, relative_expiry_secs);
64182 }
64183
64184 void  __attribute__((export_name("TS_InvoiceWithExplicitSigningPubkeyBuilder_fallback_v0_p2wsh"))) TS_InvoiceWithExplicitSigningPubkeyBuilder_fallback_v0_p2wsh(uint64_t this_arg, int8_tArray script_hash) {
64185         LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg_conv;
64186         this_arg_conv.inner = untag_ptr(this_arg);
64187         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64189         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
64190         
64191         uint8_t script_hash_arr[32];
64192         CHECK(script_hash->arr_len == 32);
64193         memcpy(script_hash_arr, script_hash->elems, 32); FREE(script_hash);
64194         uint8_t (*script_hash_ref)[32] = &script_hash_arr;
64195         InvoiceWithExplicitSigningPubkeyBuilder_fallback_v0_p2wsh(this_arg_conv, script_hash_ref);
64196 }
64197
64198 void  __attribute__((export_name("TS_InvoiceWithExplicitSigningPubkeyBuilder_fallback_v0_p2wpkh"))) TS_InvoiceWithExplicitSigningPubkeyBuilder_fallback_v0_p2wpkh(uint64_t this_arg, int8_tArray pubkey_hash) {
64199         LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg_conv;
64200         this_arg_conv.inner = untag_ptr(this_arg);
64201         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64203         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
64204         
64205         uint8_t pubkey_hash_arr[20];
64206         CHECK(pubkey_hash->arr_len == 20);
64207         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
64208         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
64209         InvoiceWithExplicitSigningPubkeyBuilder_fallback_v0_p2wpkh(this_arg_conv, pubkey_hash_ref);
64210 }
64211
64212 void  __attribute__((export_name("TS_InvoiceWithExplicitSigningPubkeyBuilder_fallback_v1_p2tr_tweaked"))) TS_InvoiceWithExplicitSigningPubkeyBuilder_fallback_v1_p2tr_tweaked(uint64_t this_arg, int8_tArray utput_key) {
64213         LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg_conv;
64214         this_arg_conv.inner = untag_ptr(this_arg);
64215         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64217         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
64218         
64219         LDKTweakedPublicKey utput_key_ref;
64220         CHECK(utput_key->arr_len == 32);
64221         memcpy(utput_key_ref.x_coordinate, utput_key->elems, 32); FREE(utput_key);
64222         InvoiceWithExplicitSigningPubkeyBuilder_fallback_v1_p2tr_tweaked(this_arg_conv, utput_key_ref);
64223 }
64224
64225 void  __attribute__((export_name("TS_InvoiceWithExplicitSigningPubkeyBuilder_allow_mpp"))) TS_InvoiceWithExplicitSigningPubkeyBuilder_allow_mpp(uint64_t this_arg) {
64226         LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg_conv;
64227         this_arg_conv.inner = untag_ptr(this_arg);
64228         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64230         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
64231         
64232         InvoiceWithExplicitSigningPubkeyBuilder_allow_mpp(this_arg_conv);
64233 }
64234
64235 uint64_t  __attribute__((export_name("TS_InvoiceWithDerivedSigningPubkeyBuilder_build_and_sign"))) TS_InvoiceWithDerivedSigningPubkeyBuilder_build_and_sign(uint64_t this_arg) {
64236         LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg_conv;
64237         this_arg_conv.inner = untag_ptr(this_arg);
64238         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64240         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
64241         
64242         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ");
64243         *ret_conv = InvoiceWithDerivedSigningPubkeyBuilder_build_and_sign(this_arg_conv);
64244         return tag_ptr(ret_conv, true);
64245 }
64246
64247 void  __attribute__((export_name("TS_InvoiceWithDerivedSigningPubkeyBuilder_relative_expiry"))) TS_InvoiceWithDerivedSigningPubkeyBuilder_relative_expiry(uint64_t this_arg, int32_t relative_expiry_secs) {
64248         LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg_conv;
64249         this_arg_conv.inner = untag_ptr(this_arg);
64250         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64252         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
64253         
64254         InvoiceWithDerivedSigningPubkeyBuilder_relative_expiry(this_arg_conv, relative_expiry_secs);
64255 }
64256
64257 void  __attribute__((export_name("TS_InvoiceWithDerivedSigningPubkeyBuilder_fallback_v0_p2wsh"))) TS_InvoiceWithDerivedSigningPubkeyBuilder_fallback_v0_p2wsh(uint64_t this_arg, int8_tArray script_hash) {
64258         LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg_conv;
64259         this_arg_conv.inner = untag_ptr(this_arg);
64260         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64262         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
64263         
64264         uint8_t script_hash_arr[32];
64265         CHECK(script_hash->arr_len == 32);
64266         memcpy(script_hash_arr, script_hash->elems, 32); FREE(script_hash);
64267         uint8_t (*script_hash_ref)[32] = &script_hash_arr;
64268         InvoiceWithDerivedSigningPubkeyBuilder_fallback_v0_p2wsh(this_arg_conv, script_hash_ref);
64269 }
64270
64271 void  __attribute__((export_name("TS_InvoiceWithDerivedSigningPubkeyBuilder_fallback_v0_p2wpkh"))) TS_InvoiceWithDerivedSigningPubkeyBuilder_fallback_v0_p2wpkh(uint64_t this_arg, int8_tArray pubkey_hash) {
64272         LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg_conv;
64273         this_arg_conv.inner = untag_ptr(this_arg);
64274         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64276         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
64277         
64278         uint8_t pubkey_hash_arr[20];
64279         CHECK(pubkey_hash->arr_len == 20);
64280         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
64281         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
64282         InvoiceWithDerivedSigningPubkeyBuilder_fallback_v0_p2wpkh(this_arg_conv, pubkey_hash_ref);
64283 }
64284
64285 void  __attribute__((export_name("TS_InvoiceWithDerivedSigningPubkeyBuilder_fallback_v1_p2tr_tweaked"))) TS_InvoiceWithDerivedSigningPubkeyBuilder_fallback_v1_p2tr_tweaked(uint64_t this_arg, int8_tArray utput_key) {
64286         LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg_conv;
64287         this_arg_conv.inner = untag_ptr(this_arg);
64288         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64290         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
64291         
64292         LDKTweakedPublicKey utput_key_ref;
64293         CHECK(utput_key->arr_len == 32);
64294         memcpy(utput_key_ref.x_coordinate, utput_key->elems, 32); FREE(utput_key);
64295         InvoiceWithDerivedSigningPubkeyBuilder_fallback_v1_p2tr_tweaked(this_arg_conv, utput_key_ref);
64296 }
64297
64298 void  __attribute__((export_name("TS_InvoiceWithDerivedSigningPubkeyBuilder_allow_mpp"))) TS_InvoiceWithDerivedSigningPubkeyBuilder_allow_mpp(uint64_t this_arg) {
64299         LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg_conv;
64300         this_arg_conv.inner = untag_ptr(this_arg);
64301         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64303         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
64304         
64305         InvoiceWithDerivedSigningPubkeyBuilder_allow_mpp(this_arg_conv);
64306 }
64307
64308 void  __attribute__((export_name("TS_UnsignedBolt12Invoice_free"))) TS_UnsignedBolt12Invoice_free(uint64_t this_obj) {
64309         LDKUnsignedBolt12Invoice this_obj_conv;
64310         this_obj_conv.inner = untag_ptr(this_obj);
64311         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64313         UnsignedBolt12Invoice_free(this_obj_conv);
64314 }
64315
64316 static inline uint64_t UnsignedBolt12Invoice_clone_ptr(LDKUnsignedBolt12Invoice *NONNULL_PTR arg) {
64317         LDKUnsignedBolt12Invoice ret_var = UnsignedBolt12Invoice_clone(arg);
64318         uint64_t ret_ref = 0;
64319         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64320         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64321         return ret_ref;
64322 }
64323 int64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_clone_ptr"))) TS_UnsignedBolt12Invoice_clone_ptr(uint64_t arg) {
64324         LDKUnsignedBolt12Invoice arg_conv;
64325         arg_conv.inner = untag_ptr(arg);
64326         arg_conv.is_owned = ptr_is_owned(arg);
64327         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64328         arg_conv.is_owned = false;
64329         int64_t ret_conv = UnsignedBolt12Invoice_clone_ptr(&arg_conv);
64330         return ret_conv;
64331 }
64332
64333 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_clone"))) TS_UnsignedBolt12Invoice_clone(uint64_t orig) {
64334         LDKUnsignedBolt12Invoice orig_conv;
64335         orig_conv.inner = untag_ptr(orig);
64336         orig_conv.is_owned = ptr_is_owned(orig);
64337         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64338         orig_conv.is_owned = false;
64339         LDKUnsignedBolt12Invoice ret_var = UnsignedBolt12Invoice_clone(&orig_conv);
64340         uint64_t ret_ref = 0;
64341         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64342         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64343         return ret_ref;
64344 }
64345
64346 void  __attribute__((export_name("TS_SignBolt12InvoiceFn_free"))) TS_SignBolt12InvoiceFn_free(uint64_t this_ptr) {
64347         if (!ptr_is_owned(this_ptr)) return;
64348         void* this_ptr_ptr = untag_ptr(this_ptr);
64349         CHECK_ACCESS(this_ptr_ptr);
64350         LDKSignBolt12InvoiceFn this_ptr_conv = *(LDKSignBolt12InvoiceFn*)(this_ptr_ptr);
64351         FREE(untag_ptr(this_ptr));
64352         SignBolt12InvoiceFn_free(this_ptr_conv);
64353 }
64354
64355 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_tagged_hash"))) TS_UnsignedBolt12Invoice_tagged_hash(uint64_t this_arg) {
64356         LDKUnsignedBolt12Invoice this_arg_conv;
64357         this_arg_conv.inner = untag_ptr(this_arg);
64358         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64360         this_arg_conv.is_owned = false;
64361         LDKTaggedHash ret_var = UnsignedBolt12Invoice_tagged_hash(&this_arg_conv);
64362         uint64_t ret_ref = 0;
64363         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64364         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64365         return ret_ref;
64366 }
64367
64368 void  __attribute__((export_name("TS_Bolt12Invoice_free"))) TS_Bolt12Invoice_free(uint64_t this_obj) {
64369         LDKBolt12Invoice this_obj_conv;
64370         this_obj_conv.inner = untag_ptr(this_obj);
64371         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64373         Bolt12Invoice_free(this_obj_conv);
64374 }
64375
64376 static inline uint64_t Bolt12Invoice_clone_ptr(LDKBolt12Invoice *NONNULL_PTR arg) {
64377         LDKBolt12Invoice ret_var = Bolt12Invoice_clone(arg);
64378         uint64_t ret_ref = 0;
64379         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64380         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64381         return ret_ref;
64382 }
64383 int64_t  __attribute__((export_name("TS_Bolt12Invoice_clone_ptr"))) TS_Bolt12Invoice_clone_ptr(uint64_t arg) {
64384         LDKBolt12Invoice arg_conv;
64385         arg_conv.inner = untag_ptr(arg);
64386         arg_conv.is_owned = ptr_is_owned(arg);
64387         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64388         arg_conv.is_owned = false;
64389         int64_t ret_conv = Bolt12Invoice_clone_ptr(&arg_conv);
64390         return ret_conv;
64391 }
64392
64393 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_clone"))) TS_Bolt12Invoice_clone(uint64_t orig) {
64394         LDKBolt12Invoice orig_conv;
64395         orig_conv.inner = untag_ptr(orig);
64396         orig_conv.is_owned = ptr_is_owned(orig);
64397         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64398         orig_conv.is_owned = false;
64399         LDKBolt12Invoice ret_var = Bolt12Invoice_clone(&orig_conv);
64400         uint64_t ret_ref = 0;
64401         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64402         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64403         return ret_ref;
64404 }
64405
64406 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_offer_chains"))) TS_UnsignedBolt12Invoice_offer_chains(uint64_t this_arg) {
64407         LDKUnsignedBolt12Invoice this_arg_conv;
64408         this_arg_conv.inner = untag_ptr(this_arg);
64409         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64411         this_arg_conv.is_owned = false;
64412         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
64413         *ret_copy = UnsignedBolt12Invoice_offer_chains(&this_arg_conv);
64414         uint64_t ret_ref = tag_ptr(ret_copy, true);
64415         return ret_ref;
64416 }
64417
64418 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_chain"))) TS_UnsignedBolt12Invoice_chain(uint64_t this_arg) {
64419         LDKUnsignedBolt12Invoice this_arg_conv;
64420         this_arg_conv.inner = untag_ptr(this_arg);
64421         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64423         this_arg_conv.is_owned = false;
64424         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
64425         memcpy(ret_arr->elems, UnsignedBolt12Invoice_chain(&this_arg_conv).data, 32);
64426         return ret_arr;
64427 }
64428
64429 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_metadata"))) TS_UnsignedBolt12Invoice_metadata(uint64_t this_arg) {
64430         LDKUnsignedBolt12Invoice this_arg_conv;
64431         this_arg_conv.inner = untag_ptr(this_arg);
64432         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64434         this_arg_conv.is_owned = false;
64435         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
64436         *ret_copy = UnsignedBolt12Invoice_metadata(&this_arg_conv);
64437         uint64_t ret_ref = tag_ptr(ret_copy, true);
64438         return ret_ref;
64439 }
64440
64441 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_amount"))) TS_UnsignedBolt12Invoice_amount(uint64_t this_arg) {
64442         LDKUnsignedBolt12Invoice this_arg_conv;
64443         this_arg_conv.inner = untag_ptr(this_arg);
64444         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64446         this_arg_conv.is_owned = false;
64447         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
64448         *ret_copy = UnsignedBolt12Invoice_amount(&this_arg_conv);
64449         uint64_t ret_ref = tag_ptr(ret_copy, true);
64450         return ret_ref;
64451 }
64452
64453 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_offer_features"))) TS_UnsignedBolt12Invoice_offer_features(uint64_t this_arg) {
64454         LDKUnsignedBolt12Invoice this_arg_conv;
64455         this_arg_conv.inner = untag_ptr(this_arg);
64456         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64458         this_arg_conv.is_owned = false;
64459         LDKOfferFeatures ret_var = UnsignedBolt12Invoice_offer_features(&this_arg_conv);
64460         uint64_t ret_ref = 0;
64461         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64462         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64463         return ret_ref;
64464 }
64465
64466 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_description"))) TS_UnsignedBolt12Invoice_description(uint64_t this_arg) {
64467         LDKUnsignedBolt12Invoice this_arg_conv;
64468         this_arg_conv.inner = untag_ptr(this_arg);
64469         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64471         this_arg_conv.is_owned = false;
64472         LDKPrintableString ret_var = UnsignedBolt12Invoice_description(&this_arg_conv);
64473         uint64_t ret_ref = 0;
64474         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64475         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64476         return ret_ref;
64477 }
64478
64479 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_absolute_expiry"))) TS_UnsignedBolt12Invoice_absolute_expiry(uint64_t this_arg) {
64480         LDKUnsignedBolt12Invoice this_arg_conv;
64481         this_arg_conv.inner = untag_ptr(this_arg);
64482         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64484         this_arg_conv.is_owned = false;
64485         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
64486         *ret_copy = UnsignedBolt12Invoice_absolute_expiry(&this_arg_conv);
64487         uint64_t ret_ref = tag_ptr(ret_copy, true);
64488         return ret_ref;
64489 }
64490
64491 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_issuer"))) TS_UnsignedBolt12Invoice_issuer(uint64_t this_arg) {
64492         LDKUnsignedBolt12Invoice this_arg_conv;
64493         this_arg_conv.inner = untag_ptr(this_arg);
64494         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64496         this_arg_conv.is_owned = false;
64497         LDKPrintableString ret_var = UnsignedBolt12Invoice_issuer(&this_arg_conv);
64498         uint64_t ret_ref = 0;
64499         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64500         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64501         return ret_ref;
64502 }
64503
64504 uint64_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_message_paths"))) TS_UnsignedBolt12Invoice_message_paths(uint64_t this_arg) {
64505         LDKUnsignedBolt12Invoice this_arg_conv;
64506         this_arg_conv.inner = untag_ptr(this_arg);
64507         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64509         this_arg_conv.is_owned = false;
64510         LDKCVec_BlindedPathZ ret_var = UnsignedBolt12Invoice_message_paths(&this_arg_conv);
64511         uint64_tArray ret_arr = NULL;
64512         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
64513         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
64514         for (size_t n = 0; n < ret_var.datalen; n++) {
64515                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
64516                 uint64_t ret_conv_13_ref = 0;
64517                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
64518                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
64519                 ret_arr_ptr[n] = ret_conv_13_ref;
64520         }
64521         
64522         FREE(ret_var.data);
64523         return ret_arr;
64524 }
64525
64526 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_supported_quantity"))) TS_UnsignedBolt12Invoice_supported_quantity(uint64_t this_arg) {
64527         LDKUnsignedBolt12Invoice this_arg_conv;
64528         this_arg_conv.inner = untag_ptr(this_arg);
64529         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64531         this_arg_conv.is_owned = false;
64532         LDKCOption_QuantityZ *ret_copy = MALLOC(sizeof(LDKCOption_QuantityZ), "LDKCOption_QuantityZ");
64533         *ret_copy = UnsignedBolt12Invoice_supported_quantity(&this_arg_conv);
64534         uint64_t ret_ref = tag_ptr(ret_copy, true);
64535         return ret_ref;
64536 }
64537
64538 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_payer_metadata"))) TS_UnsignedBolt12Invoice_payer_metadata(uint64_t this_arg) {
64539         LDKUnsignedBolt12Invoice this_arg_conv;
64540         this_arg_conv.inner = untag_ptr(this_arg);
64541         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64543         this_arg_conv.is_owned = false;
64544         LDKu8slice ret_var = UnsignedBolt12Invoice_payer_metadata(&this_arg_conv);
64545         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64546         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64547         return ret_arr;
64548 }
64549
64550 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_invoice_request_features"))) TS_UnsignedBolt12Invoice_invoice_request_features(uint64_t this_arg) {
64551         LDKUnsignedBolt12Invoice this_arg_conv;
64552         this_arg_conv.inner = untag_ptr(this_arg);
64553         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64555         this_arg_conv.is_owned = false;
64556         LDKInvoiceRequestFeatures ret_var = UnsignedBolt12Invoice_invoice_request_features(&this_arg_conv);
64557         uint64_t ret_ref = 0;
64558         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64559         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64560         return ret_ref;
64561 }
64562
64563 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_quantity"))) TS_UnsignedBolt12Invoice_quantity(uint64_t this_arg) {
64564         LDKUnsignedBolt12Invoice this_arg_conv;
64565         this_arg_conv.inner = untag_ptr(this_arg);
64566         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64568         this_arg_conv.is_owned = false;
64569         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
64570         *ret_copy = UnsignedBolt12Invoice_quantity(&this_arg_conv);
64571         uint64_t ret_ref = tag_ptr(ret_copy, true);
64572         return ret_ref;
64573 }
64574
64575 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_payer_id"))) TS_UnsignedBolt12Invoice_payer_id(uint64_t this_arg) {
64576         LDKUnsignedBolt12Invoice this_arg_conv;
64577         this_arg_conv.inner = untag_ptr(this_arg);
64578         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64580         this_arg_conv.is_owned = false;
64581         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
64582         memcpy(ret_arr->elems, UnsignedBolt12Invoice_payer_id(&this_arg_conv).compressed_form, 33);
64583         return ret_arr;
64584 }
64585
64586 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_payer_note"))) TS_UnsignedBolt12Invoice_payer_note(uint64_t this_arg) {
64587         LDKUnsignedBolt12Invoice this_arg_conv;
64588         this_arg_conv.inner = untag_ptr(this_arg);
64589         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64591         this_arg_conv.is_owned = false;
64592         LDKPrintableString ret_var = UnsignedBolt12Invoice_payer_note(&this_arg_conv);
64593         uint64_t ret_ref = 0;
64594         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64595         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64596         return ret_ref;
64597 }
64598
64599 int64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_created_at"))) TS_UnsignedBolt12Invoice_created_at(uint64_t this_arg) {
64600         LDKUnsignedBolt12Invoice this_arg_conv;
64601         this_arg_conv.inner = untag_ptr(this_arg);
64602         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64604         this_arg_conv.is_owned = false;
64605         int64_t ret_conv = UnsignedBolt12Invoice_created_at(&this_arg_conv);
64606         return ret_conv;
64607 }
64608
64609 int64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_relative_expiry"))) TS_UnsignedBolt12Invoice_relative_expiry(uint64_t this_arg) {
64610         LDKUnsignedBolt12Invoice this_arg_conv;
64611         this_arg_conv.inner = untag_ptr(this_arg);
64612         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64614         this_arg_conv.is_owned = false;
64615         int64_t ret_conv = UnsignedBolt12Invoice_relative_expiry(&this_arg_conv);
64616         return ret_conv;
64617 }
64618
64619 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_payment_hash"))) TS_UnsignedBolt12Invoice_payment_hash(uint64_t this_arg) {
64620         LDKUnsignedBolt12Invoice this_arg_conv;
64621         this_arg_conv.inner = untag_ptr(this_arg);
64622         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64624         this_arg_conv.is_owned = false;
64625         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
64626         memcpy(ret_arr->elems, UnsignedBolt12Invoice_payment_hash(&this_arg_conv).data, 32);
64627         return ret_arr;
64628 }
64629
64630 int64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_amount_msats"))) TS_UnsignedBolt12Invoice_amount_msats(uint64_t this_arg) {
64631         LDKUnsignedBolt12Invoice this_arg_conv;
64632         this_arg_conv.inner = untag_ptr(this_arg);
64633         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64635         this_arg_conv.is_owned = false;
64636         int64_t ret_conv = UnsignedBolt12Invoice_amount_msats(&this_arg_conv);
64637         return ret_conv;
64638 }
64639
64640 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_invoice_features"))) TS_UnsignedBolt12Invoice_invoice_features(uint64_t this_arg) {
64641         LDKUnsignedBolt12Invoice this_arg_conv;
64642         this_arg_conv.inner = untag_ptr(this_arg);
64643         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64645         this_arg_conv.is_owned = false;
64646         LDKBolt12InvoiceFeatures ret_var = UnsignedBolt12Invoice_invoice_features(&this_arg_conv);
64647         uint64_t ret_ref = 0;
64648         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64649         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64650         return ret_ref;
64651 }
64652
64653 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_signing_pubkey"))) TS_UnsignedBolt12Invoice_signing_pubkey(uint64_t this_arg) {
64654         LDKUnsignedBolt12Invoice this_arg_conv;
64655         this_arg_conv.inner = untag_ptr(this_arg);
64656         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64658         this_arg_conv.is_owned = false;
64659         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
64660         memcpy(ret_arr->elems, UnsignedBolt12Invoice_signing_pubkey(&this_arg_conv).compressed_form, 33);
64661         return ret_arr;
64662 }
64663
64664 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_offer_chains"))) TS_Bolt12Invoice_offer_chains(uint64_t this_arg) {
64665         LDKBolt12Invoice this_arg_conv;
64666         this_arg_conv.inner = untag_ptr(this_arg);
64667         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64669         this_arg_conv.is_owned = false;
64670         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
64671         *ret_copy = Bolt12Invoice_offer_chains(&this_arg_conv);
64672         uint64_t ret_ref = tag_ptr(ret_copy, true);
64673         return ret_ref;
64674 }
64675
64676 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_chain"))) TS_Bolt12Invoice_chain(uint64_t this_arg) {
64677         LDKBolt12Invoice this_arg_conv;
64678         this_arg_conv.inner = untag_ptr(this_arg);
64679         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64681         this_arg_conv.is_owned = false;
64682         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
64683         memcpy(ret_arr->elems, Bolt12Invoice_chain(&this_arg_conv).data, 32);
64684         return ret_arr;
64685 }
64686
64687 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_metadata"))) TS_Bolt12Invoice_metadata(uint64_t this_arg) {
64688         LDKBolt12Invoice this_arg_conv;
64689         this_arg_conv.inner = untag_ptr(this_arg);
64690         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64692         this_arg_conv.is_owned = false;
64693         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
64694         *ret_copy = Bolt12Invoice_metadata(&this_arg_conv);
64695         uint64_t ret_ref = tag_ptr(ret_copy, true);
64696         return ret_ref;
64697 }
64698
64699 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_amount"))) TS_Bolt12Invoice_amount(uint64_t this_arg) {
64700         LDKBolt12Invoice this_arg_conv;
64701         this_arg_conv.inner = untag_ptr(this_arg);
64702         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64704         this_arg_conv.is_owned = false;
64705         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
64706         *ret_copy = Bolt12Invoice_amount(&this_arg_conv);
64707         uint64_t ret_ref = tag_ptr(ret_copy, true);
64708         return ret_ref;
64709 }
64710
64711 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_offer_features"))) TS_Bolt12Invoice_offer_features(uint64_t this_arg) {
64712         LDKBolt12Invoice this_arg_conv;
64713         this_arg_conv.inner = untag_ptr(this_arg);
64714         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64716         this_arg_conv.is_owned = false;
64717         LDKOfferFeatures ret_var = Bolt12Invoice_offer_features(&this_arg_conv);
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
64724 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_description"))) TS_Bolt12Invoice_description(uint64_t this_arg) {
64725         LDKBolt12Invoice this_arg_conv;
64726         this_arg_conv.inner = untag_ptr(this_arg);
64727         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64729         this_arg_conv.is_owned = false;
64730         LDKPrintableString ret_var = Bolt12Invoice_description(&this_arg_conv);
64731         uint64_t ret_ref = 0;
64732         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64733         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64734         return ret_ref;
64735 }
64736
64737 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_absolute_expiry"))) TS_Bolt12Invoice_absolute_expiry(uint64_t this_arg) {
64738         LDKBolt12Invoice this_arg_conv;
64739         this_arg_conv.inner = untag_ptr(this_arg);
64740         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64742         this_arg_conv.is_owned = false;
64743         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
64744         *ret_copy = Bolt12Invoice_absolute_expiry(&this_arg_conv);
64745         uint64_t ret_ref = tag_ptr(ret_copy, true);
64746         return ret_ref;
64747 }
64748
64749 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_issuer"))) TS_Bolt12Invoice_issuer(uint64_t this_arg) {
64750         LDKBolt12Invoice this_arg_conv;
64751         this_arg_conv.inner = untag_ptr(this_arg);
64752         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64754         this_arg_conv.is_owned = false;
64755         LDKPrintableString ret_var = Bolt12Invoice_issuer(&this_arg_conv);
64756         uint64_t ret_ref = 0;
64757         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64758         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64759         return ret_ref;
64760 }
64761
64762 uint64_tArray  __attribute__((export_name("TS_Bolt12Invoice_message_paths"))) TS_Bolt12Invoice_message_paths(uint64_t this_arg) {
64763         LDKBolt12Invoice this_arg_conv;
64764         this_arg_conv.inner = untag_ptr(this_arg);
64765         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64767         this_arg_conv.is_owned = false;
64768         LDKCVec_BlindedPathZ ret_var = Bolt12Invoice_message_paths(&this_arg_conv);
64769         uint64_tArray ret_arr = NULL;
64770         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
64771         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
64772         for (size_t n = 0; n < ret_var.datalen; n++) {
64773                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
64774                 uint64_t ret_conv_13_ref = 0;
64775                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
64776                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
64777                 ret_arr_ptr[n] = ret_conv_13_ref;
64778         }
64779         
64780         FREE(ret_var.data);
64781         return ret_arr;
64782 }
64783
64784 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_supported_quantity"))) TS_Bolt12Invoice_supported_quantity(uint64_t this_arg) {
64785         LDKBolt12Invoice this_arg_conv;
64786         this_arg_conv.inner = untag_ptr(this_arg);
64787         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64789         this_arg_conv.is_owned = false;
64790         LDKCOption_QuantityZ *ret_copy = MALLOC(sizeof(LDKCOption_QuantityZ), "LDKCOption_QuantityZ");
64791         *ret_copy = Bolt12Invoice_supported_quantity(&this_arg_conv);
64792         uint64_t ret_ref = tag_ptr(ret_copy, true);
64793         return ret_ref;
64794 }
64795
64796 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_payer_metadata"))) TS_Bolt12Invoice_payer_metadata(uint64_t this_arg) {
64797         LDKBolt12Invoice this_arg_conv;
64798         this_arg_conv.inner = untag_ptr(this_arg);
64799         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64801         this_arg_conv.is_owned = false;
64802         LDKu8slice ret_var = Bolt12Invoice_payer_metadata(&this_arg_conv);
64803         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64804         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64805         return ret_arr;
64806 }
64807
64808 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_invoice_request_features"))) TS_Bolt12Invoice_invoice_request_features(uint64_t this_arg) {
64809         LDKBolt12Invoice this_arg_conv;
64810         this_arg_conv.inner = untag_ptr(this_arg);
64811         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64813         this_arg_conv.is_owned = false;
64814         LDKInvoiceRequestFeatures ret_var = Bolt12Invoice_invoice_request_features(&this_arg_conv);
64815         uint64_t ret_ref = 0;
64816         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64817         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64818         return ret_ref;
64819 }
64820
64821 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_quantity"))) TS_Bolt12Invoice_quantity(uint64_t this_arg) {
64822         LDKBolt12Invoice this_arg_conv;
64823         this_arg_conv.inner = untag_ptr(this_arg);
64824         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64826         this_arg_conv.is_owned = false;
64827         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
64828         *ret_copy = Bolt12Invoice_quantity(&this_arg_conv);
64829         uint64_t ret_ref = tag_ptr(ret_copy, true);
64830         return ret_ref;
64831 }
64832
64833 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_payer_id"))) TS_Bolt12Invoice_payer_id(uint64_t this_arg) {
64834         LDKBolt12Invoice this_arg_conv;
64835         this_arg_conv.inner = untag_ptr(this_arg);
64836         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64838         this_arg_conv.is_owned = false;
64839         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
64840         memcpy(ret_arr->elems, Bolt12Invoice_payer_id(&this_arg_conv).compressed_form, 33);
64841         return ret_arr;
64842 }
64843
64844 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_payer_note"))) TS_Bolt12Invoice_payer_note(uint64_t this_arg) {
64845         LDKBolt12Invoice this_arg_conv;
64846         this_arg_conv.inner = untag_ptr(this_arg);
64847         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64849         this_arg_conv.is_owned = false;
64850         LDKPrintableString ret_var = Bolt12Invoice_payer_note(&this_arg_conv);
64851         uint64_t ret_ref = 0;
64852         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64853         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64854         return ret_ref;
64855 }
64856
64857 int64_t  __attribute__((export_name("TS_Bolt12Invoice_created_at"))) TS_Bolt12Invoice_created_at(uint64_t this_arg) {
64858         LDKBolt12Invoice this_arg_conv;
64859         this_arg_conv.inner = untag_ptr(this_arg);
64860         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64862         this_arg_conv.is_owned = false;
64863         int64_t ret_conv = Bolt12Invoice_created_at(&this_arg_conv);
64864         return ret_conv;
64865 }
64866
64867 int64_t  __attribute__((export_name("TS_Bolt12Invoice_relative_expiry"))) TS_Bolt12Invoice_relative_expiry(uint64_t this_arg) {
64868         LDKBolt12Invoice this_arg_conv;
64869         this_arg_conv.inner = untag_ptr(this_arg);
64870         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64872         this_arg_conv.is_owned = false;
64873         int64_t ret_conv = Bolt12Invoice_relative_expiry(&this_arg_conv);
64874         return ret_conv;
64875 }
64876
64877 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_payment_hash"))) TS_Bolt12Invoice_payment_hash(uint64_t this_arg) {
64878         LDKBolt12Invoice this_arg_conv;
64879         this_arg_conv.inner = untag_ptr(this_arg);
64880         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64882         this_arg_conv.is_owned = false;
64883         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
64884         memcpy(ret_arr->elems, Bolt12Invoice_payment_hash(&this_arg_conv).data, 32);
64885         return ret_arr;
64886 }
64887
64888 int64_t  __attribute__((export_name("TS_Bolt12Invoice_amount_msats"))) TS_Bolt12Invoice_amount_msats(uint64_t this_arg) {
64889         LDKBolt12Invoice this_arg_conv;
64890         this_arg_conv.inner = untag_ptr(this_arg);
64891         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64893         this_arg_conv.is_owned = false;
64894         int64_t ret_conv = Bolt12Invoice_amount_msats(&this_arg_conv);
64895         return ret_conv;
64896 }
64897
64898 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_invoice_features"))) TS_Bolt12Invoice_invoice_features(uint64_t this_arg) {
64899         LDKBolt12Invoice this_arg_conv;
64900         this_arg_conv.inner = untag_ptr(this_arg);
64901         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64903         this_arg_conv.is_owned = false;
64904         LDKBolt12InvoiceFeatures ret_var = Bolt12Invoice_invoice_features(&this_arg_conv);
64905         uint64_t ret_ref = 0;
64906         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64907         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64908         return ret_ref;
64909 }
64910
64911 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_signing_pubkey"))) TS_Bolt12Invoice_signing_pubkey(uint64_t this_arg) {
64912         LDKBolt12Invoice this_arg_conv;
64913         this_arg_conv.inner = untag_ptr(this_arg);
64914         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64916         this_arg_conv.is_owned = false;
64917         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
64918         memcpy(ret_arr->elems, Bolt12Invoice_signing_pubkey(&this_arg_conv).compressed_form, 33);
64919         return ret_arr;
64920 }
64921
64922 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_signature"))) TS_Bolt12Invoice_signature(uint64_t this_arg) {
64923         LDKBolt12Invoice this_arg_conv;
64924         this_arg_conv.inner = untag_ptr(this_arg);
64925         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64927         this_arg_conv.is_owned = false;
64928         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
64929         memcpy(ret_arr->elems, Bolt12Invoice_signature(&this_arg_conv).compact_form, 64);
64930         return ret_arr;
64931 }
64932
64933 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_signable_hash"))) TS_Bolt12Invoice_signable_hash(uint64_t this_arg) {
64934         LDKBolt12Invoice this_arg_conv;
64935         this_arg_conv.inner = untag_ptr(this_arg);
64936         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64938         this_arg_conv.is_owned = false;
64939         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
64940         memcpy(ret_arr->elems, Bolt12Invoice_signable_hash(&this_arg_conv).data, 32);
64941         return ret_arr;
64942 }
64943
64944 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_verify"))) TS_Bolt12Invoice_verify(uint64_t this_arg, uint64_t key) {
64945         LDKBolt12Invoice this_arg_conv;
64946         this_arg_conv.inner = untag_ptr(this_arg);
64947         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64949         this_arg_conv.is_owned = false;
64950         LDKExpandedKey key_conv;
64951         key_conv.inner = untag_ptr(key);
64952         key_conv.is_owned = ptr_is_owned(key);
64953         CHECK_INNER_FIELD_ACCESS_OR_NULL(key_conv);
64954         key_conv.is_owned = false;
64955         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
64956         *ret_conv = Bolt12Invoice_verify(&this_arg_conv, &key_conv);
64957         return tag_ptr(ret_conv, true);
64958 }
64959
64960 int64_t  __attribute__((export_name("TS_Bolt12Invoice_hash"))) TS_Bolt12Invoice_hash(uint64_t o) {
64961         LDKBolt12Invoice o_conv;
64962         o_conv.inner = untag_ptr(o);
64963         o_conv.is_owned = ptr_is_owned(o);
64964         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64965         o_conv.is_owned = false;
64966         int64_t ret_conv = Bolt12Invoice_hash(&o_conv);
64967         return ret_conv;
64968 }
64969
64970 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_write"))) TS_UnsignedBolt12Invoice_write(uint64_t obj) {
64971         LDKUnsignedBolt12Invoice obj_conv;
64972         obj_conv.inner = untag_ptr(obj);
64973         obj_conv.is_owned = ptr_is_owned(obj);
64974         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64975         obj_conv.is_owned = false;
64976         LDKCVec_u8Z ret_var = UnsignedBolt12Invoice_write(&obj_conv);
64977         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64978         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64979         CVec_u8Z_free(ret_var);
64980         return ret_arr;
64981 }
64982
64983 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_write"))) TS_Bolt12Invoice_write(uint64_t obj) {
64984         LDKBolt12Invoice obj_conv;
64985         obj_conv.inner = untag_ptr(obj);
64986         obj_conv.is_owned = ptr_is_owned(obj);
64987         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64988         obj_conv.is_owned = false;
64989         LDKCVec_u8Z ret_var = Bolt12Invoice_write(&obj_conv);
64990         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64991         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64992         CVec_u8Z_free(ret_var);
64993         return ret_arr;
64994 }
64995
64996 void  __attribute__((export_name("TS_BlindedPayInfo_free"))) TS_BlindedPayInfo_free(uint64_t this_obj) {
64997         LDKBlindedPayInfo this_obj_conv;
64998         this_obj_conv.inner = untag_ptr(this_obj);
64999         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65001         BlindedPayInfo_free(this_obj_conv);
65002 }
65003
65004 int32_t  __attribute__((export_name("TS_BlindedPayInfo_get_fee_base_msat"))) TS_BlindedPayInfo_get_fee_base_msat(uint64_t this_ptr) {
65005         LDKBlindedPayInfo this_ptr_conv;
65006         this_ptr_conv.inner = untag_ptr(this_ptr);
65007         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65009         this_ptr_conv.is_owned = false;
65010         int32_t ret_conv = BlindedPayInfo_get_fee_base_msat(&this_ptr_conv);
65011         return ret_conv;
65012 }
65013
65014 void  __attribute__((export_name("TS_BlindedPayInfo_set_fee_base_msat"))) TS_BlindedPayInfo_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
65015         LDKBlindedPayInfo this_ptr_conv;
65016         this_ptr_conv.inner = untag_ptr(this_ptr);
65017         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65019         this_ptr_conv.is_owned = false;
65020         BlindedPayInfo_set_fee_base_msat(&this_ptr_conv, val);
65021 }
65022
65023 int32_t  __attribute__((export_name("TS_BlindedPayInfo_get_fee_proportional_millionths"))) TS_BlindedPayInfo_get_fee_proportional_millionths(uint64_t this_ptr) {
65024         LDKBlindedPayInfo this_ptr_conv;
65025         this_ptr_conv.inner = untag_ptr(this_ptr);
65026         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65028         this_ptr_conv.is_owned = false;
65029         int32_t ret_conv = BlindedPayInfo_get_fee_proportional_millionths(&this_ptr_conv);
65030         return ret_conv;
65031 }
65032
65033 void  __attribute__((export_name("TS_BlindedPayInfo_set_fee_proportional_millionths"))) TS_BlindedPayInfo_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
65034         LDKBlindedPayInfo this_ptr_conv;
65035         this_ptr_conv.inner = untag_ptr(this_ptr);
65036         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65038         this_ptr_conv.is_owned = false;
65039         BlindedPayInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
65040 }
65041
65042 int16_t  __attribute__((export_name("TS_BlindedPayInfo_get_cltv_expiry_delta"))) TS_BlindedPayInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
65043         LDKBlindedPayInfo this_ptr_conv;
65044         this_ptr_conv.inner = untag_ptr(this_ptr);
65045         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65047         this_ptr_conv.is_owned = false;
65048         int16_t ret_conv = BlindedPayInfo_get_cltv_expiry_delta(&this_ptr_conv);
65049         return ret_conv;
65050 }
65051
65052 void  __attribute__((export_name("TS_BlindedPayInfo_set_cltv_expiry_delta"))) TS_BlindedPayInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
65053         LDKBlindedPayInfo this_ptr_conv;
65054         this_ptr_conv.inner = untag_ptr(this_ptr);
65055         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65057         this_ptr_conv.is_owned = false;
65058         BlindedPayInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
65059 }
65060
65061 int64_t  __attribute__((export_name("TS_BlindedPayInfo_get_htlc_minimum_msat"))) TS_BlindedPayInfo_get_htlc_minimum_msat(uint64_t this_ptr) {
65062         LDKBlindedPayInfo this_ptr_conv;
65063         this_ptr_conv.inner = untag_ptr(this_ptr);
65064         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65066         this_ptr_conv.is_owned = false;
65067         int64_t ret_conv = BlindedPayInfo_get_htlc_minimum_msat(&this_ptr_conv);
65068         return ret_conv;
65069 }
65070
65071 void  __attribute__((export_name("TS_BlindedPayInfo_set_htlc_minimum_msat"))) TS_BlindedPayInfo_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
65072         LDKBlindedPayInfo this_ptr_conv;
65073         this_ptr_conv.inner = untag_ptr(this_ptr);
65074         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65076         this_ptr_conv.is_owned = false;
65077         BlindedPayInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
65078 }
65079
65080 int64_t  __attribute__((export_name("TS_BlindedPayInfo_get_htlc_maximum_msat"))) TS_BlindedPayInfo_get_htlc_maximum_msat(uint64_t this_ptr) {
65081         LDKBlindedPayInfo this_ptr_conv;
65082         this_ptr_conv.inner = untag_ptr(this_ptr);
65083         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65085         this_ptr_conv.is_owned = false;
65086         int64_t ret_conv = BlindedPayInfo_get_htlc_maximum_msat(&this_ptr_conv);
65087         return ret_conv;
65088 }
65089
65090 void  __attribute__((export_name("TS_BlindedPayInfo_set_htlc_maximum_msat"))) TS_BlindedPayInfo_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
65091         LDKBlindedPayInfo this_ptr_conv;
65092         this_ptr_conv.inner = untag_ptr(this_ptr);
65093         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65095         this_ptr_conv.is_owned = false;
65096         BlindedPayInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
65097 }
65098
65099 uint64_t  __attribute__((export_name("TS_BlindedPayInfo_get_features"))) TS_BlindedPayInfo_get_features(uint64_t this_ptr) {
65100         LDKBlindedPayInfo this_ptr_conv;
65101         this_ptr_conv.inner = untag_ptr(this_ptr);
65102         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65104         this_ptr_conv.is_owned = false;
65105         LDKBlindedHopFeatures ret_var = BlindedPayInfo_get_features(&this_ptr_conv);
65106         uint64_t ret_ref = 0;
65107         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65108         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65109         return ret_ref;
65110 }
65111
65112 void  __attribute__((export_name("TS_BlindedPayInfo_set_features"))) TS_BlindedPayInfo_set_features(uint64_t this_ptr, uint64_t val) {
65113         LDKBlindedPayInfo this_ptr_conv;
65114         this_ptr_conv.inner = untag_ptr(this_ptr);
65115         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65117         this_ptr_conv.is_owned = false;
65118         LDKBlindedHopFeatures val_conv;
65119         val_conv.inner = untag_ptr(val);
65120         val_conv.is_owned = ptr_is_owned(val);
65121         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
65122         val_conv = BlindedHopFeatures_clone(&val_conv);
65123         BlindedPayInfo_set_features(&this_ptr_conv, val_conv);
65124 }
65125
65126 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) {
65127         LDKBlindedHopFeatures features_arg_conv;
65128         features_arg_conv.inner = untag_ptr(features_arg);
65129         features_arg_conv.is_owned = ptr_is_owned(features_arg);
65130         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
65131         features_arg_conv = BlindedHopFeatures_clone(&features_arg_conv);
65132         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);
65133         uint64_t ret_ref = 0;
65134         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65135         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65136         return ret_ref;
65137 }
65138
65139 static inline uint64_t BlindedPayInfo_clone_ptr(LDKBlindedPayInfo *NONNULL_PTR arg) {
65140         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(arg);
65141         uint64_t ret_ref = 0;
65142         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65143         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65144         return ret_ref;
65145 }
65146 int64_t  __attribute__((export_name("TS_BlindedPayInfo_clone_ptr"))) TS_BlindedPayInfo_clone_ptr(uint64_t arg) {
65147         LDKBlindedPayInfo arg_conv;
65148         arg_conv.inner = untag_ptr(arg);
65149         arg_conv.is_owned = ptr_is_owned(arg);
65150         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65151         arg_conv.is_owned = false;
65152         int64_t ret_conv = BlindedPayInfo_clone_ptr(&arg_conv);
65153         return ret_conv;
65154 }
65155
65156 uint64_t  __attribute__((export_name("TS_BlindedPayInfo_clone"))) TS_BlindedPayInfo_clone(uint64_t orig) {
65157         LDKBlindedPayInfo orig_conv;
65158         orig_conv.inner = untag_ptr(orig);
65159         orig_conv.is_owned = ptr_is_owned(orig);
65160         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65161         orig_conv.is_owned = false;
65162         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(&orig_conv);
65163         uint64_t ret_ref = 0;
65164         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65165         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65166         return ret_ref;
65167 }
65168
65169 int64_t  __attribute__((export_name("TS_BlindedPayInfo_hash"))) TS_BlindedPayInfo_hash(uint64_t o) {
65170         LDKBlindedPayInfo o_conv;
65171         o_conv.inner = untag_ptr(o);
65172         o_conv.is_owned = ptr_is_owned(o);
65173         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65174         o_conv.is_owned = false;
65175         int64_t ret_conv = BlindedPayInfo_hash(&o_conv);
65176         return ret_conv;
65177 }
65178
65179 jboolean  __attribute__((export_name("TS_BlindedPayInfo_eq"))) TS_BlindedPayInfo_eq(uint64_t a, uint64_t b) {
65180         LDKBlindedPayInfo a_conv;
65181         a_conv.inner = untag_ptr(a);
65182         a_conv.is_owned = ptr_is_owned(a);
65183         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65184         a_conv.is_owned = false;
65185         LDKBlindedPayInfo b_conv;
65186         b_conv.inner = untag_ptr(b);
65187         b_conv.is_owned = ptr_is_owned(b);
65188         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65189         b_conv.is_owned = false;
65190         jboolean ret_conv = BlindedPayInfo_eq(&a_conv, &b_conv);
65191         return ret_conv;
65192 }
65193
65194 int8_tArray  __attribute__((export_name("TS_BlindedPayInfo_write"))) TS_BlindedPayInfo_write(uint64_t obj) {
65195         LDKBlindedPayInfo obj_conv;
65196         obj_conv.inner = untag_ptr(obj);
65197         obj_conv.is_owned = ptr_is_owned(obj);
65198         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65199         obj_conv.is_owned = false;
65200         LDKCVec_u8Z ret_var = BlindedPayInfo_write(&obj_conv);
65201         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65202         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65203         CVec_u8Z_free(ret_var);
65204         return ret_arr;
65205 }
65206
65207 uint64_t  __attribute__((export_name("TS_BlindedPayInfo_read"))) TS_BlindedPayInfo_read(int8_tArray ser) {
65208         LDKu8slice ser_ref;
65209         ser_ref.datalen = ser->arr_len;
65210         ser_ref.data = ser->elems;
65211         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
65212         *ret_conv = BlindedPayInfo_read(ser_ref);
65213         FREE(ser);
65214         return tag_ptr(ret_conv, true);
65215 }
65216
65217 void  __attribute__((export_name("TS_InvoiceError_free"))) TS_InvoiceError_free(uint64_t this_obj) {
65218         LDKInvoiceError this_obj_conv;
65219         this_obj_conv.inner = untag_ptr(this_obj);
65220         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65222         InvoiceError_free(this_obj_conv);
65223 }
65224
65225 uint64_t  __attribute__((export_name("TS_InvoiceError_get_erroneous_field"))) TS_InvoiceError_get_erroneous_field(uint64_t this_ptr) {
65226         LDKInvoiceError this_ptr_conv;
65227         this_ptr_conv.inner = untag_ptr(this_ptr);
65228         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65230         this_ptr_conv.is_owned = false;
65231         LDKErroneousField ret_var = InvoiceError_get_erroneous_field(&this_ptr_conv);
65232         uint64_t ret_ref = 0;
65233         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65234         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65235         return ret_ref;
65236 }
65237
65238 void  __attribute__((export_name("TS_InvoiceError_set_erroneous_field"))) TS_InvoiceError_set_erroneous_field(uint64_t this_ptr, uint64_t val) {
65239         LDKInvoiceError this_ptr_conv;
65240         this_ptr_conv.inner = untag_ptr(this_ptr);
65241         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65243         this_ptr_conv.is_owned = false;
65244         LDKErroneousField val_conv;
65245         val_conv.inner = untag_ptr(val);
65246         val_conv.is_owned = ptr_is_owned(val);
65247         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
65248         val_conv = ErroneousField_clone(&val_conv);
65249         InvoiceError_set_erroneous_field(&this_ptr_conv, val_conv);
65250 }
65251
65252 uint64_t  __attribute__((export_name("TS_InvoiceError_get_message"))) TS_InvoiceError_get_message(uint64_t this_ptr) {
65253         LDKInvoiceError this_ptr_conv;
65254         this_ptr_conv.inner = untag_ptr(this_ptr);
65255         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65257         this_ptr_conv.is_owned = false;
65258         LDKUntrustedString ret_var = InvoiceError_get_message(&this_ptr_conv);
65259         uint64_t ret_ref = 0;
65260         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65261         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65262         return ret_ref;
65263 }
65264
65265 void  __attribute__((export_name("TS_InvoiceError_set_message"))) TS_InvoiceError_set_message(uint64_t this_ptr, uint64_t val) {
65266         LDKInvoiceError this_ptr_conv;
65267         this_ptr_conv.inner = untag_ptr(this_ptr);
65268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65270         this_ptr_conv.is_owned = false;
65271         LDKUntrustedString val_conv;
65272         val_conv.inner = untag_ptr(val);
65273         val_conv.is_owned = ptr_is_owned(val);
65274         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
65275         val_conv = UntrustedString_clone(&val_conv);
65276         InvoiceError_set_message(&this_ptr_conv, val_conv);
65277 }
65278
65279 uint64_t  __attribute__((export_name("TS_InvoiceError_new"))) TS_InvoiceError_new(uint64_t erroneous_field_arg, uint64_t message_arg) {
65280         LDKErroneousField erroneous_field_arg_conv;
65281         erroneous_field_arg_conv.inner = untag_ptr(erroneous_field_arg);
65282         erroneous_field_arg_conv.is_owned = ptr_is_owned(erroneous_field_arg);
65283         CHECK_INNER_FIELD_ACCESS_OR_NULL(erroneous_field_arg_conv);
65284         erroneous_field_arg_conv = ErroneousField_clone(&erroneous_field_arg_conv);
65285         LDKUntrustedString message_arg_conv;
65286         message_arg_conv.inner = untag_ptr(message_arg);
65287         message_arg_conv.is_owned = ptr_is_owned(message_arg);
65288         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_arg_conv);
65289         message_arg_conv = UntrustedString_clone(&message_arg_conv);
65290         LDKInvoiceError ret_var = InvoiceError_new(erroneous_field_arg_conv, message_arg_conv);
65291         uint64_t ret_ref = 0;
65292         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65293         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65294         return ret_ref;
65295 }
65296
65297 static inline uint64_t InvoiceError_clone_ptr(LDKInvoiceError *NONNULL_PTR arg) {
65298         LDKInvoiceError ret_var = InvoiceError_clone(arg);
65299         uint64_t ret_ref = 0;
65300         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65301         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65302         return ret_ref;
65303 }
65304 int64_t  __attribute__((export_name("TS_InvoiceError_clone_ptr"))) TS_InvoiceError_clone_ptr(uint64_t arg) {
65305         LDKInvoiceError arg_conv;
65306         arg_conv.inner = untag_ptr(arg);
65307         arg_conv.is_owned = ptr_is_owned(arg);
65308         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65309         arg_conv.is_owned = false;
65310         int64_t ret_conv = InvoiceError_clone_ptr(&arg_conv);
65311         return ret_conv;
65312 }
65313
65314 uint64_t  __attribute__((export_name("TS_InvoiceError_clone"))) TS_InvoiceError_clone(uint64_t orig) {
65315         LDKInvoiceError orig_conv;
65316         orig_conv.inner = untag_ptr(orig);
65317         orig_conv.is_owned = ptr_is_owned(orig);
65318         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65319         orig_conv.is_owned = false;
65320         LDKInvoiceError ret_var = InvoiceError_clone(&orig_conv);
65321         uint64_t ret_ref = 0;
65322         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65323         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65324         return ret_ref;
65325 }
65326
65327 void  __attribute__((export_name("TS_ErroneousField_free"))) TS_ErroneousField_free(uint64_t this_obj) {
65328         LDKErroneousField this_obj_conv;
65329         this_obj_conv.inner = untag_ptr(this_obj);
65330         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65332         ErroneousField_free(this_obj_conv);
65333 }
65334
65335 int64_t  __attribute__((export_name("TS_ErroneousField_get_tlv_fieldnum"))) TS_ErroneousField_get_tlv_fieldnum(uint64_t this_ptr) {
65336         LDKErroneousField this_ptr_conv;
65337         this_ptr_conv.inner = untag_ptr(this_ptr);
65338         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65340         this_ptr_conv.is_owned = false;
65341         int64_t ret_conv = ErroneousField_get_tlv_fieldnum(&this_ptr_conv);
65342         return ret_conv;
65343 }
65344
65345 void  __attribute__((export_name("TS_ErroneousField_set_tlv_fieldnum"))) TS_ErroneousField_set_tlv_fieldnum(uint64_t this_ptr, int64_t val) {
65346         LDKErroneousField this_ptr_conv;
65347         this_ptr_conv.inner = untag_ptr(this_ptr);
65348         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65350         this_ptr_conv.is_owned = false;
65351         ErroneousField_set_tlv_fieldnum(&this_ptr_conv, val);
65352 }
65353
65354 uint64_t  __attribute__((export_name("TS_ErroneousField_get_suggested_value"))) TS_ErroneousField_get_suggested_value(uint64_t this_ptr) {
65355         LDKErroneousField this_ptr_conv;
65356         this_ptr_conv.inner = untag_ptr(this_ptr);
65357         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65359         this_ptr_conv.is_owned = false;
65360         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
65361         *ret_copy = ErroneousField_get_suggested_value(&this_ptr_conv);
65362         uint64_t ret_ref = tag_ptr(ret_copy, true);
65363         return ret_ref;
65364 }
65365
65366 void  __attribute__((export_name("TS_ErroneousField_set_suggested_value"))) TS_ErroneousField_set_suggested_value(uint64_t this_ptr, uint64_t val) {
65367         LDKErroneousField this_ptr_conv;
65368         this_ptr_conv.inner = untag_ptr(this_ptr);
65369         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65371         this_ptr_conv.is_owned = false;
65372         void* val_ptr = untag_ptr(val);
65373         CHECK_ACCESS(val_ptr);
65374         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
65375         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
65376         ErroneousField_set_suggested_value(&this_ptr_conv, val_conv);
65377 }
65378
65379 uint64_t  __attribute__((export_name("TS_ErroneousField_new"))) TS_ErroneousField_new(int64_t tlv_fieldnum_arg, uint64_t suggested_value_arg) {
65380         void* suggested_value_arg_ptr = untag_ptr(suggested_value_arg);
65381         CHECK_ACCESS(suggested_value_arg_ptr);
65382         LDKCOption_CVec_u8ZZ suggested_value_arg_conv = *(LDKCOption_CVec_u8ZZ*)(suggested_value_arg_ptr);
65383         suggested_value_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(suggested_value_arg));
65384         LDKErroneousField ret_var = ErroneousField_new(tlv_fieldnum_arg, suggested_value_arg_conv);
65385         uint64_t ret_ref = 0;
65386         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65387         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65388         return ret_ref;
65389 }
65390
65391 static inline uint64_t ErroneousField_clone_ptr(LDKErroneousField *NONNULL_PTR arg) {
65392         LDKErroneousField ret_var = ErroneousField_clone(arg);
65393         uint64_t ret_ref = 0;
65394         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65395         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65396         return ret_ref;
65397 }
65398 int64_t  __attribute__((export_name("TS_ErroneousField_clone_ptr"))) TS_ErroneousField_clone_ptr(uint64_t arg) {
65399         LDKErroneousField arg_conv;
65400         arg_conv.inner = untag_ptr(arg);
65401         arg_conv.is_owned = ptr_is_owned(arg);
65402         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65403         arg_conv.is_owned = false;
65404         int64_t ret_conv = ErroneousField_clone_ptr(&arg_conv);
65405         return ret_conv;
65406 }
65407
65408 uint64_t  __attribute__((export_name("TS_ErroneousField_clone"))) TS_ErroneousField_clone(uint64_t orig) {
65409         LDKErroneousField orig_conv;
65410         orig_conv.inner = untag_ptr(orig);
65411         orig_conv.is_owned = ptr_is_owned(orig);
65412         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65413         orig_conv.is_owned = false;
65414         LDKErroneousField ret_var = ErroneousField_clone(&orig_conv);
65415         uint64_t ret_ref = 0;
65416         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65417         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65418         return ret_ref;
65419 }
65420
65421 uint64_t  __attribute__((export_name("TS_InvoiceError_from_string"))) TS_InvoiceError_from_string(jstring s) {
65422         LDKStr s_conv = str_ref_to_owned_c(s);
65423         LDKInvoiceError ret_var = InvoiceError_from_string(s_conv);
65424         uint64_t ret_ref = 0;
65425         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65426         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65427         return ret_ref;
65428 }
65429
65430 int8_tArray  __attribute__((export_name("TS_InvoiceError_write"))) TS_InvoiceError_write(uint64_t obj) {
65431         LDKInvoiceError obj_conv;
65432         obj_conv.inner = untag_ptr(obj);
65433         obj_conv.is_owned = ptr_is_owned(obj);
65434         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65435         obj_conv.is_owned = false;
65436         LDKCVec_u8Z ret_var = InvoiceError_write(&obj_conv);
65437         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65438         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65439         CVec_u8Z_free(ret_var);
65440         return ret_arr;
65441 }
65442
65443 uint64_t  __attribute__((export_name("TS_InvoiceError_read"))) TS_InvoiceError_read(int8_tArray ser) {
65444         LDKu8slice ser_ref;
65445         ser_ref.datalen = ser->arr_len;
65446         ser_ref.data = ser->elems;
65447         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
65448         *ret_conv = InvoiceError_read(ser_ref);
65449         FREE(ser);
65450         return tag_ptr(ret_conv, true);
65451 }
65452
65453 void  __attribute__((export_name("TS_InvoiceRequestWithExplicitPayerIdBuilder_free"))) TS_InvoiceRequestWithExplicitPayerIdBuilder_free(uint64_t this_obj) {
65454         LDKInvoiceRequestWithExplicitPayerIdBuilder this_obj_conv;
65455         this_obj_conv.inner = untag_ptr(this_obj);
65456         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65458         InvoiceRequestWithExplicitPayerIdBuilder_free(this_obj_conv);
65459 }
65460
65461 void  __attribute__((export_name("TS_InvoiceRequestWithDerivedPayerIdBuilder_free"))) TS_InvoiceRequestWithDerivedPayerIdBuilder_free(uint64_t this_obj) {
65462         LDKInvoiceRequestWithDerivedPayerIdBuilder this_obj_conv;
65463         this_obj_conv.inner = untag_ptr(this_obj);
65464         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65466         InvoiceRequestWithDerivedPayerIdBuilder_free(this_obj_conv);
65467 }
65468
65469 uint64_t  __attribute__((export_name("TS_InvoiceRequestWithExplicitPayerIdBuilder_build"))) TS_InvoiceRequestWithExplicitPayerIdBuilder_build(uint64_t this_arg) {
65470         LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg_conv;
65471         this_arg_conv.inner = untag_ptr(this_arg);
65472         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65474         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithExplicitPayerIdBuilder
65475         
65476         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ), "LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ");
65477         *ret_conv = InvoiceRequestWithExplicitPayerIdBuilder_build(this_arg_conv);
65478         return tag_ptr(ret_conv, true);
65479 }
65480
65481 uint64_t  __attribute__((export_name("TS_InvoiceRequestWithExplicitPayerIdBuilder_chain"))) TS_InvoiceRequestWithExplicitPayerIdBuilder_chain(uint64_t this_arg, uint32_t network) {
65482         LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg_conv;
65483         this_arg_conv.inner = untag_ptr(this_arg);
65484         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65486         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithExplicitPayerIdBuilder
65487         
65488         LDKNetwork network_conv = LDKNetwork_from_js(network);
65489         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
65490         *ret_conv = InvoiceRequestWithExplicitPayerIdBuilder_chain(this_arg_conv, network_conv);
65491         return tag_ptr(ret_conv, true);
65492 }
65493
65494 uint64_t  __attribute__((export_name("TS_InvoiceRequestWithExplicitPayerIdBuilder_amount_msats"))) TS_InvoiceRequestWithExplicitPayerIdBuilder_amount_msats(uint64_t this_arg, int64_t amount_msats) {
65495         LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg_conv;
65496         this_arg_conv.inner = untag_ptr(this_arg);
65497         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65499         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithExplicitPayerIdBuilder
65500         
65501         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
65502         *ret_conv = InvoiceRequestWithExplicitPayerIdBuilder_amount_msats(this_arg_conv, amount_msats);
65503         return tag_ptr(ret_conv, true);
65504 }
65505
65506 uint64_t  __attribute__((export_name("TS_InvoiceRequestWithExplicitPayerIdBuilder_quantity"))) TS_InvoiceRequestWithExplicitPayerIdBuilder_quantity(uint64_t this_arg, int64_t quantity) {
65507         LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg_conv;
65508         this_arg_conv.inner = untag_ptr(this_arg);
65509         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65511         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithExplicitPayerIdBuilder
65512         
65513         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
65514         *ret_conv = InvoiceRequestWithExplicitPayerIdBuilder_quantity(this_arg_conv, quantity);
65515         return tag_ptr(ret_conv, true);
65516 }
65517
65518 void  __attribute__((export_name("TS_InvoiceRequestWithExplicitPayerIdBuilder_payer_note"))) TS_InvoiceRequestWithExplicitPayerIdBuilder_payer_note(uint64_t this_arg, jstring payer_note) {
65519         LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg_conv;
65520         this_arg_conv.inner = untag_ptr(this_arg);
65521         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65523         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithExplicitPayerIdBuilder
65524         
65525         LDKStr payer_note_conv = str_ref_to_owned_c(payer_note);
65526         InvoiceRequestWithExplicitPayerIdBuilder_payer_note(this_arg_conv, payer_note_conv);
65527 }
65528
65529 uint64_t  __attribute__((export_name("TS_InvoiceRequestWithDerivedPayerIdBuilder_build_and_sign"))) TS_InvoiceRequestWithDerivedPayerIdBuilder_build_and_sign(uint64_t this_arg) {
65530         LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg_conv;
65531         this_arg_conv.inner = untag_ptr(this_arg);
65532         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65534         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithDerivedPayerIdBuilder
65535         
65536         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestBolt12SemanticErrorZ");
65537         *ret_conv = InvoiceRequestWithDerivedPayerIdBuilder_build_and_sign(this_arg_conv);
65538         return tag_ptr(ret_conv, true);
65539 }
65540
65541 uint64_t  __attribute__((export_name("TS_InvoiceRequestWithDerivedPayerIdBuilder_chain"))) TS_InvoiceRequestWithDerivedPayerIdBuilder_chain(uint64_t this_arg, uint32_t network) {
65542         LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg_conv;
65543         this_arg_conv.inner = untag_ptr(this_arg);
65544         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65546         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithDerivedPayerIdBuilder
65547         
65548         LDKNetwork network_conv = LDKNetwork_from_js(network);
65549         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
65550         *ret_conv = InvoiceRequestWithDerivedPayerIdBuilder_chain(this_arg_conv, network_conv);
65551         return tag_ptr(ret_conv, true);
65552 }
65553
65554 uint64_t  __attribute__((export_name("TS_InvoiceRequestWithDerivedPayerIdBuilder_amount_msats"))) TS_InvoiceRequestWithDerivedPayerIdBuilder_amount_msats(uint64_t this_arg, int64_t amount_msats) {
65555         LDKInvoiceRequestWithDerivedPayerIdBuilder 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 LDKInvoiceRequestWithDerivedPayerIdBuilder
65560         
65561         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
65562         *ret_conv = InvoiceRequestWithDerivedPayerIdBuilder_amount_msats(this_arg_conv, amount_msats);
65563         return tag_ptr(ret_conv, true);
65564 }
65565
65566 uint64_t  __attribute__((export_name("TS_InvoiceRequestWithDerivedPayerIdBuilder_quantity"))) TS_InvoiceRequestWithDerivedPayerIdBuilder_quantity(uint64_t this_arg, int64_t quantity) {
65567         LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg_conv;
65568         this_arg_conv.inner = untag_ptr(this_arg);
65569         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65571         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithDerivedPayerIdBuilder
65572         
65573         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
65574         *ret_conv = InvoiceRequestWithDerivedPayerIdBuilder_quantity(this_arg_conv, quantity);
65575         return tag_ptr(ret_conv, true);
65576 }
65577
65578 void  __attribute__((export_name("TS_InvoiceRequestWithDerivedPayerIdBuilder_payer_note"))) TS_InvoiceRequestWithDerivedPayerIdBuilder_payer_note(uint64_t this_arg, jstring payer_note) {
65579         LDKInvoiceRequestWithDerivedPayerIdBuilder 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 LDKInvoiceRequestWithDerivedPayerIdBuilder
65584         
65585         LDKStr payer_note_conv = str_ref_to_owned_c(payer_note);
65586         InvoiceRequestWithDerivedPayerIdBuilder_payer_note(this_arg_conv, payer_note_conv);
65587 }
65588
65589 void  __attribute__((export_name("TS_UnsignedInvoiceRequest_free"))) TS_UnsignedInvoiceRequest_free(uint64_t this_obj) {
65590         LDKUnsignedInvoiceRequest this_obj_conv;
65591         this_obj_conv.inner = untag_ptr(this_obj);
65592         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65594         UnsignedInvoiceRequest_free(this_obj_conv);
65595 }
65596
65597 static inline uint64_t UnsignedInvoiceRequest_clone_ptr(LDKUnsignedInvoiceRequest *NONNULL_PTR arg) {
65598         LDKUnsignedInvoiceRequest ret_var = UnsignedInvoiceRequest_clone(arg);
65599         uint64_t ret_ref = 0;
65600         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65601         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65602         return ret_ref;
65603 }
65604 int64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_clone_ptr"))) TS_UnsignedInvoiceRequest_clone_ptr(uint64_t arg) {
65605         LDKUnsignedInvoiceRequest arg_conv;
65606         arg_conv.inner = untag_ptr(arg);
65607         arg_conv.is_owned = ptr_is_owned(arg);
65608         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65609         arg_conv.is_owned = false;
65610         int64_t ret_conv = UnsignedInvoiceRequest_clone_ptr(&arg_conv);
65611         return ret_conv;
65612 }
65613
65614 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_clone"))) TS_UnsignedInvoiceRequest_clone(uint64_t orig) {
65615         LDKUnsignedInvoiceRequest orig_conv;
65616         orig_conv.inner = untag_ptr(orig);
65617         orig_conv.is_owned = ptr_is_owned(orig);
65618         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65619         orig_conv.is_owned = false;
65620         LDKUnsignedInvoiceRequest ret_var = UnsignedInvoiceRequest_clone(&orig_conv);
65621         uint64_t ret_ref = 0;
65622         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65623         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65624         return ret_ref;
65625 }
65626
65627 void  __attribute__((export_name("TS_SignInvoiceRequestFn_free"))) TS_SignInvoiceRequestFn_free(uint64_t this_ptr) {
65628         if (!ptr_is_owned(this_ptr)) return;
65629         void* this_ptr_ptr = untag_ptr(this_ptr);
65630         CHECK_ACCESS(this_ptr_ptr);
65631         LDKSignInvoiceRequestFn this_ptr_conv = *(LDKSignInvoiceRequestFn*)(this_ptr_ptr);
65632         FREE(untag_ptr(this_ptr));
65633         SignInvoiceRequestFn_free(this_ptr_conv);
65634 }
65635
65636 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_tagged_hash"))) TS_UnsignedInvoiceRequest_tagged_hash(uint64_t this_arg) {
65637         LDKUnsignedInvoiceRequest this_arg_conv;
65638         this_arg_conv.inner = untag_ptr(this_arg);
65639         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65641         this_arg_conv.is_owned = false;
65642         LDKTaggedHash ret_var = UnsignedInvoiceRequest_tagged_hash(&this_arg_conv);
65643         uint64_t ret_ref = 0;
65644         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65645         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65646         return ret_ref;
65647 }
65648
65649 void  __attribute__((export_name("TS_InvoiceRequest_free"))) TS_InvoiceRequest_free(uint64_t this_obj) {
65650         LDKInvoiceRequest this_obj_conv;
65651         this_obj_conv.inner = untag_ptr(this_obj);
65652         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65654         InvoiceRequest_free(this_obj_conv);
65655 }
65656
65657 static inline uint64_t InvoiceRequest_clone_ptr(LDKInvoiceRequest *NONNULL_PTR arg) {
65658         LDKInvoiceRequest ret_var = InvoiceRequest_clone(arg);
65659         uint64_t ret_ref = 0;
65660         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65661         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65662         return ret_ref;
65663 }
65664 int64_t  __attribute__((export_name("TS_InvoiceRequest_clone_ptr"))) TS_InvoiceRequest_clone_ptr(uint64_t arg) {
65665         LDKInvoiceRequest arg_conv;
65666         arg_conv.inner = untag_ptr(arg);
65667         arg_conv.is_owned = ptr_is_owned(arg);
65668         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65669         arg_conv.is_owned = false;
65670         int64_t ret_conv = InvoiceRequest_clone_ptr(&arg_conv);
65671         return ret_conv;
65672 }
65673
65674 uint64_t  __attribute__((export_name("TS_InvoiceRequest_clone"))) TS_InvoiceRequest_clone(uint64_t orig) {
65675         LDKInvoiceRequest orig_conv;
65676         orig_conv.inner = untag_ptr(orig);
65677         orig_conv.is_owned = ptr_is_owned(orig);
65678         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65679         orig_conv.is_owned = false;
65680         LDKInvoiceRequest ret_var = InvoiceRequest_clone(&orig_conv);
65681         uint64_t ret_ref = 0;
65682         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65683         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65684         return ret_ref;
65685 }
65686
65687 void  __attribute__((export_name("TS_VerifiedInvoiceRequest_free"))) TS_VerifiedInvoiceRequest_free(uint64_t this_obj) {
65688         LDKVerifiedInvoiceRequest this_obj_conv;
65689         this_obj_conv.inner = untag_ptr(this_obj);
65690         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65692         VerifiedInvoiceRequest_free(this_obj_conv);
65693 }
65694
65695 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_get_offer_id"))) TS_VerifiedInvoiceRequest_get_offer_id(uint64_t this_ptr) {
65696         LDKVerifiedInvoiceRequest this_ptr_conv;
65697         this_ptr_conv.inner = untag_ptr(this_ptr);
65698         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65700         this_ptr_conv.is_owned = false;
65701         LDKOfferId ret_var = VerifiedInvoiceRequest_get_offer_id(&this_ptr_conv);
65702         uint64_t ret_ref = 0;
65703         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65704         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65705         return ret_ref;
65706 }
65707
65708 void  __attribute__((export_name("TS_VerifiedInvoiceRequest_set_offer_id"))) TS_VerifiedInvoiceRequest_set_offer_id(uint64_t this_ptr, uint64_t val) {
65709         LDKVerifiedInvoiceRequest this_ptr_conv;
65710         this_ptr_conv.inner = untag_ptr(this_ptr);
65711         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65713         this_ptr_conv.is_owned = false;
65714         LDKOfferId val_conv;
65715         val_conv.inner = untag_ptr(val);
65716         val_conv.is_owned = ptr_is_owned(val);
65717         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
65718         val_conv = OfferId_clone(&val_conv);
65719         VerifiedInvoiceRequest_set_offer_id(&this_ptr_conv, val_conv);
65720 }
65721
65722 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_get_keys"))) TS_VerifiedInvoiceRequest_get_keys(uint64_t this_ptr) {
65723         LDKVerifiedInvoiceRequest this_ptr_conv;
65724         this_ptr_conv.inner = untag_ptr(this_ptr);
65725         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65727         this_ptr_conv.is_owned = false;
65728         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
65729         *ret_copy = VerifiedInvoiceRequest_get_keys(&this_ptr_conv);
65730         uint64_t ret_ref = tag_ptr(ret_copy, true);
65731         return ret_ref;
65732 }
65733
65734 void  __attribute__((export_name("TS_VerifiedInvoiceRequest_set_keys"))) TS_VerifiedInvoiceRequest_set_keys(uint64_t this_ptr, uint64_t val) {
65735         LDKVerifiedInvoiceRequest this_ptr_conv;
65736         this_ptr_conv.inner = untag_ptr(this_ptr);
65737         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65739         this_ptr_conv.is_owned = false;
65740         void* val_ptr = untag_ptr(val);
65741         CHECK_ACCESS(val_ptr);
65742         LDKCOption_SecretKeyZ val_conv = *(LDKCOption_SecretKeyZ*)(val_ptr);
65743         val_conv = COption_SecretKeyZ_clone((LDKCOption_SecretKeyZ*)untag_ptr(val));
65744         VerifiedInvoiceRequest_set_keys(&this_ptr_conv, val_conv);
65745 }
65746
65747 static inline uint64_t VerifiedInvoiceRequest_clone_ptr(LDKVerifiedInvoiceRequest *NONNULL_PTR arg) {
65748         LDKVerifiedInvoiceRequest ret_var = VerifiedInvoiceRequest_clone(arg);
65749         uint64_t ret_ref = 0;
65750         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65751         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65752         return ret_ref;
65753 }
65754 int64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_clone_ptr"))) TS_VerifiedInvoiceRequest_clone_ptr(uint64_t arg) {
65755         LDKVerifiedInvoiceRequest arg_conv;
65756         arg_conv.inner = untag_ptr(arg);
65757         arg_conv.is_owned = ptr_is_owned(arg);
65758         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65759         arg_conv.is_owned = false;
65760         int64_t ret_conv = VerifiedInvoiceRequest_clone_ptr(&arg_conv);
65761         return ret_conv;
65762 }
65763
65764 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_clone"))) TS_VerifiedInvoiceRequest_clone(uint64_t orig) {
65765         LDKVerifiedInvoiceRequest orig_conv;
65766         orig_conv.inner = untag_ptr(orig);
65767         orig_conv.is_owned = ptr_is_owned(orig);
65768         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65769         orig_conv.is_owned = false;
65770         LDKVerifiedInvoiceRequest ret_var = VerifiedInvoiceRequest_clone(&orig_conv);
65771         uint64_t ret_ref = 0;
65772         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65773         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65774         return ret_ref;
65775 }
65776
65777 ptrArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_chains"))) TS_UnsignedInvoiceRequest_chains(uint64_t this_arg) {
65778         LDKUnsignedInvoiceRequest this_arg_conv;
65779         this_arg_conv.inner = untag_ptr(this_arg);
65780         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65782         this_arg_conv.is_owned = false;
65783         LDKCVec_ThirtyTwoBytesZ ret_var = UnsignedInvoiceRequest_chains(&this_arg_conv);
65784         ptrArray ret_arr = NULL;
65785         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
65786         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
65787         for (size_t m = 0; m < ret_var.datalen; m++) {
65788                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
65789                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
65790                 ret_arr_ptr[m] = ret_conv_12_arr;
65791         }
65792         
65793         FREE(ret_var.data);
65794         return ret_arr;
65795 }
65796
65797 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_metadata"))) TS_UnsignedInvoiceRequest_metadata(uint64_t this_arg) {
65798         LDKUnsignedInvoiceRequest this_arg_conv;
65799         this_arg_conv.inner = untag_ptr(this_arg);
65800         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65802         this_arg_conv.is_owned = false;
65803         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
65804         *ret_copy = UnsignedInvoiceRequest_metadata(&this_arg_conv);
65805         uint64_t ret_ref = tag_ptr(ret_copy, true);
65806         return ret_ref;
65807 }
65808
65809 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_amount"))) TS_UnsignedInvoiceRequest_amount(uint64_t this_arg) {
65810         LDKUnsignedInvoiceRequest 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_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
65816         *ret_copy = UnsignedInvoiceRequest_amount(&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_UnsignedInvoiceRequest_description"))) TS_UnsignedInvoiceRequest_description(uint64_t this_arg) {
65822         LDKUnsignedInvoiceRequest 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         LDKPrintableString ret_var = UnsignedInvoiceRequest_description(&this_arg_conv);
65828         uint64_t ret_ref = 0;
65829         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65830         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65831         return ret_ref;
65832 }
65833
65834 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_offer_features"))) TS_UnsignedInvoiceRequest_offer_features(uint64_t this_arg) {
65835         LDKUnsignedInvoiceRequest this_arg_conv;
65836         this_arg_conv.inner = untag_ptr(this_arg);
65837         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65839         this_arg_conv.is_owned = false;
65840         LDKOfferFeatures ret_var = UnsignedInvoiceRequest_offer_features(&this_arg_conv);
65841         uint64_t ret_ref = 0;
65842         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65843         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65844         return ret_ref;
65845 }
65846
65847 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_absolute_expiry"))) TS_UnsignedInvoiceRequest_absolute_expiry(uint64_t this_arg) {
65848         LDKUnsignedInvoiceRequest this_arg_conv;
65849         this_arg_conv.inner = untag_ptr(this_arg);
65850         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65852         this_arg_conv.is_owned = false;
65853         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
65854         *ret_copy = UnsignedInvoiceRequest_absolute_expiry(&this_arg_conv);
65855         uint64_t ret_ref = tag_ptr(ret_copy, true);
65856         return ret_ref;
65857 }
65858
65859 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_issuer"))) TS_UnsignedInvoiceRequest_issuer(uint64_t this_arg) {
65860         LDKUnsignedInvoiceRequest 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         LDKPrintableString ret_var = UnsignedInvoiceRequest_issuer(&this_arg_conv);
65866         uint64_t ret_ref = 0;
65867         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65868         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65869         return ret_ref;
65870 }
65871
65872 uint64_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_paths"))) TS_UnsignedInvoiceRequest_paths(uint64_t this_arg) {
65873         LDKUnsignedInvoiceRequest this_arg_conv;
65874         this_arg_conv.inner = untag_ptr(this_arg);
65875         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65877         this_arg_conv.is_owned = false;
65878         LDKCVec_BlindedPathZ ret_var = UnsignedInvoiceRequest_paths(&this_arg_conv);
65879         uint64_tArray ret_arr = NULL;
65880         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
65881         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
65882         for (size_t n = 0; n < ret_var.datalen; n++) {
65883                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
65884                 uint64_t ret_conv_13_ref = 0;
65885                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
65886                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
65887                 ret_arr_ptr[n] = ret_conv_13_ref;
65888         }
65889         
65890         FREE(ret_var.data);
65891         return ret_arr;
65892 }
65893
65894 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_supported_quantity"))) TS_UnsignedInvoiceRequest_supported_quantity(uint64_t this_arg) {
65895         LDKUnsignedInvoiceRequest this_arg_conv;
65896         this_arg_conv.inner = untag_ptr(this_arg);
65897         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65899         this_arg_conv.is_owned = false;
65900         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
65901         *ret_copy = UnsignedInvoiceRequest_supported_quantity(&this_arg_conv);
65902         uint64_t ret_ref = tag_ptr(ret_copy, true);
65903         return ret_ref;
65904 }
65905
65906 int8_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_signing_pubkey"))) TS_UnsignedInvoiceRequest_signing_pubkey(uint64_t this_arg) {
65907         LDKUnsignedInvoiceRequest 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         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
65913         memcpy(ret_arr->elems, UnsignedInvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form, 33);
65914         return ret_arr;
65915 }
65916
65917 int8_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_payer_metadata"))) TS_UnsignedInvoiceRequest_payer_metadata(uint64_t this_arg) {
65918         LDKUnsignedInvoiceRequest this_arg_conv;
65919         this_arg_conv.inner = untag_ptr(this_arg);
65920         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65922         this_arg_conv.is_owned = false;
65923         LDKu8slice ret_var = UnsignedInvoiceRequest_payer_metadata(&this_arg_conv);
65924         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65925         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65926         return ret_arr;
65927 }
65928
65929 int8_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_chain"))) TS_UnsignedInvoiceRequest_chain(uint64_t this_arg) {
65930         LDKUnsignedInvoiceRequest this_arg_conv;
65931         this_arg_conv.inner = untag_ptr(this_arg);
65932         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65934         this_arg_conv.is_owned = false;
65935         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
65936         memcpy(ret_arr->elems, UnsignedInvoiceRequest_chain(&this_arg_conv).data, 32);
65937         return ret_arr;
65938 }
65939
65940 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_amount_msats"))) TS_UnsignedInvoiceRequest_amount_msats(uint64_t this_arg) {
65941         LDKUnsignedInvoiceRequest this_arg_conv;
65942         this_arg_conv.inner = untag_ptr(this_arg);
65943         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65945         this_arg_conv.is_owned = false;
65946         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
65947         *ret_copy = UnsignedInvoiceRequest_amount_msats(&this_arg_conv);
65948         uint64_t ret_ref = tag_ptr(ret_copy, true);
65949         return ret_ref;
65950 }
65951
65952 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_invoice_request_features"))) TS_UnsignedInvoiceRequest_invoice_request_features(uint64_t this_arg) {
65953         LDKUnsignedInvoiceRequest this_arg_conv;
65954         this_arg_conv.inner = untag_ptr(this_arg);
65955         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65957         this_arg_conv.is_owned = false;
65958         LDKInvoiceRequestFeatures ret_var = UnsignedInvoiceRequest_invoice_request_features(&this_arg_conv);
65959         uint64_t ret_ref = 0;
65960         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65961         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65962         return ret_ref;
65963 }
65964
65965 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_quantity"))) TS_UnsignedInvoiceRequest_quantity(uint64_t this_arg) {
65966         LDKUnsignedInvoiceRequest this_arg_conv;
65967         this_arg_conv.inner = untag_ptr(this_arg);
65968         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65970         this_arg_conv.is_owned = false;
65971         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
65972         *ret_copy = UnsignedInvoiceRequest_quantity(&this_arg_conv);
65973         uint64_t ret_ref = tag_ptr(ret_copy, true);
65974         return ret_ref;
65975 }
65976
65977 int8_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_payer_id"))) TS_UnsignedInvoiceRequest_payer_id(uint64_t this_arg) {
65978         LDKUnsignedInvoiceRequest this_arg_conv;
65979         this_arg_conv.inner = untag_ptr(this_arg);
65980         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65982         this_arg_conv.is_owned = false;
65983         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
65984         memcpy(ret_arr->elems, UnsignedInvoiceRequest_payer_id(&this_arg_conv).compressed_form, 33);
65985         return ret_arr;
65986 }
65987
65988 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_payer_note"))) TS_UnsignedInvoiceRequest_payer_note(uint64_t this_arg) {
65989         LDKUnsignedInvoiceRequest this_arg_conv;
65990         this_arg_conv.inner = untag_ptr(this_arg);
65991         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65993         this_arg_conv.is_owned = false;
65994         LDKPrintableString ret_var = UnsignedInvoiceRequest_payer_note(&this_arg_conv);
65995         uint64_t ret_ref = 0;
65996         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65997         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65998         return ret_ref;
65999 }
66000
66001 ptrArray  __attribute__((export_name("TS_InvoiceRequest_chains"))) TS_InvoiceRequest_chains(uint64_t this_arg) {
66002         LDKInvoiceRequest this_arg_conv;
66003         this_arg_conv.inner = untag_ptr(this_arg);
66004         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66006         this_arg_conv.is_owned = false;
66007         LDKCVec_ThirtyTwoBytesZ ret_var = InvoiceRequest_chains(&this_arg_conv);
66008         ptrArray ret_arr = NULL;
66009         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
66010         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
66011         for (size_t m = 0; m < ret_var.datalen; m++) {
66012                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
66013                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
66014                 ret_arr_ptr[m] = ret_conv_12_arr;
66015         }
66016         
66017         FREE(ret_var.data);
66018         return ret_arr;
66019 }
66020
66021 uint64_t  __attribute__((export_name("TS_InvoiceRequest_metadata"))) TS_InvoiceRequest_metadata(uint64_t this_arg) {
66022         LDKInvoiceRequest this_arg_conv;
66023         this_arg_conv.inner = untag_ptr(this_arg);
66024         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66026         this_arg_conv.is_owned = false;
66027         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
66028         *ret_copy = InvoiceRequest_metadata(&this_arg_conv);
66029         uint64_t ret_ref = tag_ptr(ret_copy, true);
66030         return ret_ref;
66031 }
66032
66033 uint64_t  __attribute__((export_name("TS_InvoiceRequest_amount"))) TS_InvoiceRequest_amount(uint64_t this_arg) {
66034         LDKInvoiceRequest 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         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
66040         *ret_copy = InvoiceRequest_amount(&this_arg_conv);
66041         uint64_t ret_ref = tag_ptr(ret_copy, true);
66042         return ret_ref;
66043 }
66044
66045 uint64_t  __attribute__((export_name("TS_InvoiceRequest_description"))) TS_InvoiceRequest_description(uint64_t this_arg) {
66046         LDKInvoiceRequest this_arg_conv;
66047         this_arg_conv.inner = untag_ptr(this_arg);
66048         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66050         this_arg_conv.is_owned = false;
66051         LDKPrintableString ret_var = InvoiceRequest_description(&this_arg_conv);
66052         uint64_t ret_ref = 0;
66053         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66054         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66055         return ret_ref;
66056 }
66057
66058 uint64_t  __attribute__((export_name("TS_InvoiceRequest_offer_features"))) TS_InvoiceRequest_offer_features(uint64_t this_arg) {
66059         LDKInvoiceRequest this_arg_conv;
66060         this_arg_conv.inner = untag_ptr(this_arg);
66061         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66063         this_arg_conv.is_owned = false;
66064         LDKOfferFeatures ret_var = InvoiceRequest_offer_features(&this_arg_conv);
66065         uint64_t ret_ref = 0;
66066         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66067         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66068         return ret_ref;
66069 }
66070
66071 uint64_t  __attribute__((export_name("TS_InvoiceRequest_absolute_expiry"))) TS_InvoiceRequest_absolute_expiry(uint64_t this_arg) {
66072         LDKInvoiceRequest this_arg_conv;
66073         this_arg_conv.inner = untag_ptr(this_arg);
66074         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66076         this_arg_conv.is_owned = false;
66077         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66078         *ret_copy = InvoiceRequest_absolute_expiry(&this_arg_conv);
66079         uint64_t ret_ref = tag_ptr(ret_copy, true);
66080         return ret_ref;
66081 }
66082
66083 uint64_t  __attribute__((export_name("TS_InvoiceRequest_issuer"))) TS_InvoiceRequest_issuer(uint64_t this_arg) {
66084         LDKInvoiceRequest this_arg_conv;
66085         this_arg_conv.inner = untag_ptr(this_arg);
66086         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66088         this_arg_conv.is_owned = false;
66089         LDKPrintableString ret_var = InvoiceRequest_issuer(&this_arg_conv);
66090         uint64_t ret_ref = 0;
66091         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66092         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66093         return ret_ref;
66094 }
66095
66096 uint64_tArray  __attribute__((export_name("TS_InvoiceRequest_paths"))) TS_InvoiceRequest_paths(uint64_t this_arg) {
66097         LDKInvoiceRequest this_arg_conv;
66098         this_arg_conv.inner = untag_ptr(this_arg);
66099         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66101         this_arg_conv.is_owned = false;
66102         LDKCVec_BlindedPathZ ret_var = InvoiceRequest_paths(&this_arg_conv);
66103         uint64_tArray ret_arr = NULL;
66104         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
66105         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
66106         for (size_t n = 0; n < ret_var.datalen; n++) {
66107                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
66108                 uint64_t ret_conv_13_ref = 0;
66109                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
66110                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
66111                 ret_arr_ptr[n] = ret_conv_13_ref;
66112         }
66113         
66114         FREE(ret_var.data);
66115         return ret_arr;
66116 }
66117
66118 uint64_t  __attribute__((export_name("TS_InvoiceRequest_supported_quantity"))) TS_InvoiceRequest_supported_quantity(uint64_t this_arg) {
66119         LDKInvoiceRequest this_arg_conv;
66120         this_arg_conv.inner = untag_ptr(this_arg);
66121         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66123         this_arg_conv.is_owned = false;
66124         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
66125         *ret_copy = InvoiceRequest_supported_quantity(&this_arg_conv);
66126         uint64_t ret_ref = tag_ptr(ret_copy, true);
66127         return ret_ref;
66128 }
66129
66130 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_signing_pubkey"))) TS_InvoiceRequest_signing_pubkey(uint64_t this_arg) {
66131         LDKInvoiceRequest this_arg_conv;
66132         this_arg_conv.inner = untag_ptr(this_arg);
66133         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66135         this_arg_conv.is_owned = false;
66136         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
66137         memcpy(ret_arr->elems, InvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form, 33);
66138         return ret_arr;
66139 }
66140
66141 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_payer_metadata"))) TS_InvoiceRequest_payer_metadata(uint64_t this_arg) {
66142         LDKInvoiceRequest this_arg_conv;
66143         this_arg_conv.inner = untag_ptr(this_arg);
66144         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66146         this_arg_conv.is_owned = false;
66147         LDKu8slice ret_var = InvoiceRequest_payer_metadata(&this_arg_conv);
66148         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
66149         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
66150         return ret_arr;
66151 }
66152
66153 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_chain"))) TS_InvoiceRequest_chain(uint64_t this_arg) {
66154         LDKInvoiceRequest this_arg_conv;
66155         this_arg_conv.inner = untag_ptr(this_arg);
66156         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66158         this_arg_conv.is_owned = false;
66159         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
66160         memcpy(ret_arr->elems, InvoiceRequest_chain(&this_arg_conv).data, 32);
66161         return ret_arr;
66162 }
66163
66164 uint64_t  __attribute__((export_name("TS_InvoiceRequest_amount_msats"))) TS_InvoiceRequest_amount_msats(uint64_t this_arg) {
66165         LDKInvoiceRequest 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_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66171         *ret_copy = InvoiceRequest_amount_msats(&this_arg_conv);
66172         uint64_t ret_ref = tag_ptr(ret_copy, true);
66173         return ret_ref;
66174 }
66175
66176 uint64_t  __attribute__((export_name("TS_InvoiceRequest_invoice_request_features"))) TS_InvoiceRequest_invoice_request_features(uint64_t this_arg) {
66177         LDKInvoiceRequest 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         LDKInvoiceRequestFeatures ret_var = InvoiceRequest_invoice_request_features(&this_arg_conv);
66183         uint64_t ret_ref = 0;
66184         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66185         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66186         return ret_ref;
66187 }
66188
66189 uint64_t  __attribute__((export_name("TS_InvoiceRequest_quantity"))) TS_InvoiceRequest_quantity(uint64_t this_arg) {
66190         LDKInvoiceRequest this_arg_conv;
66191         this_arg_conv.inner = untag_ptr(this_arg);
66192         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66194         this_arg_conv.is_owned = false;
66195         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66196         *ret_copy = InvoiceRequest_quantity(&this_arg_conv);
66197         uint64_t ret_ref = tag_ptr(ret_copy, true);
66198         return ret_ref;
66199 }
66200
66201 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_payer_id"))) TS_InvoiceRequest_payer_id(uint64_t this_arg) {
66202         LDKInvoiceRequest 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         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
66208         memcpy(ret_arr->elems, InvoiceRequest_payer_id(&this_arg_conv).compressed_form, 33);
66209         return ret_arr;
66210 }
66211
66212 uint64_t  __attribute__((export_name("TS_InvoiceRequest_payer_note"))) TS_InvoiceRequest_payer_note(uint64_t this_arg) {
66213         LDKInvoiceRequest this_arg_conv;
66214         this_arg_conv.inner = untag_ptr(this_arg);
66215         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66217         this_arg_conv.is_owned = false;
66218         LDKPrintableString ret_var = InvoiceRequest_payer_note(&this_arg_conv);
66219         uint64_t ret_ref = 0;
66220         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66221         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66222         return ret_ref;
66223 }
66224
66225 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) {
66226         LDKInvoiceRequest this_arg_conv;
66227         this_arg_conv.inner = untag_ptr(this_arg);
66228         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66230         this_arg_conv.is_owned = false;
66231         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ payment_paths_constr;
66232         payment_paths_constr.datalen = payment_paths->arr_len;
66233         if (payment_paths_constr.datalen > 0)
66234                 payment_paths_constr.data = MALLOC(payment_paths_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
66235         else
66236                 payment_paths_constr.data = NULL;
66237         uint64_t* payment_paths_vals = payment_paths->elems;
66238         for (size_t l = 0; l < payment_paths_constr.datalen; l++) {
66239                 uint64_t payment_paths_conv_37 = payment_paths_vals[l];
66240                 void* payment_paths_conv_37_ptr = untag_ptr(payment_paths_conv_37);
66241                 CHECK_ACCESS(payment_paths_conv_37_ptr);
66242                 LDKC2Tuple_BlindedPayInfoBlindedPathZ payment_paths_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(payment_paths_conv_37_ptr);
66243                 payment_paths_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(payment_paths_conv_37));
66244                 payment_paths_constr.data[l] = payment_paths_conv_37_conv;
66245         }
66246         FREE(payment_paths);
66247         LDKThirtyTwoBytes payment_hash_ref;
66248         CHECK(payment_hash->arr_len == 32);
66249         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
66250         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ");
66251         *ret_conv = InvoiceRequest_respond_with_no_std(&this_arg_conv, payment_paths_constr, payment_hash_ref, created_at);
66252         return tag_ptr(ret_conv, true);
66253 }
66254
66255 uint64_t  __attribute__((export_name("TS_InvoiceRequest_verify"))) TS_InvoiceRequest_verify(uint64_t this_arg, uint64_t key) {
66256         LDKInvoiceRequest this_arg_conv;
66257         this_arg_conv.inner = untag_ptr(this_arg);
66258         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66260         this_arg_conv = InvoiceRequest_clone(&this_arg_conv);
66261         LDKExpandedKey key_conv;
66262         key_conv.inner = untag_ptr(key);
66263         key_conv.is_owned = ptr_is_owned(key);
66264         CHECK_INNER_FIELD_ACCESS_OR_NULL(key_conv);
66265         key_conv.is_owned = false;
66266         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
66267         *ret_conv = InvoiceRequest_verify(this_arg_conv, &key_conv);
66268         return tag_ptr(ret_conv, true);
66269 }
66270
66271 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_signature"))) TS_InvoiceRequest_signature(uint64_t this_arg) {
66272         LDKInvoiceRequest this_arg_conv;
66273         this_arg_conv.inner = untag_ptr(this_arg);
66274         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66276         this_arg_conv.is_owned = false;
66277         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
66278         memcpy(ret_arr->elems, InvoiceRequest_signature(&this_arg_conv).compact_form, 64);
66279         return ret_arr;
66280 }
66281
66282 ptrArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_chains"))) TS_VerifiedInvoiceRequest_chains(uint64_t this_arg) {
66283         LDKVerifiedInvoiceRequest this_arg_conv;
66284         this_arg_conv.inner = untag_ptr(this_arg);
66285         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66287         this_arg_conv.is_owned = false;
66288         LDKCVec_ThirtyTwoBytesZ ret_var = VerifiedInvoiceRequest_chains(&this_arg_conv);
66289         ptrArray ret_arr = NULL;
66290         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
66291         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
66292         for (size_t m = 0; m < ret_var.datalen; m++) {
66293                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
66294                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
66295                 ret_arr_ptr[m] = ret_conv_12_arr;
66296         }
66297         
66298         FREE(ret_var.data);
66299         return ret_arr;
66300 }
66301
66302 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_metadata"))) TS_VerifiedInvoiceRequest_metadata(uint64_t this_arg) {
66303         LDKVerifiedInvoiceRequest 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         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
66309         *ret_copy = VerifiedInvoiceRequest_metadata(&this_arg_conv);
66310         uint64_t ret_ref = tag_ptr(ret_copy, true);
66311         return ret_ref;
66312 }
66313
66314 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_amount"))) TS_VerifiedInvoiceRequest_amount(uint64_t this_arg) {
66315         LDKVerifiedInvoiceRequest this_arg_conv;
66316         this_arg_conv.inner = untag_ptr(this_arg);
66317         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66319         this_arg_conv.is_owned = false;
66320         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
66321         *ret_copy = VerifiedInvoiceRequest_amount(&this_arg_conv);
66322         uint64_t ret_ref = tag_ptr(ret_copy, true);
66323         return ret_ref;
66324 }
66325
66326 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_description"))) TS_VerifiedInvoiceRequest_description(uint64_t this_arg) {
66327         LDKVerifiedInvoiceRequest this_arg_conv;
66328         this_arg_conv.inner = untag_ptr(this_arg);
66329         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66331         this_arg_conv.is_owned = false;
66332         LDKPrintableString ret_var = VerifiedInvoiceRequest_description(&this_arg_conv);
66333         uint64_t ret_ref = 0;
66334         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66335         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66336         return ret_ref;
66337 }
66338
66339 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_offer_features"))) TS_VerifiedInvoiceRequest_offer_features(uint64_t this_arg) {
66340         LDKVerifiedInvoiceRequest this_arg_conv;
66341         this_arg_conv.inner = untag_ptr(this_arg);
66342         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66344         this_arg_conv.is_owned = false;
66345         LDKOfferFeatures ret_var = VerifiedInvoiceRequest_offer_features(&this_arg_conv);
66346         uint64_t ret_ref = 0;
66347         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66348         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66349         return ret_ref;
66350 }
66351
66352 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_absolute_expiry"))) TS_VerifiedInvoiceRequest_absolute_expiry(uint64_t this_arg) {
66353         LDKVerifiedInvoiceRequest this_arg_conv;
66354         this_arg_conv.inner = untag_ptr(this_arg);
66355         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66357         this_arg_conv.is_owned = false;
66358         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66359         *ret_copy = VerifiedInvoiceRequest_absolute_expiry(&this_arg_conv);
66360         uint64_t ret_ref = tag_ptr(ret_copy, true);
66361         return ret_ref;
66362 }
66363
66364 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_issuer"))) TS_VerifiedInvoiceRequest_issuer(uint64_t this_arg) {
66365         LDKVerifiedInvoiceRequest this_arg_conv;
66366         this_arg_conv.inner = untag_ptr(this_arg);
66367         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66369         this_arg_conv.is_owned = false;
66370         LDKPrintableString ret_var = VerifiedInvoiceRequest_issuer(&this_arg_conv);
66371         uint64_t ret_ref = 0;
66372         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66373         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66374         return ret_ref;
66375 }
66376
66377 uint64_tArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_paths"))) TS_VerifiedInvoiceRequest_paths(uint64_t this_arg) {
66378         LDKVerifiedInvoiceRequest this_arg_conv;
66379         this_arg_conv.inner = untag_ptr(this_arg);
66380         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66382         this_arg_conv.is_owned = false;
66383         LDKCVec_BlindedPathZ ret_var = VerifiedInvoiceRequest_paths(&this_arg_conv);
66384         uint64_tArray ret_arr = NULL;
66385         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
66386         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
66387         for (size_t n = 0; n < ret_var.datalen; n++) {
66388                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
66389                 uint64_t ret_conv_13_ref = 0;
66390                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
66391                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
66392                 ret_arr_ptr[n] = ret_conv_13_ref;
66393         }
66394         
66395         FREE(ret_var.data);
66396         return ret_arr;
66397 }
66398
66399 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_supported_quantity"))) TS_VerifiedInvoiceRequest_supported_quantity(uint64_t this_arg) {
66400         LDKVerifiedInvoiceRequest this_arg_conv;
66401         this_arg_conv.inner = untag_ptr(this_arg);
66402         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66404         this_arg_conv.is_owned = false;
66405         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
66406         *ret_copy = VerifiedInvoiceRequest_supported_quantity(&this_arg_conv);
66407         uint64_t ret_ref = tag_ptr(ret_copy, true);
66408         return ret_ref;
66409 }
66410
66411 int8_tArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_signing_pubkey"))) TS_VerifiedInvoiceRequest_signing_pubkey(uint64_t this_arg) {
66412         LDKVerifiedInvoiceRequest this_arg_conv;
66413         this_arg_conv.inner = untag_ptr(this_arg);
66414         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66416         this_arg_conv.is_owned = false;
66417         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
66418         memcpy(ret_arr->elems, VerifiedInvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form, 33);
66419         return ret_arr;
66420 }
66421
66422 int8_tArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_payer_metadata"))) TS_VerifiedInvoiceRequest_payer_metadata(uint64_t this_arg) {
66423         LDKVerifiedInvoiceRequest this_arg_conv;
66424         this_arg_conv.inner = untag_ptr(this_arg);
66425         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66427         this_arg_conv.is_owned = false;
66428         LDKu8slice ret_var = VerifiedInvoiceRequest_payer_metadata(&this_arg_conv);
66429         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
66430         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
66431         return ret_arr;
66432 }
66433
66434 int8_tArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_chain"))) TS_VerifiedInvoiceRequest_chain(uint64_t this_arg) {
66435         LDKVerifiedInvoiceRequest this_arg_conv;
66436         this_arg_conv.inner = untag_ptr(this_arg);
66437         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66439         this_arg_conv.is_owned = false;
66440         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
66441         memcpy(ret_arr->elems, VerifiedInvoiceRequest_chain(&this_arg_conv).data, 32);
66442         return ret_arr;
66443 }
66444
66445 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_amount_msats"))) TS_VerifiedInvoiceRequest_amount_msats(uint64_t this_arg) {
66446         LDKVerifiedInvoiceRequest this_arg_conv;
66447         this_arg_conv.inner = untag_ptr(this_arg);
66448         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66450         this_arg_conv.is_owned = false;
66451         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66452         *ret_copy = VerifiedInvoiceRequest_amount_msats(&this_arg_conv);
66453         uint64_t ret_ref = tag_ptr(ret_copy, true);
66454         return ret_ref;
66455 }
66456
66457 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_invoice_request_features"))) TS_VerifiedInvoiceRequest_invoice_request_features(uint64_t this_arg) {
66458         LDKVerifiedInvoiceRequest this_arg_conv;
66459         this_arg_conv.inner = untag_ptr(this_arg);
66460         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66462         this_arg_conv.is_owned = false;
66463         LDKInvoiceRequestFeatures ret_var = VerifiedInvoiceRequest_invoice_request_features(&this_arg_conv);
66464         uint64_t ret_ref = 0;
66465         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66466         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66467         return ret_ref;
66468 }
66469
66470 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_quantity"))) TS_VerifiedInvoiceRequest_quantity(uint64_t this_arg) {
66471         LDKVerifiedInvoiceRequest this_arg_conv;
66472         this_arg_conv.inner = untag_ptr(this_arg);
66473         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66475         this_arg_conv.is_owned = false;
66476         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66477         *ret_copy = VerifiedInvoiceRequest_quantity(&this_arg_conv);
66478         uint64_t ret_ref = tag_ptr(ret_copy, true);
66479         return ret_ref;
66480 }
66481
66482 int8_tArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_payer_id"))) TS_VerifiedInvoiceRequest_payer_id(uint64_t this_arg) {
66483         LDKVerifiedInvoiceRequest this_arg_conv;
66484         this_arg_conv.inner = untag_ptr(this_arg);
66485         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66487         this_arg_conv.is_owned = false;
66488         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
66489         memcpy(ret_arr->elems, VerifiedInvoiceRequest_payer_id(&this_arg_conv).compressed_form, 33);
66490         return ret_arr;
66491 }
66492
66493 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_payer_note"))) TS_VerifiedInvoiceRequest_payer_note(uint64_t this_arg) {
66494         LDKVerifiedInvoiceRequest this_arg_conv;
66495         this_arg_conv.inner = untag_ptr(this_arg);
66496         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66498         this_arg_conv.is_owned = false;
66499         LDKPrintableString ret_var = VerifiedInvoiceRequest_payer_note(&this_arg_conv);
66500         uint64_t ret_ref = 0;
66501         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66502         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66503         return ret_ref;
66504 }
66505
66506 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) {
66507         LDKVerifiedInvoiceRequest this_arg_conv;
66508         this_arg_conv.inner = untag_ptr(this_arg);
66509         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66511         this_arg_conv.is_owned = false;
66512         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ payment_paths_constr;
66513         payment_paths_constr.datalen = payment_paths->arr_len;
66514         if (payment_paths_constr.datalen > 0)
66515                 payment_paths_constr.data = MALLOC(payment_paths_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
66516         else
66517                 payment_paths_constr.data = NULL;
66518         uint64_t* payment_paths_vals = payment_paths->elems;
66519         for (size_t l = 0; l < payment_paths_constr.datalen; l++) {
66520                 uint64_t payment_paths_conv_37 = payment_paths_vals[l];
66521                 void* payment_paths_conv_37_ptr = untag_ptr(payment_paths_conv_37);
66522                 CHECK_ACCESS(payment_paths_conv_37_ptr);
66523                 LDKC2Tuple_BlindedPayInfoBlindedPathZ payment_paths_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(payment_paths_conv_37_ptr);
66524                 payment_paths_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(payment_paths_conv_37));
66525                 payment_paths_constr.data[l] = payment_paths_conv_37_conv;
66526         }
66527         FREE(payment_paths);
66528         LDKThirtyTwoBytes payment_hash_ref;
66529         CHECK(payment_hash->arr_len == 32);
66530         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
66531         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ");
66532         *ret_conv = VerifiedInvoiceRequest_respond_with_no_std(&this_arg_conv, payment_paths_constr, payment_hash_ref, created_at);
66533         return tag_ptr(ret_conv, true);
66534 }
66535
66536 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) {
66537         LDKVerifiedInvoiceRequest this_arg_conv;
66538         this_arg_conv.inner = untag_ptr(this_arg);
66539         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66541         this_arg_conv.is_owned = false;
66542         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ payment_paths_constr;
66543         payment_paths_constr.datalen = payment_paths->arr_len;
66544         if (payment_paths_constr.datalen > 0)
66545                 payment_paths_constr.data = MALLOC(payment_paths_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
66546         else
66547                 payment_paths_constr.data = NULL;
66548         uint64_t* payment_paths_vals = payment_paths->elems;
66549         for (size_t l = 0; l < payment_paths_constr.datalen; l++) {
66550                 uint64_t payment_paths_conv_37 = payment_paths_vals[l];
66551                 void* payment_paths_conv_37_ptr = untag_ptr(payment_paths_conv_37);
66552                 CHECK_ACCESS(payment_paths_conv_37_ptr);
66553                 LDKC2Tuple_BlindedPayInfoBlindedPathZ payment_paths_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(payment_paths_conv_37_ptr);
66554                 payment_paths_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(payment_paths_conv_37));
66555                 payment_paths_constr.data[l] = payment_paths_conv_37_conv;
66556         }
66557         FREE(payment_paths);
66558         LDKThirtyTwoBytes payment_hash_ref;
66559         CHECK(payment_hash->arr_len == 32);
66560         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
66561         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ");
66562         *ret_conv = VerifiedInvoiceRequest_respond_using_derived_keys_no_std(&this_arg_conv, payment_paths_constr, payment_hash_ref, created_at);
66563         return tag_ptr(ret_conv, true);
66564 }
66565
66566 int8_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_write"))) TS_UnsignedInvoiceRequest_write(uint64_t obj) {
66567         LDKUnsignedInvoiceRequest obj_conv;
66568         obj_conv.inner = untag_ptr(obj);
66569         obj_conv.is_owned = ptr_is_owned(obj);
66570         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66571         obj_conv.is_owned = false;
66572         LDKCVec_u8Z ret_var = UnsignedInvoiceRequest_write(&obj_conv);
66573         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
66574         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
66575         CVec_u8Z_free(ret_var);
66576         return ret_arr;
66577 }
66578
66579 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_write"))) TS_InvoiceRequest_write(uint64_t obj) {
66580         LDKInvoiceRequest obj_conv;
66581         obj_conv.inner = untag_ptr(obj);
66582         obj_conv.is_owned = ptr_is_owned(obj);
66583         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66584         obj_conv.is_owned = false;
66585         LDKCVec_u8Z ret_var = InvoiceRequest_write(&obj_conv);
66586         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
66587         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
66588         CVec_u8Z_free(ret_var);
66589         return ret_arr;
66590 }
66591
66592 void  __attribute__((export_name("TS_InvoiceRequestFields_free"))) TS_InvoiceRequestFields_free(uint64_t this_obj) {
66593         LDKInvoiceRequestFields this_obj_conv;
66594         this_obj_conv.inner = untag_ptr(this_obj);
66595         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66597         InvoiceRequestFields_free(this_obj_conv);
66598 }
66599
66600 int8_tArray  __attribute__((export_name("TS_InvoiceRequestFields_get_payer_id"))) TS_InvoiceRequestFields_get_payer_id(uint64_t this_ptr) {
66601         LDKInvoiceRequestFields this_ptr_conv;
66602         this_ptr_conv.inner = untag_ptr(this_ptr);
66603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66605         this_ptr_conv.is_owned = false;
66606         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
66607         memcpy(ret_arr->elems, InvoiceRequestFields_get_payer_id(&this_ptr_conv).compressed_form, 33);
66608         return ret_arr;
66609 }
66610
66611 void  __attribute__((export_name("TS_InvoiceRequestFields_set_payer_id"))) TS_InvoiceRequestFields_set_payer_id(uint64_t this_ptr, int8_tArray val) {
66612         LDKInvoiceRequestFields this_ptr_conv;
66613         this_ptr_conv.inner = untag_ptr(this_ptr);
66614         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66616         this_ptr_conv.is_owned = false;
66617         LDKPublicKey val_ref;
66618         CHECK(val->arr_len == 33);
66619         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
66620         InvoiceRequestFields_set_payer_id(&this_ptr_conv, val_ref);
66621 }
66622
66623 uint64_t  __attribute__((export_name("TS_InvoiceRequestFields_get_quantity"))) TS_InvoiceRequestFields_get_quantity(uint64_t this_ptr) {
66624         LDKInvoiceRequestFields this_ptr_conv;
66625         this_ptr_conv.inner = untag_ptr(this_ptr);
66626         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66628         this_ptr_conv.is_owned = false;
66629         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66630         *ret_copy = InvoiceRequestFields_get_quantity(&this_ptr_conv);
66631         uint64_t ret_ref = tag_ptr(ret_copy, true);
66632         return ret_ref;
66633 }
66634
66635 void  __attribute__((export_name("TS_InvoiceRequestFields_set_quantity"))) TS_InvoiceRequestFields_set_quantity(uint64_t this_ptr, uint64_t val) {
66636         LDKInvoiceRequestFields this_ptr_conv;
66637         this_ptr_conv.inner = untag_ptr(this_ptr);
66638         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66640         this_ptr_conv.is_owned = false;
66641         void* val_ptr = untag_ptr(val);
66642         CHECK_ACCESS(val_ptr);
66643         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
66644         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
66645         InvoiceRequestFields_set_quantity(&this_ptr_conv, val_conv);
66646 }
66647
66648 uint64_t  __attribute__((export_name("TS_InvoiceRequestFields_get_payer_note_truncated"))) TS_InvoiceRequestFields_get_payer_note_truncated(uint64_t this_ptr) {
66649         LDKInvoiceRequestFields this_ptr_conv;
66650         this_ptr_conv.inner = untag_ptr(this_ptr);
66651         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66653         this_ptr_conv.is_owned = false;
66654         LDKUntrustedString ret_var = InvoiceRequestFields_get_payer_note_truncated(&this_ptr_conv);
66655         uint64_t ret_ref = 0;
66656         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66657         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66658         return ret_ref;
66659 }
66660
66661 void  __attribute__((export_name("TS_InvoiceRequestFields_set_payer_note_truncated"))) TS_InvoiceRequestFields_set_payer_note_truncated(uint64_t this_ptr, uint64_t val) {
66662         LDKInvoiceRequestFields this_ptr_conv;
66663         this_ptr_conv.inner = untag_ptr(this_ptr);
66664         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66666         this_ptr_conv.is_owned = false;
66667         LDKUntrustedString val_conv;
66668         val_conv.inner = untag_ptr(val);
66669         val_conv.is_owned = ptr_is_owned(val);
66670         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
66671         val_conv = UntrustedString_clone(&val_conv);
66672         InvoiceRequestFields_set_payer_note_truncated(&this_ptr_conv, val_conv);
66673 }
66674
66675 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) {
66676         LDKPublicKey payer_id_arg_ref;
66677         CHECK(payer_id_arg->arr_len == 33);
66678         memcpy(payer_id_arg_ref.compressed_form, payer_id_arg->elems, 33); FREE(payer_id_arg);
66679         void* quantity_arg_ptr = untag_ptr(quantity_arg);
66680         CHECK_ACCESS(quantity_arg_ptr);
66681         LDKCOption_u64Z quantity_arg_conv = *(LDKCOption_u64Z*)(quantity_arg_ptr);
66682         quantity_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(quantity_arg));
66683         LDKUntrustedString payer_note_truncated_arg_conv;
66684         payer_note_truncated_arg_conv.inner = untag_ptr(payer_note_truncated_arg);
66685         payer_note_truncated_arg_conv.is_owned = ptr_is_owned(payer_note_truncated_arg);
66686         CHECK_INNER_FIELD_ACCESS_OR_NULL(payer_note_truncated_arg_conv);
66687         payer_note_truncated_arg_conv = UntrustedString_clone(&payer_note_truncated_arg_conv);
66688         LDKInvoiceRequestFields ret_var = InvoiceRequestFields_new(payer_id_arg_ref, quantity_arg_conv, payer_note_truncated_arg_conv);
66689         uint64_t ret_ref = 0;
66690         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66691         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66692         return ret_ref;
66693 }
66694
66695 static inline uint64_t InvoiceRequestFields_clone_ptr(LDKInvoiceRequestFields *NONNULL_PTR arg) {
66696         LDKInvoiceRequestFields ret_var = InvoiceRequestFields_clone(arg);
66697         uint64_t ret_ref = 0;
66698         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66699         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66700         return ret_ref;
66701 }
66702 int64_t  __attribute__((export_name("TS_InvoiceRequestFields_clone_ptr"))) TS_InvoiceRequestFields_clone_ptr(uint64_t arg) {
66703         LDKInvoiceRequestFields arg_conv;
66704         arg_conv.inner = untag_ptr(arg);
66705         arg_conv.is_owned = ptr_is_owned(arg);
66706         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66707         arg_conv.is_owned = false;
66708         int64_t ret_conv = InvoiceRequestFields_clone_ptr(&arg_conv);
66709         return ret_conv;
66710 }
66711
66712 uint64_t  __attribute__((export_name("TS_InvoiceRequestFields_clone"))) TS_InvoiceRequestFields_clone(uint64_t orig) {
66713         LDKInvoiceRequestFields orig_conv;
66714         orig_conv.inner = untag_ptr(orig);
66715         orig_conv.is_owned = ptr_is_owned(orig);
66716         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66717         orig_conv.is_owned = false;
66718         LDKInvoiceRequestFields ret_var = InvoiceRequestFields_clone(&orig_conv);
66719         uint64_t ret_ref = 0;
66720         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66721         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66722         return ret_ref;
66723 }
66724
66725 jboolean  __attribute__((export_name("TS_InvoiceRequestFields_eq"))) TS_InvoiceRequestFields_eq(uint64_t a, uint64_t b) {
66726         LDKInvoiceRequestFields a_conv;
66727         a_conv.inner = untag_ptr(a);
66728         a_conv.is_owned = ptr_is_owned(a);
66729         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66730         a_conv.is_owned = false;
66731         LDKInvoiceRequestFields b_conv;
66732         b_conv.inner = untag_ptr(b);
66733         b_conv.is_owned = ptr_is_owned(b);
66734         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
66735         b_conv.is_owned = false;
66736         jboolean ret_conv = InvoiceRequestFields_eq(&a_conv, &b_conv);
66737         return ret_conv;
66738 }
66739
66740 int8_tArray  __attribute__((export_name("TS_InvoiceRequestFields_write"))) TS_InvoiceRequestFields_write(uint64_t obj) {
66741         LDKInvoiceRequestFields obj_conv;
66742         obj_conv.inner = untag_ptr(obj);
66743         obj_conv.is_owned = ptr_is_owned(obj);
66744         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66745         obj_conv.is_owned = false;
66746         LDKCVec_u8Z ret_var = InvoiceRequestFields_write(&obj_conv);
66747         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
66748         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
66749         CVec_u8Z_free(ret_var);
66750         return ret_arr;
66751 }
66752
66753 uint64_t  __attribute__((export_name("TS_InvoiceRequestFields_read"))) TS_InvoiceRequestFields_read(int8_tArray ser) {
66754         LDKu8slice ser_ref;
66755         ser_ref.datalen = ser->arr_len;
66756         ser_ref.data = ser->elems;
66757         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFieldsDecodeErrorZ), "LDKCResult_InvoiceRequestFieldsDecodeErrorZ");
66758         *ret_conv = InvoiceRequestFields_read(ser_ref);
66759         FREE(ser);
66760         return tag_ptr(ret_conv, true);
66761 }
66762
66763 void  __attribute__((export_name("TS_TaggedHash_free"))) TS_TaggedHash_free(uint64_t this_obj) {
66764         LDKTaggedHash this_obj_conv;
66765         this_obj_conv.inner = untag_ptr(this_obj);
66766         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66768         TaggedHash_free(this_obj_conv);
66769 }
66770
66771 static inline uint64_t TaggedHash_clone_ptr(LDKTaggedHash *NONNULL_PTR arg) {
66772         LDKTaggedHash ret_var = TaggedHash_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_TaggedHash_clone_ptr"))) TS_TaggedHash_clone_ptr(uint64_t arg) {
66779         LDKTaggedHash 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 = TaggedHash_clone_ptr(&arg_conv);
66785         return ret_conv;
66786 }
66787
66788 uint64_t  __attribute__((export_name("TS_TaggedHash_clone"))) TS_TaggedHash_clone(uint64_t orig) {
66789         LDKTaggedHash 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         LDKTaggedHash ret_var = TaggedHash_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 int8_tArray  __attribute__((export_name("TS_TaggedHash_as_digest"))) TS_TaggedHash_as_digest(uint64_t this_arg) {
66802         LDKTaggedHash this_arg_conv;
66803         this_arg_conv.inner = untag_ptr(this_arg);
66804         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66806         this_arg_conv.is_owned = false;
66807         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
66808         memcpy(ret_arr->elems, *TaggedHash_as_digest(&this_arg_conv), 32);
66809         return ret_arr;
66810 }
66811
66812 jstring  __attribute__((export_name("TS_TaggedHash_tag"))) TS_TaggedHash_tag(uint64_t this_arg) {
66813         LDKTaggedHash this_arg_conv;
66814         this_arg_conv.inner = untag_ptr(this_arg);
66815         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66817         this_arg_conv.is_owned = false;
66818         LDKStr ret_str = TaggedHash_tag(&this_arg_conv);
66819         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
66820         Str_free(ret_str);
66821         return ret_conv;
66822 }
66823
66824 int8_tArray  __attribute__((export_name("TS_TaggedHash_merkle_root"))) TS_TaggedHash_merkle_root(uint64_t this_arg) {
66825         LDKTaggedHash this_arg_conv;
66826         this_arg_conv.inner = untag_ptr(this_arg);
66827         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66829         this_arg_conv.is_owned = false;
66830         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
66831         memcpy(ret_arr->elems, TaggedHash_merkle_root(&this_arg_conv).data, 32);
66832         return ret_arr;
66833 }
66834
66835 void  __attribute__((export_name("TS_SignError_free"))) TS_SignError_free(uint64_t this_ptr) {
66836         if (!ptr_is_owned(this_ptr)) return;
66837         void* this_ptr_ptr = untag_ptr(this_ptr);
66838         CHECK_ACCESS(this_ptr_ptr);
66839         LDKSignError this_ptr_conv = *(LDKSignError*)(this_ptr_ptr);
66840         FREE(untag_ptr(this_ptr));
66841         SignError_free(this_ptr_conv);
66842 }
66843
66844 static inline uint64_t SignError_clone_ptr(LDKSignError *NONNULL_PTR arg) {
66845         LDKSignError *ret_copy = MALLOC(sizeof(LDKSignError), "LDKSignError");
66846         *ret_copy = SignError_clone(arg);
66847         uint64_t ret_ref = tag_ptr(ret_copy, true);
66848         return ret_ref;
66849 }
66850 int64_t  __attribute__((export_name("TS_SignError_clone_ptr"))) TS_SignError_clone_ptr(uint64_t arg) {
66851         LDKSignError* arg_conv = (LDKSignError*)untag_ptr(arg);
66852         int64_t ret_conv = SignError_clone_ptr(arg_conv);
66853         return ret_conv;
66854 }
66855
66856 uint64_t  __attribute__((export_name("TS_SignError_clone"))) TS_SignError_clone(uint64_t orig) {
66857         LDKSignError* orig_conv = (LDKSignError*)untag_ptr(orig);
66858         LDKSignError *ret_copy = MALLOC(sizeof(LDKSignError), "LDKSignError");
66859         *ret_copy = SignError_clone(orig_conv);
66860         uint64_t ret_ref = tag_ptr(ret_copy, true);
66861         return ret_ref;
66862 }
66863
66864 uint64_t  __attribute__((export_name("TS_SignError_signing"))) TS_SignError_signing() {
66865         LDKSignError *ret_copy = MALLOC(sizeof(LDKSignError), "LDKSignError");
66866         *ret_copy = SignError_signing();
66867         uint64_t ret_ref = tag_ptr(ret_copy, true);
66868         return ret_ref;
66869 }
66870
66871 uint64_t  __attribute__((export_name("TS_SignError_verification"))) TS_SignError_verification(uint32_t a) {
66872         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
66873         LDKSignError *ret_copy = MALLOC(sizeof(LDKSignError), "LDKSignError");
66874         *ret_copy = SignError_verification(a_conv);
66875         uint64_t ret_ref = tag_ptr(ret_copy, true);
66876         return ret_ref;
66877 }
66878
66879 void  __attribute__((export_name("TS_Bolt12ParseError_free"))) TS_Bolt12ParseError_free(uint64_t this_obj) {
66880         LDKBolt12ParseError this_obj_conv;
66881         this_obj_conv.inner = untag_ptr(this_obj);
66882         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66884         Bolt12ParseError_free(this_obj_conv);
66885 }
66886
66887 static inline uint64_t Bolt12ParseError_clone_ptr(LDKBolt12ParseError *NONNULL_PTR arg) {
66888         LDKBolt12ParseError ret_var = Bolt12ParseError_clone(arg);
66889         uint64_t ret_ref = 0;
66890         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66891         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66892         return ret_ref;
66893 }
66894 int64_t  __attribute__((export_name("TS_Bolt12ParseError_clone_ptr"))) TS_Bolt12ParseError_clone_ptr(uint64_t arg) {
66895         LDKBolt12ParseError arg_conv;
66896         arg_conv.inner = untag_ptr(arg);
66897         arg_conv.is_owned = ptr_is_owned(arg);
66898         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66899         arg_conv.is_owned = false;
66900         int64_t ret_conv = Bolt12ParseError_clone_ptr(&arg_conv);
66901         return ret_conv;
66902 }
66903
66904 uint64_t  __attribute__((export_name("TS_Bolt12ParseError_clone"))) TS_Bolt12ParseError_clone(uint64_t orig) {
66905         LDKBolt12ParseError orig_conv;
66906         orig_conv.inner = untag_ptr(orig);
66907         orig_conv.is_owned = ptr_is_owned(orig);
66908         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66909         orig_conv.is_owned = false;
66910         LDKBolt12ParseError ret_var = Bolt12ParseError_clone(&orig_conv);
66911         uint64_t ret_ref = 0;
66912         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66913         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66914         return ret_ref;
66915 }
66916
66917 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_clone"))) TS_Bolt12SemanticError_clone(uint64_t orig) {
66918         LDKBolt12SemanticError* orig_conv = (LDKBolt12SemanticError*)untag_ptr(orig);
66919         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_clone(orig_conv));
66920         return ret_conv;
66921 }
66922
66923 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_already_expired"))) TS_Bolt12SemanticError_already_expired() {
66924         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_already_expired());
66925         return ret_conv;
66926 }
66927
66928 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unsupported_chain"))) TS_Bolt12SemanticError_unsupported_chain() {
66929         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unsupported_chain());
66930         return ret_conv;
66931 }
66932
66933 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_chain"))) TS_Bolt12SemanticError_unexpected_chain() {
66934         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_chain());
66935         return ret_conv;
66936 }
66937
66938 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_amount"))) TS_Bolt12SemanticError_missing_amount() {
66939         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_amount());
66940         return ret_conv;
66941 }
66942
66943 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_amount"))) TS_Bolt12SemanticError_invalid_amount() {
66944         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_amount());
66945         return ret_conv;
66946 }
66947
66948 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_insufficient_amount"))) TS_Bolt12SemanticError_insufficient_amount() {
66949         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_insufficient_amount());
66950         return ret_conv;
66951 }
66952
66953 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_amount"))) TS_Bolt12SemanticError_unexpected_amount() {
66954         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_amount());
66955         return ret_conv;
66956 }
66957
66958 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unsupported_currency"))) TS_Bolt12SemanticError_unsupported_currency() {
66959         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unsupported_currency());
66960         return ret_conv;
66961 }
66962
66963 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unknown_required_features"))) TS_Bolt12SemanticError_unknown_required_features() {
66964         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unknown_required_features());
66965         return ret_conv;
66966 }
66967
66968 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_features"))) TS_Bolt12SemanticError_unexpected_features() {
66969         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_features());
66970         return ret_conv;
66971 }
66972
66973 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_description"))) TS_Bolt12SemanticError_missing_description() {
66974         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_description());
66975         return ret_conv;
66976 }
66977
66978 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_signing_pubkey"))) TS_Bolt12SemanticError_missing_signing_pubkey() {
66979         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_signing_pubkey());
66980         return ret_conv;
66981 }
66982
66983 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_signing_pubkey"))) TS_Bolt12SemanticError_invalid_signing_pubkey() {
66984         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_signing_pubkey());
66985         return ret_conv;
66986 }
66987
66988 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_signing_pubkey"))) TS_Bolt12SemanticError_unexpected_signing_pubkey() {
66989         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_signing_pubkey());
66990         return ret_conv;
66991 }
66992
66993 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_quantity"))) TS_Bolt12SemanticError_missing_quantity() {
66994         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_quantity());
66995         return ret_conv;
66996 }
66997
66998 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_quantity"))) TS_Bolt12SemanticError_invalid_quantity() {
66999         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_quantity());
67000         return ret_conv;
67001 }
67002
67003 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_quantity"))) TS_Bolt12SemanticError_unexpected_quantity() {
67004         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_quantity());
67005         return ret_conv;
67006 }
67007
67008 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_metadata"))) TS_Bolt12SemanticError_invalid_metadata() {
67009         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_metadata());
67010         return ret_conv;
67011 }
67012
67013 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_metadata"))) TS_Bolt12SemanticError_unexpected_metadata() {
67014         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_metadata());
67015         return ret_conv;
67016 }
67017
67018 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_payer_metadata"))) TS_Bolt12SemanticError_missing_payer_metadata() {
67019         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_payer_metadata());
67020         return ret_conv;
67021 }
67022
67023 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_payer_id"))) TS_Bolt12SemanticError_missing_payer_id() {
67024         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_payer_id());
67025         return ret_conv;
67026 }
67027
67028 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_duplicate_payment_id"))) TS_Bolt12SemanticError_duplicate_payment_id() {
67029         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_duplicate_payment_id());
67030         return ret_conv;
67031 }
67032
67033 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_paths"))) TS_Bolt12SemanticError_missing_paths() {
67034         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_paths());
67035         return ret_conv;
67036 }
67037
67038 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_paths"))) TS_Bolt12SemanticError_unexpected_paths() {
67039         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_paths());
67040         return ret_conv;
67041 }
67042
67043 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_pay_info"))) TS_Bolt12SemanticError_invalid_pay_info() {
67044         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_pay_info());
67045         return ret_conv;
67046 }
67047
67048 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_creation_time"))) TS_Bolt12SemanticError_missing_creation_time() {
67049         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_creation_time());
67050         return ret_conv;
67051 }
67052
67053 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_payment_hash"))) TS_Bolt12SemanticError_missing_payment_hash() {
67054         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_payment_hash());
67055         return ret_conv;
67056 }
67057
67058 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_signature"))) TS_Bolt12SemanticError_missing_signature() {
67059         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_signature());
67060         return ret_conv;
67061 }
67062
67063 void  __attribute__((export_name("TS_RefundMaybeWithDerivedMetadataBuilder_free"))) TS_RefundMaybeWithDerivedMetadataBuilder_free(uint64_t this_obj) {
67064         LDKRefundMaybeWithDerivedMetadataBuilder this_obj_conv;
67065         this_obj_conv.inner = untag_ptr(this_obj);
67066         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67068         RefundMaybeWithDerivedMetadataBuilder_free(this_obj_conv);
67069 }
67070
67071 static inline uint64_t RefundMaybeWithDerivedMetadataBuilder_clone_ptr(LDKRefundMaybeWithDerivedMetadataBuilder *NONNULL_PTR arg) {
67072         LDKRefundMaybeWithDerivedMetadataBuilder ret_var = RefundMaybeWithDerivedMetadataBuilder_clone(arg);
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 int64_t  __attribute__((export_name("TS_RefundMaybeWithDerivedMetadataBuilder_clone_ptr"))) TS_RefundMaybeWithDerivedMetadataBuilder_clone_ptr(uint64_t arg) {
67079         LDKRefundMaybeWithDerivedMetadataBuilder arg_conv;
67080         arg_conv.inner = untag_ptr(arg);
67081         arg_conv.is_owned = ptr_is_owned(arg);
67082         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67083         arg_conv.is_owned = false;
67084         int64_t ret_conv = RefundMaybeWithDerivedMetadataBuilder_clone_ptr(&arg_conv);
67085         return ret_conv;
67086 }
67087
67088 uint64_t  __attribute__((export_name("TS_RefundMaybeWithDerivedMetadataBuilder_clone"))) TS_RefundMaybeWithDerivedMetadataBuilder_clone(uint64_t orig) {
67089         LDKRefundMaybeWithDerivedMetadataBuilder orig_conv;
67090         orig_conv.inner = untag_ptr(orig);
67091         orig_conv.is_owned = ptr_is_owned(orig);
67092         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67093         orig_conv.is_owned = false;
67094         LDKRefundMaybeWithDerivedMetadataBuilder ret_var = RefundMaybeWithDerivedMetadataBuilder_clone(&orig_conv);
67095         uint64_t ret_ref = 0;
67096         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67097         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67098         return ret_ref;
67099 }
67100
67101 uint64_t  __attribute__((export_name("TS_RefundMaybeWithDerivedMetadataBuilder_new"))) TS_RefundMaybeWithDerivedMetadataBuilder_new(int8_tArray metadata, int8_tArray payer_id, int64_t amount_msats) {
67102         LDKCVec_u8Z metadata_ref;
67103         metadata_ref.datalen = metadata->arr_len;
67104         metadata_ref.data = MALLOC(metadata_ref.datalen, "LDKCVec_u8Z Bytes");
67105         memcpy(metadata_ref.data, metadata->elems, metadata_ref.datalen); FREE(metadata);
67106         LDKPublicKey payer_id_ref;
67107         CHECK(payer_id->arr_len == 33);
67108         memcpy(payer_id_ref.compressed_form, payer_id->elems, 33); FREE(payer_id);
67109         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
67110         *ret_conv = RefundMaybeWithDerivedMetadataBuilder_new(metadata_ref, payer_id_ref, amount_msats);
67111         return tag_ptr(ret_conv, true);
67112 }
67113
67114 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) {
67115         LDKPublicKey node_id_ref;
67116         CHECK(node_id->arr_len == 33);
67117         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
67118         LDKExpandedKey expanded_key_conv;
67119         expanded_key_conv.inner = untag_ptr(expanded_key);
67120         expanded_key_conv.is_owned = ptr_is_owned(expanded_key);
67121         CHECK_INNER_FIELD_ACCESS_OR_NULL(expanded_key_conv);
67122         expanded_key_conv.is_owned = false;
67123         void* entropy_source_ptr = untag_ptr(entropy_source);
67124         CHECK_ACCESS(entropy_source_ptr);
67125         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
67126         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
67127                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67128                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
67129         }
67130         LDKThirtyTwoBytes payment_id_ref;
67131         CHECK(payment_id->arr_len == 32);
67132         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
67133         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
67134         *ret_conv = RefundMaybeWithDerivedMetadataBuilder_deriving_payer_id(node_id_ref, &expanded_key_conv, entropy_source_conv, amount_msats, payment_id_ref);
67135         return tag_ptr(ret_conv, true);
67136 }
67137
67138 void  __attribute__((export_name("TS_RefundMaybeWithDerivedMetadataBuilder_description"))) TS_RefundMaybeWithDerivedMetadataBuilder_description(uint64_t this_arg, jstring description) {
67139         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
67140         this_arg_conv.inner = untag_ptr(this_arg);
67141         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67143         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
67144         LDKStr description_conv = str_ref_to_owned_c(description);
67145         RefundMaybeWithDerivedMetadataBuilder_description(this_arg_conv, description_conv);
67146 }
67147
67148 void  __attribute__((export_name("TS_RefundMaybeWithDerivedMetadataBuilder_absolute_expiry"))) TS_RefundMaybeWithDerivedMetadataBuilder_absolute_expiry(uint64_t this_arg, int64_t absolute_expiry) {
67149         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
67150         this_arg_conv.inner = untag_ptr(this_arg);
67151         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67153         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
67154         RefundMaybeWithDerivedMetadataBuilder_absolute_expiry(this_arg_conv, absolute_expiry);
67155 }
67156
67157 void  __attribute__((export_name("TS_RefundMaybeWithDerivedMetadataBuilder_issuer"))) TS_RefundMaybeWithDerivedMetadataBuilder_issuer(uint64_t this_arg, jstring issuer) {
67158         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
67159         this_arg_conv.inner = untag_ptr(this_arg);
67160         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67162         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
67163         LDKStr issuer_conv = str_ref_to_owned_c(issuer);
67164         RefundMaybeWithDerivedMetadataBuilder_issuer(this_arg_conv, issuer_conv);
67165 }
67166
67167 void  __attribute__((export_name("TS_RefundMaybeWithDerivedMetadataBuilder_path"))) TS_RefundMaybeWithDerivedMetadataBuilder_path(uint64_t this_arg, uint64_t path) {
67168         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
67169         this_arg_conv.inner = untag_ptr(this_arg);
67170         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67172         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
67173         LDKBlindedPath path_conv;
67174         path_conv.inner = untag_ptr(path);
67175         path_conv.is_owned = ptr_is_owned(path);
67176         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
67177         path_conv = BlindedPath_clone(&path_conv);
67178         RefundMaybeWithDerivedMetadataBuilder_path(this_arg_conv, path_conv);
67179 }
67180
67181 void  __attribute__((export_name("TS_RefundMaybeWithDerivedMetadataBuilder_chain"))) TS_RefundMaybeWithDerivedMetadataBuilder_chain(uint64_t this_arg, uint32_t network) {
67182         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
67183         this_arg_conv.inner = untag_ptr(this_arg);
67184         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67186         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
67187         LDKNetwork network_conv = LDKNetwork_from_js(network);
67188         RefundMaybeWithDerivedMetadataBuilder_chain(this_arg_conv, network_conv);
67189 }
67190
67191 void  __attribute__((export_name("TS_RefundMaybeWithDerivedMetadataBuilder_quantity"))) TS_RefundMaybeWithDerivedMetadataBuilder_quantity(uint64_t this_arg, int64_t quantity) {
67192         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
67193         this_arg_conv.inner = untag_ptr(this_arg);
67194         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67196         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
67197         RefundMaybeWithDerivedMetadataBuilder_quantity(this_arg_conv, quantity);
67198 }
67199
67200 void  __attribute__((export_name("TS_RefundMaybeWithDerivedMetadataBuilder_payer_note"))) TS_RefundMaybeWithDerivedMetadataBuilder_payer_note(uint64_t this_arg, jstring payer_note) {
67201         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
67202         this_arg_conv.inner = untag_ptr(this_arg);
67203         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67205         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
67206         LDKStr payer_note_conv = str_ref_to_owned_c(payer_note);
67207         RefundMaybeWithDerivedMetadataBuilder_payer_note(this_arg_conv, payer_note_conv);
67208 }
67209
67210 uint64_t  __attribute__((export_name("TS_RefundMaybeWithDerivedMetadataBuilder_build"))) TS_RefundMaybeWithDerivedMetadataBuilder_build(uint64_t this_arg) {
67211         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
67212         this_arg_conv.inner = untag_ptr(this_arg);
67213         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67215         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
67216         LDKCResult_RefundBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12SemanticErrorZ), "LDKCResult_RefundBolt12SemanticErrorZ");
67217         *ret_conv = RefundMaybeWithDerivedMetadataBuilder_build(this_arg_conv);
67218         return tag_ptr(ret_conv, true);
67219 }
67220
67221 void  __attribute__((export_name("TS_Refund_free"))) TS_Refund_free(uint64_t this_obj) {
67222         LDKRefund this_obj_conv;
67223         this_obj_conv.inner = untag_ptr(this_obj);
67224         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67226         Refund_free(this_obj_conv);
67227 }
67228
67229 static inline uint64_t Refund_clone_ptr(LDKRefund *NONNULL_PTR arg) {
67230         LDKRefund ret_var = Refund_clone(arg);
67231         uint64_t ret_ref = 0;
67232         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67233         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67234         return ret_ref;
67235 }
67236 int64_t  __attribute__((export_name("TS_Refund_clone_ptr"))) TS_Refund_clone_ptr(uint64_t arg) {
67237         LDKRefund arg_conv;
67238         arg_conv.inner = untag_ptr(arg);
67239         arg_conv.is_owned = ptr_is_owned(arg);
67240         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67241         arg_conv.is_owned = false;
67242         int64_t ret_conv = Refund_clone_ptr(&arg_conv);
67243         return ret_conv;
67244 }
67245
67246 uint64_t  __attribute__((export_name("TS_Refund_clone"))) TS_Refund_clone(uint64_t orig) {
67247         LDKRefund orig_conv;
67248         orig_conv.inner = untag_ptr(orig);
67249         orig_conv.is_owned = ptr_is_owned(orig);
67250         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67251         orig_conv.is_owned = false;
67252         LDKRefund ret_var = Refund_clone(&orig_conv);
67253         uint64_t ret_ref = 0;
67254         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67255         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67256         return ret_ref;
67257 }
67258
67259 uint64_t  __attribute__((export_name("TS_Refund_description"))) TS_Refund_description(uint64_t this_arg) {
67260         LDKRefund this_arg_conv;
67261         this_arg_conv.inner = untag_ptr(this_arg);
67262         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67264         this_arg_conv.is_owned = false;
67265         LDKPrintableString ret_var = Refund_description(&this_arg_conv);
67266         uint64_t ret_ref = 0;
67267         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67268         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67269         return ret_ref;
67270 }
67271
67272 uint64_t  __attribute__((export_name("TS_Refund_absolute_expiry"))) TS_Refund_absolute_expiry(uint64_t this_arg) {
67273         LDKRefund this_arg_conv;
67274         this_arg_conv.inner = untag_ptr(this_arg);
67275         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67277         this_arg_conv.is_owned = false;
67278         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
67279         *ret_copy = Refund_absolute_expiry(&this_arg_conv);
67280         uint64_t ret_ref = tag_ptr(ret_copy, true);
67281         return ret_ref;
67282 }
67283
67284 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) {
67285         LDKRefund this_arg_conv;
67286         this_arg_conv.inner = untag_ptr(this_arg);
67287         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67289         this_arg_conv.is_owned = false;
67290         jboolean ret_conv = Refund_is_expired_no_std(&this_arg_conv, duration_since_epoch);
67291         return ret_conv;
67292 }
67293
67294 uint64_t  __attribute__((export_name("TS_Refund_issuer"))) TS_Refund_issuer(uint64_t this_arg) {
67295         LDKRefund this_arg_conv;
67296         this_arg_conv.inner = untag_ptr(this_arg);
67297         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67299         this_arg_conv.is_owned = false;
67300         LDKPrintableString ret_var = Refund_issuer(&this_arg_conv);
67301         uint64_t ret_ref = 0;
67302         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67303         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67304         return ret_ref;
67305 }
67306
67307 uint64_tArray  __attribute__((export_name("TS_Refund_paths"))) TS_Refund_paths(uint64_t this_arg) {
67308         LDKRefund this_arg_conv;
67309         this_arg_conv.inner = untag_ptr(this_arg);
67310         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67312         this_arg_conv.is_owned = false;
67313         LDKCVec_BlindedPathZ ret_var = Refund_paths(&this_arg_conv);
67314         uint64_tArray ret_arr = NULL;
67315         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
67316         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
67317         for (size_t n = 0; n < ret_var.datalen; n++) {
67318                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
67319                 uint64_t ret_conv_13_ref = 0;
67320                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
67321                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
67322                 ret_arr_ptr[n] = ret_conv_13_ref;
67323         }
67324         
67325         FREE(ret_var.data);
67326         return ret_arr;
67327 }
67328
67329 int8_tArray  __attribute__((export_name("TS_Refund_payer_metadata"))) TS_Refund_payer_metadata(uint64_t this_arg) {
67330         LDKRefund this_arg_conv;
67331         this_arg_conv.inner = untag_ptr(this_arg);
67332         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67334         this_arg_conv.is_owned = false;
67335         LDKu8slice ret_var = Refund_payer_metadata(&this_arg_conv);
67336         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
67337         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
67338         return ret_arr;
67339 }
67340
67341 int8_tArray  __attribute__((export_name("TS_Refund_chain"))) TS_Refund_chain(uint64_t this_arg) {
67342         LDKRefund this_arg_conv;
67343         this_arg_conv.inner = untag_ptr(this_arg);
67344         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67346         this_arg_conv.is_owned = false;
67347         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
67348         memcpy(ret_arr->elems, Refund_chain(&this_arg_conv).data, 32);
67349         return ret_arr;
67350 }
67351
67352 int64_t  __attribute__((export_name("TS_Refund_amount_msats"))) TS_Refund_amount_msats(uint64_t this_arg) {
67353         LDKRefund this_arg_conv;
67354         this_arg_conv.inner = untag_ptr(this_arg);
67355         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67357         this_arg_conv.is_owned = false;
67358         int64_t ret_conv = Refund_amount_msats(&this_arg_conv);
67359         return ret_conv;
67360 }
67361
67362 uint64_t  __attribute__((export_name("TS_Refund_features"))) TS_Refund_features(uint64_t this_arg) {
67363         LDKRefund this_arg_conv;
67364         this_arg_conv.inner = untag_ptr(this_arg);
67365         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67367         this_arg_conv.is_owned = false;
67368         LDKInvoiceRequestFeatures ret_var = Refund_features(&this_arg_conv);
67369         uint64_t ret_ref = 0;
67370         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67371         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67372         return ret_ref;
67373 }
67374
67375 uint64_t  __attribute__((export_name("TS_Refund_quantity"))) TS_Refund_quantity(uint64_t this_arg) {
67376         LDKRefund this_arg_conv;
67377         this_arg_conv.inner = untag_ptr(this_arg);
67378         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67380         this_arg_conv.is_owned = false;
67381         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
67382         *ret_copy = Refund_quantity(&this_arg_conv);
67383         uint64_t ret_ref = tag_ptr(ret_copy, true);
67384         return ret_ref;
67385 }
67386
67387 int8_tArray  __attribute__((export_name("TS_Refund_payer_id"))) TS_Refund_payer_id(uint64_t this_arg) {
67388         LDKRefund this_arg_conv;
67389         this_arg_conv.inner = untag_ptr(this_arg);
67390         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67392         this_arg_conv.is_owned = false;
67393         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
67394         memcpy(ret_arr->elems, Refund_payer_id(&this_arg_conv).compressed_form, 33);
67395         return ret_arr;
67396 }
67397
67398 uint64_t  __attribute__((export_name("TS_Refund_payer_note"))) TS_Refund_payer_note(uint64_t this_arg) {
67399         LDKRefund this_arg_conv;
67400         this_arg_conv.inner = untag_ptr(this_arg);
67401         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67403         this_arg_conv.is_owned = false;
67404         LDKPrintableString ret_var = Refund_payer_note(&this_arg_conv);
67405         uint64_t ret_ref = 0;
67406         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67407         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67408         return ret_ref;
67409 }
67410
67411 int64_t  __attribute__((export_name("TS_Refund_hash"))) TS_Refund_hash(uint64_t o) {
67412         LDKRefund o_conv;
67413         o_conv.inner = untag_ptr(o);
67414         o_conv.is_owned = ptr_is_owned(o);
67415         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
67416         o_conv.is_owned = false;
67417         int64_t ret_conv = Refund_hash(&o_conv);
67418         return ret_conv;
67419 }
67420
67421 int8_tArray  __attribute__((export_name("TS_Refund_write"))) TS_Refund_write(uint64_t obj) {
67422         LDKRefund obj_conv;
67423         obj_conv.inner = untag_ptr(obj);
67424         obj_conv.is_owned = ptr_is_owned(obj);
67425         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
67426         obj_conv.is_owned = false;
67427         LDKCVec_u8Z ret_var = Refund_write(&obj_conv);
67428         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
67429         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
67430         CVec_u8Z_free(ret_var);
67431         return ret_arr;
67432 }
67433
67434 uint64_t  __attribute__((export_name("TS_Refund_from_str"))) TS_Refund_from_str(jstring s) {
67435         LDKStr s_conv = str_ref_to_owned_c(s);
67436         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
67437         *ret_conv = Refund_from_str(s_conv);
67438         return tag_ptr(ret_conv, true);
67439 }
67440
67441 uint32_t  __attribute__((export_name("TS_UtxoLookupError_clone"))) TS_UtxoLookupError_clone(uint64_t orig) {
67442         LDKUtxoLookupError* orig_conv = (LDKUtxoLookupError*)untag_ptr(orig);
67443         uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_clone(orig_conv));
67444         return ret_conv;
67445 }
67446
67447 uint32_t  __attribute__((export_name("TS_UtxoLookupError_unknown_chain"))) TS_UtxoLookupError_unknown_chain() {
67448         uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_unknown_chain());
67449         return ret_conv;
67450 }
67451
67452 uint32_t  __attribute__((export_name("TS_UtxoLookupError_unknown_tx"))) TS_UtxoLookupError_unknown_tx() {
67453         uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_unknown_tx());
67454         return ret_conv;
67455 }
67456
67457 void  __attribute__((export_name("TS_UtxoResult_free"))) TS_UtxoResult_free(uint64_t this_ptr) {
67458         if (!ptr_is_owned(this_ptr)) return;
67459         void* this_ptr_ptr = untag_ptr(this_ptr);
67460         CHECK_ACCESS(this_ptr_ptr);
67461         LDKUtxoResult this_ptr_conv = *(LDKUtxoResult*)(this_ptr_ptr);
67462         FREE(untag_ptr(this_ptr));
67463         UtxoResult_free(this_ptr_conv);
67464 }
67465
67466 static inline uint64_t UtxoResult_clone_ptr(LDKUtxoResult *NONNULL_PTR arg) {
67467         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
67468         *ret_copy = UtxoResult_clone(arg);
67469         uint64_t ret_ref = tag_ptr(ret_copy, true);
67470         return ret_ref;
67471 }
67472 int64_t  __attribute__((export_name("TS_UtxoResult_clone_ptr"))) TS_UtxoResult_clone_ptr(uint64_t arg) {
67473         LDKUtxoResult* arg_conv = (LDKUtxoResult*)untag_ptr(arg);
67474         int64_t ret_conv = UtxoResult_clone_ptr(arg_conv);
67475         return ret_conv;
67476 }
67477
67478 uint64_t  __attribute__((export_name("TS_UtxoResult_clone"))) TS_UtxoResult_clone(uint64_t orig) {
67479         LDKUtxoResult* orig_conv = (LDKUtxoResult*)untag_ptr(orig);
67480         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
67481         *ret_copy = UtxoResult_clone(orig_conv);
67482         uint64_t ret_ref = tag_ptr(ret_copy, true);
67483         return ret_ref;
67484 }
67485
67486 uint64_t  __attribute__((export_name("TS_UtxoResult_sync"))) TS_UtxoResult_sync(uint64_t a) {
67487         void* a_ptr = untag_ptr(a);
67488         CHECK_ACCESS(a_ptr);
67489         LDKCResult_TxOutUtxoLookupErrorZ a_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(a_ptr);
67490         a_conv = CResult_TxOutUtxoLookupErrorZ_clone((LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(a));
67491         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
67492         *ret_copy = UtxoResult_sync(a_conv);
67493         uint64_t ret_ref = tag_ptr(ret_copy, true);
67494         return ret_ref;
67495 }
67496
67497 uint64_t  __attribute__((export_name("TS_UtxoResult_async"))) TS_UtxoResult_async(uint64_t a) {
67498         LDKUtxoFuture a_conv;
67499         a_conv.inner = untag_ptr(a);
67500         a_conv.is_owned = ptr_is_owned(a);
67501         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67502         a_conv = UtxoFuture_clone(&a_conv);
67503         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
67504         *ret_copy = UtxoResult_async(a_conv);
67505         uint64_t ret_ref = tag_ptr(ret_copy, true);
67506         return ret_ref;
67507 }
67508
67509 void  __attribute__((export_name("TS_UtxoLookup_free"))) TS_UtxoLookup_free(uint64_t this_ptr) {
67510         if (!ptr_is_owned(this_ptr)) return;
67511         void* this_ptr_ptr = untag_ptr(this_ptr);
67512         CHECK_ACCESS(this_ptr_ptr);
67513         LDKUtxoLookup this_ptr_conv = *(LDKUtxoLookup*)(this_ptr_ptr);
67514         FREE(untag_ptr(this_ptr));
67515         UtxoLookup_free(this_ptr_conv);
67516 }
67517
67518 void  __attribute__((export_name("TS_UtxoFuture_free"))) TS_UtxoFuture_free(uint64_t this_obj) {
67519         LDKUtxoFuture this_obj_conv;
67520         this_obj_conv.inner = untag_ptr(this_obj);
67521         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67523         UtxoFuture_free(this_obj_conv);
67524 }
67525
67526 static inline uint64_t UtxoFuture_clone_ptr(LDKUtxoFuture *NONNULL_PTR arg) {
67527         LDKUtxoFuture ret_var = UtxoFuture_clone(arg);
67528         uint64_t ret_ref = 0;
67529         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67530         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67531         return ret_ref;
67532 }
67533 int64_t  __attribute__((export_name("TS_UtxoFuture_clone_ptr"))) TS_UtxoFuture_clone_ptr(uint64_t arg) {
67534         LDKUtxoFuture arg_conv;
67535         arg_conv.inner = untag_ptr(arg);
67536         arg_conv.is_owned = ptr_is_owned(arg);
67537         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67538         arg_conv.is_owned = false;
67539         int64_t ret_conv = UtxoFuture_clone_ptr(&arg_conv);
67540         return ret_conv;
67541 }
67542
67543 uint64_t  __attribute__((export_name("TS_UtxoFuture_clone"))) TS_UtxoFuture_clone(uint64_t orig) {
67544         LDKUtxoFuture orig_conv;
67545         orig_conv.inner = untag_ptr(orig);
67546         orig_conv.is_owned = ptr_is_owned(orig);
67547         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67548         orig_conv.is_owned = false;
67549         LDKUtxoFuture ret_var = UtxoFuture_clone(&orig_conv);
67550         uint64_t ret_ref = 0;
67551         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67552         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67553         return ret_ref;
67554 }
67555
67556 uint64_t  __attribute__((export_name("TS_UtxoFuture_new"))) TS_UtxoFuture_new() {
67557         LDKUtxoFuture ret_var = UtxoFuture_new();
67558         uint64_t ret_ref = 0;
67559         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67560         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67561         return ret_ref;
67562 }
67563
67564 void  __attribute__((export_name("TS_UtxoFuture_resolve_without_forwarding"))) TS_UtxoFuture_resolve_without_forwarding(uint64_t this_arg, uint64_t graph, uint64_t result) {
67565         LDKUtxoFuture this_arg_conv;
67566         this_arg_conv.inner = untag_ptr(this_arg);
67567         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67569         this_arg_conv.is_owned = false;
67570         LDKNetworkGraph graph_conv;
67571         graph_conv.inner = untag_ptr(graph);
67572         graph_conv.is_owned = ptr_is_owned(graph);
67573         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
67574         graph_conv.is_owned = false;
67575         void* result_ptr = untag_ptr(result);
67576         CHECK_ACCESS(result_ptr);
67577         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
67578         UtxoFuture_resolve_without_forwarding(&this_arg_conv, &graph_conv, result_conv);
67579 }
67580
67581 void  __attribute__((export_name("TS_UtxoFuture_resolve"))) TS_UtxoFuture_resolve(uint64_t this_arg, uint64_t graph, uint64_t gossip, uint64_t result) {
67582         LDKUtxoFuture 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         LDKNetworkGraph graph_conv;
67588         graph_conv.inner = untag_ptr(graph);
67589         graph_conv.is_owned = ptr_is_owned(graph);
67590         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
67591         graph_conv.is_owned = false;
67592         LDKP2PGossipSync gossip_conv;
67593         gossip_conv.inner = untag_ptr(gossip);
67594         gossip_conv.is_owned = ptr_is_owned(gossip);
67595         CHECK_INNER_FIELD_ACCESS_OR_NULL(gossip_conv);
67596         gossip_conv.is_owned = false;
67597         void* result_ptr = untag_ptr(result);
67598         CHECK_ACCESS(result_ptr);
67599         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
67600         UtxoFuture_resolve(&this_arg_conv, &graph_conv, &gossip_conv, result_conv);
67601 }
67602
67603 void  __attribute__((export_name("TS_NodeId_free"))) TS_NodeId_free(uint64_t this_obj) {
67604         LDKNodeId this_obj_conv;
67605         this_obj_conv.inner = untag_ptr(this_obj);
67606         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67608         NodeId_free(this_obj_conv);
67609 }
67610
67611 static inline uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
67612         LDKNodeId ret_var = NodeId_clone(arg);
67613         uint64_t ret_ref = 0;
67614         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67615         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67616         return ret_ref;
67617 }
67618 int64_t  __attribute__((export_name("TS_NodeId_clone_ptr"))) TS_NodeId_clone_ptr(uint64_t arg) {
67619         LDKNodeId arg_conv;
67620         arg_conv.inner = untag_ptr(arg);
67621         arg_conv.is_owned = ptr_is_owned(arg);
67622         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67623         arg_conv.is_owned = false;
67624         int64_t ret_conv = NodeId_clone_ptr(&arg_conv);
67625         return ret_conv;
67626 }
67627
67628 uint64_t  __attribute__((export_name("TS_NodeId_clone"))) TS_NodeId_clone(uint64_t orig) {
67629         LDKNodeId orig_conv;
67630         orig_conv.inner = untag_ptr(orig);
67631         orig_conv.is_owned = ptr_is_owned(orig);
67632         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67633         orig_conv.is_owned = false;
67634         LDKNodeId ret_var = NodeId_clone(&orig_conv);
67635         uint64_t ret_ref = 0;
67636         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67637         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67638         return ret_ref;
67639 }
67640
67641 uint64_t  __attribute__((export_name("TS_NodeId_from_pubkey"))) TS_NodeId_from_pubkey(int8_tArray pubkey) {
67642         LDKPublicKey pubkey_ref;
67643         CHECK(pubkey->arr_len == 33);
67644         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
67645         LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
67646         uint64_t ret_ref = 0;
67647         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67648         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67649         return ret_ref;
67650 }
67651
67652 uint64_t  __attribute__((export_name("TS_NodeId_from_slice"))) TS_NodeId_from_slice(int8_tArray bytes) {
67653         LDKu8slice bytes_ref;
67654         bytes_ref.datalen = bytes->arr_len;
67655         bytes_ref.data = bytes->elems;
67656         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
67657         *ret_conv = NodeId_from_slice(bytes_ref);
67658         FREE(bytes);
67659         return tag_ptr(ret_conv, true);
67660 }
67661
67662 int8_tArray  __attribute__((export_name("TS_NodeId_as_slice"))) TS_NodeId_as_slice(uint64_t this_arg) {
67663         LDKNodeId this_arg_conv;
67664         this_arg_conv.inner = untag_ptr(this_arg);
67665         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67667         this_arg_conv.is_owned = false;
67668         LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
67669         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
67670         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
67671         return ret_arr;
67672 }
67673
67674 int8_tArray  __attribute__((export_name("TS_NodeId_as_array"))) TS_NodeId_as_array(uint64_t this_arg) {
67675         LDKNodeId 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         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
67681         memcpy(ret_arr->elems, *NodeId_as_array(&this_arg_conv), 33);
67682         return ret_arr;
67683 }
67684
67685 uint64_t  __attribute__((export_name("TS_NodeId_as_pubkey"))) TS_NodeId_as_pubkey(uint64_t this_arg) {
67686         LDKNodeId this_arg_conv;
67687         this_arg_conv.inner = untag_ptr(this_arg);
67688         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67690         this_arg_conv.is_owned = false;
67691         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
67692         *ret_conv = NodeId_as_pubkey(&this_arg_conv);
67693         return tag_ptr(ret_conv, true);
67694 }
67695
67696 int64_t  __attribute__((export_name("TS_NodeId_hash"))) TS_NodeId_hash(uint64_t o) {
67697         LDKNodeId o_conv;
67698         o_conv.inner = untag_ptr(o);
67699         o_conv.is_owned = ptr_is_owned(o);
67700         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
67701         o_conv.is_owned = false;
67702         int64_t ret_conv = NodeId_hash(&o_conv);
67703         return ret_conv;
67704 }
67705
67706 int8_tArray  __attribute__((export_name("TS_NodeId_write"))) TS_NodeId_write(uint64_t obj) {
67707         LDKNodeId obj_conv;
67708         obj_conv.inner = untag_ptr(obj);
67709         obj_conv.is_owned = ptr_is_owned(obj);
67710         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
67711         obj_conv.is_owned = false;
67712         LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
67713         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
67714         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
67715         CVec_u8Z_free(ret_var);
67716         return ret_arr;
67717 }
67718
67719 uint64_t  __attribute__((export_name("TS_NodeId_read"))) TS_NodeId_read(int8_tArray ser) {
67720         LDKu8slice ser_ref;
67721         ser_ref.datalen = ser->arr_len;
67722         ser_ref.data = ser->elems;
67723         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
67724         *ret_conv = NodeId_read(ser_ref);
67725         FREE(ser);
67726         return tag_ptr(ret_conv, true);
67727 }
67728
67729 void  __attribute__((export_name("TS_NetworkGraph_free"))) TS_NetworkGraph_free(uint64_t this_obj) {
67730         LDKNetworkGraph this_obj_conv;
67731         this_obj_conv.inner = untag_ptr(this_obj);
67732         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67734         NetworkGraph_free(this_obj_conv);
67735 }
67736
67737 void  __attribute__((export_name("TS_ReadOnlyNetworkGraph_free"))) TS_ReadOnlyNetworkGraph_free(uint64_t this_obj) {
67738         LDKReadOnlyNetworkGraph this_obj_conv;
67739         this_obj_conv.inner = untag_ptr(this_obj);
67740         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67742         ReadOnlyNetworkGraph_free(this_obj_conv);
67743 }
67744
67745 void  __attribute__((export_name("TS_NetworkUpdate_free"))) TS_NetworkUpdate_free(uint64_t this_ptr) {
67746         if (!ptr_is_owned(this_ptr)) return;
67747         void* this_ptr_ptr = untag_ptr(this_ptr);
67748         CHECK_ACCESS(this_ptr_ptr);
67749         LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
67750         FREE(untag_ptr(this_ptr));
67751         NetworkUpdate_free(this_ptr_conv);
67752 }
67753
67754 static inline uint64_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
67755         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
67756         *ret_copy = NetworkUpdate_clone(arg);
67757         uint64_t ret_ref = tag_ptr(ret_copy, true);
67758         return ret_ref;
67759 }
67760 int64_t  __attribute__((export_name("TS_NetworkUpdate_clone_ptr"))) TS_NetworkUpdate_clone_ptr(uint64_t arg) {
67761         LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)untag_ptr(arg);
67762         int64_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
67763         return ret_conv;
67764 }
67765
67766 uint64_t  __attribute__((export_name("TS_NetworkUpdate_clone"))) TS_NetworkUpdate_clone(uint64_t orig) {
67767         LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)untag_ptr(orig);
67768         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
67769         *ret_copy = NetworkUpdate_clone(orig_conv);
67770         uint64_t ret_ref = tag_ptr(ret_copy, true);
67771         return ret_ref;
67772 }
67773
67774 uint64_t  __attribute__((export_name("TS_NetworkUpdate_channel_update_message"))) TS_NetworkUpdate_channel_update_message(uint64_t msg) {
67775         LDKChannelUpdate msg_conv;
67776         msg_conv.inner = untag_ptr(msg);
67777         msg_conv.is_owned = ptr_is_owned(msg);
67778         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
67779         msg_conv = ChannelUpdate_clone(&msg_conv);
67780         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
67781         *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
67782         uint64_t ret_ref = tag_ptr(ret_copy, true);
67783         return ret_ref;
67784 }
67785
67786 uint64_t  __attribute__((export_name("TS_NetworkUpdate_channel_failure"))) TS_NetworkUpdate_channel_failure(int64_t short_channel_id, jboolean is_permanent) {
67787         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
67788         *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
67789         uint64_t ret_ref = tag_ptr(ret_copy, true);
67790         return ret_ref;
67791 }
67792
67793 uint64_t  __attribute__((export_name("TS_NetworkUpdate_node_failure"))) TS_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
67794         LDKPublicKey node_id_ref;
67795         CHECK(node_id->arr_len == 33);
67796         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
67797         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
67798         *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
67799         uint64_t ret_ref = tag_ptr(ret_copy, true);
67800         return ret_ref;
67801 }
67802
67803 jboolean  __attribute__((export_name("TS_NetworkUpdate_eq"))) TS_NetworkUpdate_eq(uint64_t a, uint64_t b) {
67804         LDKNetworkUpdate* a_conv = (LDKNetworkUpdate*)untag_ptr(a);
67805         LDKNetworkUpdate* b_conv = (LDKNetworkUpdate*)untag_ptr(b);
67806         jboolean ret_conv = NetworkUpdate_eq(a_conv, b_conv);
67807         return ret_conv;
67808 }
67809
67810 int8_tArray  __attribute__((export_name("TS_NetworkUpdate_write"))) TS_NetworkUpdate_write(uint64_t obj) {
67811         LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)untag_ptr(obj);
67812         LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
67813         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
67814         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
67815         CVec_u8Z_free(ret_var);
67816         return ret_arr;
67817 }
67818
67819 uint64_t  __attribute__((export_name("TS_NetworkUpdate_read"))) TS_NetworkUpdate_read(int8_tArray ser) {
67820         LDKu8slice ser_ref;
67821         ser_ref.datalen = ser->arr_len;
67822         ser_ref.data = ser->elems;
67823         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
67824         *ret_conv = NetworkUpdate_read(ser_ref);
67825         FREE(ser);
67826         return tag_ptr(ret_conv, true);
67827 }
67828
67829 void  __attribute__((export_name("TS_P2PGossipSync_free"))) TS_P2PGossipSync_free(uint64_t this_obj) {
67830         LDKP2PGossipSync this_obj_conv;
67831         this_obj_conv.inner = untag_ptr(this_obj);
67832         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67834         P2PGossipSync_free(this_obj_conv);
67835 }
67836
67837 uint64_t  __attribute__((export_name("TS_P2PGossipSync_new"))) TS_P2PGossipSync_new(uint64_t network_graph, uint64_t utxo_lookup, uint64_t logger) {
67838         LDKNetworkGraph network_graph_conv;
67839         network_graph_conv.inner = untag_ptr(network_graph);
67840         network_graph_conv.is_owned = ptr_is_owned(network_graph);
67841         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
67842         network_graph_conv.is_owned = false;
67843         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
67844         CHECK_ACCESS(utxo_lookup_ptr);
67845         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
67846         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
67847         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
67848                 // Manually implement clone for Java trait instances
67849                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
67850                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67851                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
67852                 }
67853         }
67854         void* logger_ptr = untag_ptr(logger);
67855         CHECK_ACCESS(logger_ptr);
67856         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
67857         if (logger_conv.free == LDKLogger_JCalls_free) {
67858                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67859                 LDKLogger_JCalls_cloned(&logger_conv);
67860         }
67861         LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, utxo_lookup_conv, logger_conv);
67862         uint64_t ret_ref = 0;
67863         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67864         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67865         return ret_ref;
67866 }
67867
67868 void  __attribute__((export_name("TS_P2PGossipSync_add_utxo_lookup"))) TS_P2PGossipSync_add_utxo_lookup(uint64_t this_arg, uint64_t utxo_lookup) {
67869         LDKP2PGossipSync this_arg_conv;
67870         this_arg_conv.inner = untag_ptr(this_arg);
67871         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67873         this_arg_conv.is_owned = false;
67874         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
67875         CHECK_ACCESS(utxo_lookup_ptr);
67876         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
67877         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
67878         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
67879                 // Manually implement clone for Java trait instances
67880                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
67881                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67882                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
67883                 }
67884         }
67885         P2PGossipSync_add_utxo_lookup(&this_arg_conv, utxo_lookup_conv);
67886 }
67887
67888 void  __attribute__((export_name("TS_NetworkGraph_handle_network_update"))) TS_NetworkGraph_handle_network_update(uint64_t this_arg, uint64_t network_update) {
67889         LDKNetworkGraph this_arg_conv;
67890         this_arg_conv.inner = untag_ptr(this_arg);
67891         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67893         this_arg_conv.is_owned = false;
67894         LDKNetworkUpdate* network_update_conv = (LDKNetworkUpdate*)untag_ptr(network_update);
67895         NetworkGraph_handle_network_update(&this_arg_conv, network_update_conv);
67896 }
67897
67898 int8_tArray  __attribute__((export_name("TS_NetworkGraph_get_chain_hash"))) TS_NetworkGraph_get_chain_hash(uint64_t this_arg) {
67899         LDKNetworkGraph 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         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
67905         memcpy(ret_arr->elems, NetworkGraph_get_chain_hash(&this_arg_conv).data, 32);
67906         return ret_arr;
67907 }
67908
67909 uint64_t  __attribute__((export_name("TS_verify_node_announcement"))) TS_verify_node_announcement(uint64_t msg) {
67910         LDKNodeAnnouncement msg_conv;
67911         msg_conv.inner = untag_ptr(msg);
67912         msg_conv.is_owned = ptr_is_owned(msg);
67913         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
67914         msg_conv.is_owned = false;
67915         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
67916         *ret_conv = verify_node_announcement(&msg_conv);
67917         return tag_ptr(ret_conv, true);
67918 }
67919
67920 uint64_t  __attribute__((export_name("TS_verify_channel_announcement"))) TS_verify_channel_announcement(uint64_t msg) {
67921         LDKChannelAnnouncement msg_conv;
67922         msg_conv.inner = untag_ptr(msg);
67923         msg_conv.is_owned = ptr_is_owned(msg);
67924         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
67925         msg_conv.is_owned = false;
67926         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
67927         *ret_conv = verify_channel_announcement(&msg_conv);
67928         return tag_ptr(ret_conv, true);
67929 }
67930
67931 uint64_t  __attribute__((export_name("TS_P2PGossipSync_as_RoutingMessageHandler"))) TS_P2PGossipSync_as_RoutingMessageHandler(uint64_t this_arg) {
67932         LDKP2PGossipSync this_arg_conv;
67933         this_arg_conv.inner = untag_ptr(this_arg);
67934         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67936         this_arg_conv.is_owned = false;
67937         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
67938         *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
67939         return tag_ptr(ret_ret, true);
67940 }
67941
67942 uint64_t  __attribute__((export_name("TS_P2PGossipSync_as_MessageSendEventsProvider"))) TS_P2PGossipSync_as_MessageSendEventsProvider(uint64_t this_arg) {
67943         LDKP2PGossipSync this_arg_conv;
67944         this_arg_conv.inner = untag_ptr(this_arg);
67945         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67947         this_arg_conv.is_owned = false;
67948         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
67949         *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
67950         return tag_ptr(ret_ret, true);
67951 }
67952
67953 void  __attribute__((export_name("TS_ChannelUpdateInfo_free"))) TS_ChannelUpdateInfo_free(uint64_t this_obj) {
67954         LDKChannelUpdateInfo this_obj_conv;
67955         this_obj_conv.inner = untag_ptr(this_obj);
67956         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67958         ChannelUpdateInfo_free(this_obj_conv);
67959 }
67960
67961 int32_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update"))) TS_ChannelUpdateInfo_get_last_update(uint64_t this_ptr) {
67962         LDKChannelUpdateInfo this_ptr_conv;
67963         this_ptr_conv.inner = untag_ptr(this_ptr);
67964         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67966         this_ptr_conv.is_owned = false;
67967         int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
67968         return ret_conv;
67969 }
67970
67971 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update"))) TS_ChannelUpdateInfo_set_last_update(uint64_t this_ptr, int32_t val) {
67972         LDKChannelUpdateInfo this_ptr_conv;
67973         this_ptr_conv.inner = untag_ptr(this_ptr);
67974         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67976         this_ptr_conv.is_owned = false;
67977         ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
67978 }
67979
67980 jboolean  __attribute__((export_name("TS_ChannelUpdateInfo_get_enabled"))) TS_ChannelUpdateInfo_get_enabled(uint64_t this_ptr) {
67981         LDKChannelUpdateInfo this_ptr_conv;
67982         this_ptr_conv.inner = untag_ptr(this_ptr);
67983         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67985         this_ptr_conv.is_owned = false;
67986         jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
67987         return ret_conv;
67988 }
67989
67990 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_enabled"))) TS_ChannelUpdateInfo_set_enabled(uint64_t this_ptr, jboolean val) {
67991         LDKChannelUpdateInfo this_ptr_conv;
67992         this_ptr_conv.inner = untag_ptr(this_ptr);
67993         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67995         this_ptr_conv.is_owned = false;
67996         ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
67997 }
67998
67999 int16_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_cltv_expiry_delta"))) TS_ChannelUpdateInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
68000         LDKChannelUpdateInfo this_ptr_conv;
68001         this_ptr_conv.inner = untag_ptr(this_ptr);
68002         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68004         this_ptr_conv.is_owned = false;
68005         int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
68006         return ret_conv;
68007 }
68008
68009 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_cltv_expiry_delta"))) TS_ChannelUpdateInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
68010         LDKChannelUpdateInfo this_ptr_conv;
68011         this_ptr_conv.inner = untag_ptr(this_ptr);
68012         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68014         this_ptr_conv.is_owned = false;
68015         ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
68016 }
68017
68018 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_minimum_msat"))) TS_ChannelUpdateInfo_get_htlc_minimum_msat(uint64_t this_ptr) {
68019         LDKChannelUpdateInfo this_ptr_conv;
68020         this_ptr_conv.inner = untag_ptr(this_ptr);
68021         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68023         this_ptr_conv.is_owned = false;
68024         int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
68025         return ret_conv;
68026 }
68027
68028 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_minimum_msat"))) TS_ChannelUpdateInfo_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
68029         LDKChannelUpdateInfo this_ptr_conv;
68030         this_ptr_conv.inner = untag_ptr(this_ptr);
68031         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68033         this_ptr_conv.is_owned = false;
68034         ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
68035 }
68036
68037 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_maximum_msat"))) TS_ChannelUpdateInfo_get_htlc_maximum_msat(uint64_t this_ptr) {
68038         LDKChannelUpdateInfo this_ptr_conv;
68039         this_ptr_conv.inner = untag_ptr(this_ptr);
68040         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68042         this_ptr_conv.is_owned = false;
68043         int64_t ret_conv = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
68044         return ret_conv;
68045 }
68046
68047 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_maximum_msat"))) TS_ChannelUpdateInfo_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
68048         LDKChannelUpdateInfo this_ptr_conv;
68049         this_ptr_conv.inner = untag_ptr(this_ptr);
68050         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68052         this_ptr_conv.is_owned = false;
68053         ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
68054 }
68055
68056 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_fees"))) TS_ChannelUpdateInfo_get_fees(uint64_t this_ptr) {
68057         LDKChannelUpdateInfo this_ptr_conv;
68058         this_ptr_conv.inner = untag_ptr(this_ptr);
68059         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68061         this_ptr_conv.is_owned = false;
68062         LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
68063         uint64_t ret_ref = 0;
68064         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68065         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68066         return ret_ref;
68067 }
68068
68069 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_fees"))) TS_ChannelUpdateInfo_set_fees(uint64_t this_ptr, uint64_t val) {
68070         LDKChannelUpdateInfo this_ptr_conv;
68071         this_ptr_conv.inner = untag_ptr(this_ptr);
68072         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68074         this_ptr_conv.is_owned = false;
68075         LDKRoutingFees val_conv;
68076         val_conv.inner = untag_ptr(val);
68077         val_conv.is_owned = ptr_is_owned(val);
68078         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68079         val_conv = RoutingFees_clone(&val_conv);
68080         ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
68081 }
68082
68083 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update_message"))) TS_ChannelUpdateInfo_get_last_update_message(uint64_t this_ptr) {
68084         LDKChannelUpdateInfo this_ptr_conv;
68085         this_ptr_conv.inner = untag_ptr(this_ptr);
68086         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68088         this_ptr_conv.is_owned = false;
68089         LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
68090         uint64_t ret_ref = 0;
68091         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68092         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68093         return ret_ref;
68094 }
68095
68096 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update_message"))) TS_ChannelUpdateInfo_set_last_update_message(uint64_t this_ptr, uint64_t val) {
68097         LDKChannelUpdateInfo this_ptr_conv;
68098         this_ptr_conv.inner = untag_ptr(this_ptr);
68099         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68101         this_ptr_conv.is_owned = false;
68102         LDKChannelUpdate val_conv;
68103         val_conv.inner = untag_ptr(val);
68104         val_conv.is_owned = ptr_is_owned(val);
68105         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68106         val_conv = ChannelUpdate_clone(&val_conv);
68107         ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
68108 }
68109
68110 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) {
68111         LDKRoutingFees fees_arg_conv;
68112         fees_arg_conv.inner = untag_ptr(fees_arg);
68113         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
68114         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
68115         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
68116         LDKChannelUpdate last_update_message_arg_conv;
68117         last_update_message_arg_conv.inner = untag_ptr(last_update_message_arg);
68118         last_update_message_arg_conv.is_owned = ptr_is_owned(last_update_message_arg);
68119         CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
68120         last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
68121         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);
68122         uint64_t ret_ref = 0;
68123         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68124         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68125         return ret_ref;
68126 }
68127
68128 static inline uint64_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
68129         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
68130         uint64_t ret_ref = 0;
68131         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68132         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68133         return ret_ref;
68134 }
68135 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_clone_ptr"))) TS_ChannelUpdateInfo_clone_ptr(uint64_t arg) {
68136         LDKChannelUpdateInfo arg_conv;
68137         arg_conv.inner = untag_ptr(arg);
68138         arg_conv.is_owned = ptr_is_owned(arg);
68139         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68140         arg_conv.is_owned = false;
68141         int64_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
68142         return ret_conv;
68143 }
68144
68145 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_clone"))) TS_ChannelUpdateInfo_clone(uint64_t orig) {
68146         LDKChannelUpdateInfo orig_conv;
68147         orig_conv.inner = untag_ptr(orig);
68148         orig_conv.is_owned = ptr_is_owned(orig);
68149         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68150         orig_conv.is_owned = false;
68151         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
68152         uint64_t ret_ref = 0;
68153         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68154         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68155         return ret_ref;
68156 }
68157
68158 jboolean  __attribute__((export_name("TS_ChannelUpdateInfo_eq"))) TS_ChannelUpdateInfo_eq(uint64_t a, uint64_t b) {
68159         LDKChannelUpdateInfo a_conv;
68160         a_conv.inner = untag_ptr(a);
68161         a_conv.is_owned = ptr_is_owned(a);
68162         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68163         a_conv.is_owned = false;
68164         LDKChannelUpdateInfo b_conv;
68165         b_conv.inner = untag_ptr(b);
68166         b_conv.is_owned = ptr_is_owned(b);
68167         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68168         b_conv.is_owned = false;
68169         jboolean ret_conv = ChannelUpdateInfo_eq(&a_conv, &b_conv);
68170         return ret_conv;
68171 }
68172
68173 int8_tArray  __attribute__((export_name("TS_ChannelUpdateInfo_write"))) TS_ChannelUpdateInfo_write(uint64_t obj) {
68174         LDKChannelUpdateInfo obj_conv;
68175         obj_conv.inner = untag_ptr(obj);
68176         obj_conv.is_owned = ptr_is_owned(obj);
68177         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
68178         obj_conv.is_owned = false;
68179         LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
68180         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
68181         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
68182         CVec_u8Z_free(ret_var);
68183         return ret_arr;
68184 }
68185
68186 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_read"))) TS_ChannelUpdateInfo_read(int8_tArray ser) {
68187         LDKu8slice ser_ref;
68188         ser_ref.datalen = ser->arr_len;
68189         ser_ref.data = ser->elems;
68190         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
68191         *ret_conv = ChannelUpdateInfo_read(ser_ref);
68192         FREE(ser);
68193         return tag_ptr(ret_conv, true);
68194 }
68195
68196 void  __attribute__((export_name("TS_ChannelInfo_free"))) TS_ChannelInfo_free(uint64_t this_obj) {
68197         LDKChannelInfo this_obj_conv;
68198         this_obj_conv.inner = untag_ptr(this_obj);
68199         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68201         ChannelInfo_free(this_obj_conv);
68202 }
68203
68204 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_features"))) TS_ChannelInfo_get_features(uint64_t this_ptr) {
68205         LDKChannelInfo this_ptr_conv;
68206         this_ptr_conv.inner = untag_ptr(this_ptr);
68207         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68209         this_ptr_conv.is_owned = false;
68210         LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
68211         uint64_t ret_ref = 0;
68212         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68213         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68214         return ret_ref;
68215 }
68216
68217 void  __attribute__((export_name("TS_ChannelInfo_set_features"))) TS_ChannelInfo_set_features(uint64_t this_ptr, uint64_t val) {
68218         LDKChannelInfo this_ptr_conv;
68219         this_ptr_conv.inner = untag_ptr(this_ptr);
68220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68222         this_ptr_conv.is_owned = false;
68223         LDKChannelFeatures val_conv;
68224         val_conv.inner = untag_ptr(val);
68225         val_conv.is_owned = ptr_is_owned(val);
68226         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68227         val_conv = ChannelFeatures_clone(&val_conv);
68228         ChannelInfo_set_features(&this_ptr_conv, val_conv);
68229 }
68230
68231 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_node_one"))) TS_ChannelInfo_get_node_one(uint64_t this_ptr) {
68232         LDKChannelInfo this_ptr_conv;
68233         this_ptr_conv.inner = untag_ptr(this_ptr);
68234         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68236         this_ptr_conv.is_owned = false;
68237         LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
68238         uint64_t ret_ref = 0;
68239         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68240         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68241         return ret_ref;
68242 }
68243
68244 void  __attribute__((export_name("TS_ChannelInfo_set_node_one"))) TS_ChannelInfo_set_node_one(uint64_t this_ptr, uint64_t val) {
68245         LDKChannelInfo this_ptr_conv;
68246         this_ptr_conv.inner = untag_ptr(this_ptr);
68247         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68249         this_ptr_conv.is_owned = false;
68250         LDKNodeId val_conv;
68251         val_conv.inner = untag_ptr(val);
68252         val_conv.is_owned = ptr_is_owned(val);
68253         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68254         val_conv = NodeId_clone(&val_conv);
68255         ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
68256 }
68257
68258 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_one_to_two"))) TS_ChannelInfo_get_one_to_two(uint64_t this_ptr) {
68259         LDKChannelInfo this_ptr_conv;
68260         this_ptr_conv.inner = untag_ptr(this_ptr);
68261         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68263         this_ptr_conv.is_owned = false;
68264         LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
68265         uint64_t ret_ref = 0;
68266         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68267         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68268         return ret_ref;
68269 }
68270
68271 void  __attribute__((export_name("TS_ChannelInfo_set_one_to_two"))) TS_ChannelInfo_set_one_to_two(uint64_t this_ptr, uint64_t val) {
68272         LDKChannelInfo this_ptr_conv;
68273         this_ptr_conv.inner = untag_ptr(this_ptr);
68274         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68276         this_ptr_conv.is_owned = false;
68277         LDKChannelUpdateInfo val_conv;
68278         val_conv.inner = untag_ptr(val);
68279         val_conv.is_owned = ptr_is_owned(val);
68280         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68281         val_conv = ChannelUpdateInfo_clone(&val_conv);
68282         ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
68283 }
68284
68285 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_node_two"))) TS_ChannelInfo_get_node_two(uint64_t this_ptr) {
68286         LDKChannelInfo this_ptr_conv;
68287         this_ptr_conv.inner = untag_ptr(this_ptr);
68288         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68290         this_ptr_conv.is_owned = false;
68291         LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
68292         uint64_t ret_ref = 0;
68293         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68294         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68295         return ret_ref;
68296 }
68297
68298 void  __attribute__((export_name("TS_ChannelInfo_set_node_two"))) TS_ChannelInfo_set_node_two(uint64_t this_ptr, uint64_t val) {
68299         LDKChannelInfo this_ptr_conv;
68300         this_ptr_conv.inner = untag_ptr(this_ptr);
68301         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68303         this_ptr_conv.is_owned = false;
68304         LDKNodeId val_conv;
68305         val_conv.inner = untag_ptr(val);
68306         val_conv.is_owned = ptr_is_owned(val);
68307         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68308         val_conv = NodeId_clone(&val_conv);
68309         ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
68310 }
68311
68312 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_two_to_one"))) TS_ChannelInfo_get_two_to_one(uint64_t this_ptr) {
68313         LDKChannelInfo this_ptr_conv;
68314         this_ptr_conv.inner = untag_ptr(this_ptr);
68315         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68317         this_ptr_conv.is_owned = false;
68318         LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
68319         uint64_t ret_ref = 0;
68320         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68321         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68322         return ret_ref;
68323 }
68324
68325 void  __attribute__((export_name("TS_ChannelInfo_set_two_to_one"))) TS_ChannelInfo_set_two_to_one(uint64_t this_ptr, uint64_t val) {
68326         LDKChannelInfo this_ptr_conv;
68327         this_ptr_conv.inner = untag_ptr(this_ptr);
68328         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68330         this_ptr_conv.is_owned = false;
68331         LDKChannelUpdateInfo val_conv;
68332         val_conv.inner = untag_ptr(val);
68333         val_conv.is_owned = ptr_is_owned(val);
68334         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68335         val_conv = ChannelUpdateInfo_clone(&val_conv);
68336         ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
68337 }
68338
68339 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_capacity_sats"))) TS_ChannelInfo_get_capacity_sats(uint64_t this_ptr) {
68340         LDKChannelInfo this_ptr_conv;
68341         this_ptr_conv.inner = untag_ptr(this_ptr);
68342         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68344         this_ptr_conv.is_owned = false;
68345         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
68346         *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
68347         uint64_t ret_ref = tag_ptr(ret_copy, true);
68348         return ret_ref;
68349 }
68350
68351 void  __attribute__((export_name("TS_ChannelInfo_set_capacity_sats"))) TS_ChannelInfo_set_capacity_sats(uint64_t this_ptr, uint64_t val) {
68352         LDKChannelInfo this_ptr_conv;
68353         this_ptr_conv.inner = untag_ptr(this_ptr);
68354         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68356         this_ptr_conv.is_owned = false;
68357         void* val_ptr = untag_ptr(val);
68358         CHECK_ACCESS(val_ptr);
68359         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
68360         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
68361         ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
68362 }
68363
68364 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_announcement_message"))) TS_ChannelInfo_get_announcement_message(uint64_t this_ptr) {
68365         LDKChannelInfo this_ptr_conv;
68366         this_ptr_conv.inner = untag_ptr(this_ptr);
68367         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68369         this_ptr_conv.is_owned = false;
68370         LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
68371         uint64_t ret_ref = 0;
68372         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68373         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68374         return ret_ref;
68375 }
68376
68377 void  __attribute__((export_name("TS_ChannelInfo_set_announcement_message"))) TS_ChannelInfo_set_announcement_message(uint64_t this_ptr, uint64_t val) {
68378         LDKChannelInfo this_ptr_conv;
68379         this_ptr_conv.inner = untag_ptr(this_ptr);
68380         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68382         this_ptr_conv.is_owned = false;
68383         LDKChannelAnnouncement val_conv;
68384         val_conv.inner = untag_ptr(val);
68385         val_conv.is_owned = ptr_is_owned(val);
68386         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68387         val_conv = ChannelAnnouncement_clone(&val_conv);
68388         ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
68389 }
68390
68391 static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
68392         LDKChannelInfo ret_var = ChannelInfo_clone(arg);
68393         uint64_t ret_ref = 0;
68394         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68395         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68396         return ret_ref;
68397 }
68398 int64_t  __attribute__((export_name("TS_ChannelInfo_clone_ptr"))) TS_ChannelInfo_clone_ptr(uint64_t arg) {
68399         LDKChannelInfo arg_conv;
68400         arg_conv.inner = untag_ptr(arg);
68401         arg_conv.is_owned = ptr_is_owned(arg);
68402         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68403         arg_conv.is_owned = false;
68404         int64_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
68405         return ret_conv;
68406 }
68407
68408 uint64_t  __attribute__((export_name("TS_ChannelInfo_clone"))) TS_ChannelInfo_clone(uint64_t orig) {
68409         LDKChannelInfo orig_conv;
68410         orig_conv.inner = untag_ptr(orig);
68411         orig_conv.is_owned = ptr_is_owned(orig);
68412         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68413         orig_conv.is_owned = false;
68414         LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
68415         uint64_t ret_ref = 0;
68416         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68417         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68418         return ret_ref;
68419 }
68420
68421 jboolean  __attribute__((export_name("TS_ChannelInfo_eq"))) TS_ChannelInfo_eq(uint64_t a, uint64_t b) {
68422         LDKChannelInfo a_conv;
68423         a_conv.inner = untag_ptr(a);
68424         a_conv.is_owned = ptr_is_owned(a);
68425         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68426         a_conv.is_owned = false;
68427         LDKChannelInfo b_conv;
68428         b_conv.inner = untag_ptr(b);
68429         b_conv.is_owned = ptr_is_owned(b);
68430         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68431         b_conv.is_owned = false;
68432         jboolean ret_conv = ChannelInfo_eq(&a_conv, &b_conv);
68433         return ret_conv;
68434 }
68435
68436 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_directional_info"))) TS_ChannelInfo_get_directional_info(uint64_t this_arg, int8_t channel_flags) {
68437         LDKChannelInfo this_arg_conv;
68438         this_arg_conv.inner = untag_ptr(this_arg);
68439         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68441         this_arg_conv.is_owned = false;
68442         LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
68443         uint64_t ret_ref = 0;
68444         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68445         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68446         return ret_ref;
68447 }
68448
68449 int8_tArray  __attribute__((export_name("TS_ChannelInfo_write"))) TS_ChannelInfo_write(uint64_t obj) {
68450         LDKChannelInfo obj_conv;
68451         obj_conv.inner = untag_ptr(obj);
68452         obj_conv.is_owned = ptr_is_owned(obj);
68453         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
68454         obj_conv.is_owned = false;
68455         LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
68456         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
68457         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
68458         CVec_u8Z_free(ret_var);
68459         return ret_arr;
68460 }
68461
68462 uint64_t  __attribute__((export_name("TS_ChannelInfo_read"))) TS_ChannelInfo_read(int8_tArray ser) {
68463         LDKu8slice ser_ref;
68464         ser_ref.datalen = ser->arr_len;
68465         ser_ref.data = ser->elems;
68466         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
68467         *ret_conv = ChannelInfo_read(ser_ref);
68468         FREE(ser);
68469         return tag_ptr(ret_conv, true);
68470 }
68471
68472 void  __attribute__((export_name("TS_DirectedChannelInfo_free"))) TS_DirectedChannelInfo_free(uint64_t this_obj) {
68473         LDKDirectedChannelInfo this_obj_conv;
68474         this_obj_conv.inner = untag_ptr(this_obj);
68475         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68477         DirectedChannelInfo_free(this_obj_conv);
68478 }
68479
68480 static inline uint64_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
68481         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
68482         uint64_t ret_ref = 0;
68483         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68484         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68485         return ret_ref;
68486 }
68487 int64_t  __attribute__((export_name("TS_DirectedChannelInfo_clone_ptr"))) TS_DirectedChannelInfo_clone_ptr(uint64_t arg) {
68488         LDKDirectedChannelInfo arg_conv;
68489         arg_conv.inner = untag_ptr(arg);
68490         arg_conv.is_owned = ptr_is_owned(arg);
68491         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68492         arg_conv.is_owned = false;
68493         int64_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
68494         return ret_conv;
68495 }
68496
68497 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_clone"))) TS_DirectedChannelInfo_clone(uint64_t orig) {
68498         LDKDirectedChannelInfo orig_conv;
68499         orig_conv.inner = untag_ptr(orig);
68500         orig_conv.is_owned = ptr_is_owned(orig);
68501         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68502         orig_conv.is_owned = false;
68503         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
68504         uint64_t ret_ref = 0;
68505         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68506         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68507         return ret_ref;
68508 }
68509
68510 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_channel"))) TS_DirectedChannelInfo_channel(uint64_t this_arg) {
68511         LDKDirectedChannelInfo this_arg_conv;
68512         this_arg_conv.inner = untag_ptr(this_arg);
68513         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68515         this_arg_conv.is_owned = false;
68516         LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
68517         uint64_t ret_ref = 0;
68518         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68519         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68520         return ret_ref;
68521 }
68522
68523 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_effective_capacity"))) TS_DirectedChannelInfo_effective_capacity(uint64_t this_arg) {
68524         LDKDirectedChannelInfo this_arg_conv;
68525         this_arg_conv.inner = untag_ptr(this_arg);
68526         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68528         this_arg_conv.is_owned = false;
68529         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
68530         *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
68531         uint64_t ret_ref = tag_ptr(ret_copy, true);
68532         return ret_ref;
68533 }
68534
68535 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_source"))) TS_DirectedChannelInfo_source(uint64_t this_arg) {
68536         LDKDirectedChannelInfo this_arg_conv;
68537         this_arg_conv.inner = untag_ptr(this_arg);
68538         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68540         this_arg_conv.is_owned = false;
68541         LDKNodeId ret_var = DirectedChannelInfo_source(&this_arg_conv);
68542         uint64_t ret_ref = 0;
68543         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68544         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68545         return ret_ref;
68546 }
68547
68548 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_target"))) TS_DirectedChannelInfo_target(uint64_t this_arg) {
68549         LDKDirectedChannelInfo this_arg_conv;
68550         this_arg_conv.inner = untag_ptr(this_arg);
68551         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68553         this_arg_conv.is_owned = false;
68554         LDKNodeId ret_var = DirectedChannelInfo_target(&this_arg_conv);
68555         uint64_t ret_ref = 0;
68556         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68557         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68558         return ret_ref;
68559 }
68560
68561 void  __attribute__((export_name("TS_EffectiveCapacity_free"))) TS_EffectiveCapacity_free(uint64_t this_ptr) {
68562         if (!ptr_is_owned(this_ptr)) return;
68563         void* this_ptr_ptr = untag_ptr(this_ptr);
68564         CHECK_ACCESS(this_ptr_ptr);
68565         LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
68566         FREE(untag_ptr(this_ptr));
68567         EffectiveCapacity_free(this_ptr_conv);
68568 }
68569
68570 static inline uint64_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
68571         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
68572         *ret_copy = EffectiveCapacity_clone(arg);
68573         uint64_t ret_ref = tag_ptr(ret_copy, true);
68574         return ret_ref;
68575 }
68576 int64_t  __attribute__((export_name("TS_EffectiveCapacity_clone_ptr"))) TS_EffectiveCapacity_clone_ptr(uint64_t arg) {
68577         LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)untag_ptr(arg);
68578         int64_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
68579         return ret_conv;
68580 }
68581
68582 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_clone"))) TS_EffectiveCapacity_clone(uint64_t orig) {
68583         LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)untag_ptr(orig);
68584         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
68585         *ret_copy = EffectiveCapacity_clone(orig_conv);
68586         uint64_t ret_ref = tag_ptr(ret_copy, true);
68587         return ret_ref;
68588 }
68589
68590 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_exact_liquidity"))) TS_EffectiveCapacity_exact_liquidity(int64_t liquidity_msat) {
68591         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
68592         *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
68593         uint64_t ret_ref = tag_ptr(ret_copy, true);
68594         return ret_ref;
68595 }
68596
68597 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_advertised_max_htlc"))) TS_EffectiveCapacity_advertised_max_htlc(int64_t amount_msat) {
68598         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
68599         *ret_copy = EffectiveCapacity_advertised_max_htlc(amount_msat);
68600         uint64_t ret_ref = tag_ptr(ret_copy, true);
68601         return ret_ref;
68602 }
68603
68604 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_total"))) TS_EffectiveCapacity_total(int64_t capacity_msat, int64_t htlc_maximum_msat) {
68605         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
68606         *ret_copy = EffectiveCapacity_total(capacity_msat, htlc_maximum_msat);
68607         uint64_t ret_ref = tag_ptr(ret_copy, true);
68608         return ret_ref;
68609 }
68610
68611 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_infinite"))) TS_EffectiveCapacity_infinite() {
68612         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
68613         *ret_copy = EffectiveCapacity_infinite();
68614         uint64_t ret_ref = tag_ptr(ret_copy, true);
68615         return ret_ref;
68616 }
68617
68618 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_hint_max_htlc"))) TS_EffectiveCapacity_hint_max_htlc(int64_t amount_msat) {
68619         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
68620         *ret_copy = EffectiveCapacity_hint_max_htlc(amount_msat);
68621         uint64_t ret_ref = tag_ptr(ret_copy, true);
68622         return ret_ref;
68623 }
68624
68625 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_unknown"))) TS_EffectiveCapacity_unknown() {
68626         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
68627         *ret_copy = EffectiveCapacity_unknown();
68628         uint64_t ret_ref = tag_ptr(ret_copy, true);
68629         return ret_ref;
68630 }
68631
68632 int64_t  __attribute__((export_name("TS_EffectiveCapacity_as_msat"))) TS_EffectiveCapacity_as_msat(uint64_t this_arg) {
68633         LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)untag_ptr(this_arg);
68634         int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
68635         return ret_conv;
68636 }
68637
68638 void  __attribute__((export_name("TS_RoutingFees_free"))) TS_RoutingFees_free(uint64_t this_obj) {
68639         LDKRoutingFees this_obj_conv;
68640         this_obj_conv.inner = untag_ptr(this_obj);
68641         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68643         RoutingFees_free(this_obj_conv);
68644 }
68645
68646 int32_t  __attribute__((export_name("TS_RoutingFees_get_base_msat"))) TS_RoutingFees_get_base_msat(uint64_t this_ptr) {
68647         LDKRoutingFees this_ptr_conv;
68648         this_ptr_conv.inner = untag_ptr(this_ptr);
68649         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68651         this_ptr_conv.is_owned = false;
68652         int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
68653         return ret_conv;
68654 }
68655
68656 void  __attribute__((export_name("TS_RoutingFees_set_base_msat"))) TS_RoutingFees_set_base_msat(uint64_t this_ptr, int32_t val) {
68657         LDKRoutingFees this_ptr_conv;
68658         this_ptr_conv.inner = untag_ptr(this_ptr);
68659         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68661         this_ptr_conv.is_owned = false;
68662         RoutingFees_set_base_msat(&this_ptr_conv, val);
68663 }
68664
68665 int32_t  __attribute__((export_name("TS_RoutingFees_get_proportional_millionths"))) TS_RoutingFees_get_proportional_millionths(uint64_t this_ptr) {
68666         LDKRoutingFees this_ptr_conv;
68667         this_ptr_conv.inner = untag_ptr(this_ptr);
68668         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68670         this_ptr_conv.is_owned = false;
68671         int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
68672         return ret_conv;
68673 }
68674
68675 void  __attribute__((export_name("TS_RoutingFees_set_proportional_millionths"))) TS_RoutingFees_set_proportional_millionths(uint64_t this_ptr, int32_t val) {
68676         LDKRoutingFees this_ptr_conv;
68677         this_ptr_conv.inner = untag_ptr(this_ptr);
68678         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68680         this_ptr_conv.is_owned = false;
68681         RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
68682 }
68683
68684 uint64_t  __attribute__((export_name("TS_RoutingFees_new"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
68685         LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
68686         uint64_t ret_ref = 0;
68687         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68688         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68689         return ret_ref;
68690 }
68691
68692 jboolean  __attribute__((export_name("TS_RoutingFees_eq"))) TS_RoutingFees_eq(uint64_t a, uint64_t b) {
68693         LDKRoutingFees a_conv;
68694         a_conv.inner = untag_ptr(a);
68695         a_conv.is_owned = ptr_is_owned(a);
68696         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68697         a_conv.is_owned = false;
68698         LDKRoutingFees b_conv;
68699         b_conv.inner = untag_ptr(b);
68700         b_conv.is_owned = ptr_is_owned(b);
68701         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68702         b_conv.is_owned = false;
68703         jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
68704         return ret_conv;
68705 }
68706
68707 static inline uint64_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
68708         LDKRoutingFees ret_var = RoutingFees_clone(arg);
68709         uint64_t ret_ref = 0;
68710         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68711         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68712         return ret_ref;
68713 }
68714 int64_t  __attribute__((export_name("TS_RoutingFees_clone_ptr"))) TS_RoutingFees_clone_ptr(uint64_t arg) {
68715         LDKRoutingFees arg_conv;
68716         arg_conv.inner = untag_ptr(arg);
68717         arg_conv.is_owned = ptr_is_owned(arg);
68718         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68719         arg_conv.is_owned = false;
68720         int64_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
68721         return ret_conv;
68722 }
68723
68724 uint64_t  __attribute__((export_name("TS_RoutingFees_clone"))) TS_RoutingFees_clone(uint64_t orig) {
68725         LDKRoutingFees orig_conv;
68726         orig_conv.inner = untag_ptr(orig);
68727         orig_conv.is_owned = ptr_is_owned(orig);
68728         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68729         orig_conv.is_owned = false;
68730         LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
68731         uint64_t ret_ref = 0;
68732         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68733         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68734         return ret_ref;
68735 }
68736
68737 int64_t  __attribute__((export_name("TS_RoutingFees_hash"))) TS_RoutingFees_hash(uint64_t o) {
68738         LDKRoutingFees o_conv;
68739         o_conv.inner = untag_ptr(o);
68740         o_conv.is_owned = ptr_is_owned(o);
68741         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68742         o_conv.is_owned = false;
68743         int64_t ret_conv = RoutingFees_hash(&o_conv);
68744         return ret_conv;
68745 }
68746
68747 int8_tArray  __attribute__((export_name("TS_RoutingFees_write"))) TS_RoutingFees_write(uint64_t obj) {
68748         LDKRoutingFees obj_conv;
68749         obj_conv.inner = untag_ptr(obj);
68750         obj_conv.is_owned = ptr_is_owned(obj);
68751         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
68752         obj_conv.is_owned = false;
68753         LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
68754         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
68755         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
68756         CVec_u8Z_free(ret_var);
68757         return ret_arr;
68758 }
68759
68760 uint64_t  __attribute__((export_name("TS_RoutingFees_read"))) TS_RoutingFees_read(int8_tArray ser) {
68761         LDKu8slice ser_ref;
68762         ser_ref.datalen = ser->arr_len;
68763         ser_ref.data = ser->elems;
68764         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
68765         *ret_conv = RoutingFees_read(ser_ref);
68766         FREE(ser);
68767         return tag_ptr(ret_conv, true);
68768 }
68769
68770 void  __attribute__((export_name("TS_NodeAnnouncementInfo_free"))) TS_NodeAnnouncementInfo_free(uint64_t this_obj) {
68771         LDKNodeAnnouncementInfo this_obj_conv;
68772         this_obj_conv.inner = untag_ptr(this_obj);
68773         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68775         NodeAnnouncementInfo_free(this_obj_conv);
68776 }
68777
68778 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_features"))) TS_NodeAnnouncementInfo_get_features(uint64_t this_ptr) {
68779         LDKNodeAnnouncementInfo this_ptr_conv;
68780         this_ptr_conv.inner = untag_ptr(this_ptr);
68781         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68783         this_ptr_conv.is_owned = false;
68784         LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
68785         uint64_t ret_ref = 0;
68786         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68787         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68788         return ret_ref;
68789 }
68790
68791 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_features"))) TS_NodeAnnouncementInfo_set_features(uint64_t this_ptr, uint64_t val) {
68792         LDKNodeAnnouncementInfo this_ptr_conv;
68793         this_ptr_conv.inner = untag_ptr(this_ptr);
68794         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68796         this_ptr_conv.is_owned = false;
68797         LDKNodeFeatures val_conv;
68798         val_conv.inner = untag_ptr(val);
68799         val_conv.is_owned = ptr_is_owned(val);
68800         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68801         val_conv = NodeFeatures_clone(&val_conv);
68802         NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
68803 }
68804
68805 int32_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_last_update"))) TS_NodeAnnouncementInfo_get_last_update(uint64_t this_ptr) {
68806         LDKNodeAnnouncementInfo this_ptr_conv;
68807         this_ptr_conv.inner = untag_ptr(this_ptr);
68808         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68810         this_ptr_conv.is_owned = false;
68811         int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
68812         return ret_conv;
68813 }
68814
68815 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_last_update"))) TS_NodeAnnouncementInfo_set_last_update(uint64_t this_ptr, int32_t val) {
68816         LDKNodeAnnouncementInfo this_ptr_conv;
68817         this_ptr_conv.inner = untag_ptr(this_ptr);
68818         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68820         this_ptr_conv.is_owned = false;
68821         NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
68822 }
68823
68824 int8_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_get_rgb"))) TS_NodeAnnouncementInfo_get_rgb(uint64_t this_ptr) {
68825         LDKNodeAnnouncementInfo this_ptr_conv;
68826         this_ptr_conv.inner = untag_ptr(this_ptr);
68827         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68829         this_ptr_conv.is_owned = false;
68830         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
68831         memcpy(ret_arr->elems, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
68832         return ret_arr;
68833 }
68834
68835 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_rgb"))) TS_NodeAnnouncementInfo_set_rgb(uint64_t this_ptr, int8_tArray val) {
68836         LDKNodeAnnouncementInfo this_ptr_conv;
68837         this_ptr_conv.inner = untag_ptr(this_ptr);
68838         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68840         this_ptr_conv.is_owned = false;
68841         LDKThreeBytes val_ref;
68842         CHECK(val->arr_len == 3);
68843         memcpy(val_ref.data, val->elems, 3); FREE(val);
68844         NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
68845 }
68846
68847 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_alias"))) TS_NodeAnnouncementInfo_get_alias(uint64_t this_ptr) {
68848         LDKNodeAnnouncementInfo this_ptr_conv;
68849         this_ptr_conv.inner = untag_ptr(this_ptr);
68850         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68852         this_ptr_conv.is_owned = false;
68853         LDKNodeAlias ret_var = NodeAnnouncementInfo_get_alias(&this_ptr_conv);
68854         uint64_t ret_ref = 0;
68855         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68856         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68857         return ret_ref;
68858 }
68859
68860 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_alias"))) TS_NodeAnnouncementInfo_set_alias(uint64_t this_ptr, uint64_t val) {
68861         LDKNodeAnnouncementInfo this_ptr_conv;
68862         this_ptr_conv.inner = untag_ptr(this_ptr);
68863         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68865         this_ptr_conv.is_owned = false;
68866         LDKNodeAlias val_conv;
68867         val_conv.inner = untag_ptr(val);
68868         val_conv.is_owned = ptr_is_owned(val);
68869         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68870         val_conv = NodeAlias_clone(&val_conv);
68871         NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_conv);
68872 }
68873
68874 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_announcement_message"))) TS_NodeAnnouncementInfo_get_announcement_message(uint64_t this_ptr) {
68875         LDKNodeAnnouncementInfo this_ptr_conv;
68876         this_ptr_conv.inner = untag_ptr(this_ptr);
68877         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68879         this_ptr_conv.is_owned = false;
68880         LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
68881         uint64_t ret_ref = 0;
68882         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68883         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68884         return ret_ref;
68885 }
68886
68887 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_announcement_message"))) TS_NodeAnnouncementInfo_set_announcement_message(uint64_t this_ptr, uint64_t val) {
68888         LDKNodeAnnouncementInfo this_ptr_conv;
68889         this_ptr_conv.inner = untag_ptr(this_ptr);
68890         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68892         this_ptr_conv.is_owned = false;
68893         LDKNodeAnnouncement val_conv;
68894         val_conv.inner = untag_ptr(val);
68895         val_conv.is_owned = ptr_is_owned(val);
68896         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68897         val_conv = NodeAnnouncement_clone(&val_conv);
68898         NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
68899 }
68900
68901 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) {
68902         LDKNodeFeatures features_arg_conv;
68903         features_arg_conv.inner = untag_ptr(features_arg);
68904         features_arg_conv.is_owned = ptr_is_owned(features_arg);
68905         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
68906         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
68907         LDKThreeBytes rgb_arg_ref;
68908         CHECK(rgb_arg->arr_len == 3);
68909         memcpy(rgb_arg_ref.data, rgb_arg->elems, 3); FREE(rgb_arg);
68910         LDKNodeAlias alias_arg_conv;
68911         alias_arg_conv.inner = untag_ptr(alias_arg);
68912         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
68913         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
68914         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
68915         LDKNodeAnnouncement announcement_message_arg_conv;
68916         announcement_message_arg_conv.inner = untag_ptr(announcement_message_arg);
68917         announcement_message_arg_conv.is_owned = ptr_is_owned(announcement_message_arg);
68918         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
68919         announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
68920         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_conv, announcement_message_arg_conv);
68921         uint64_t ret_ref = 0;
68922         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68923         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68924         return ret_ref;
68925 }
68926
68927 static inline uint64_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
68928         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
68929         uint64_t ret_ref = 0;
68930         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68931         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68932         return ret_ref;
68933 }
68934 int64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_clone_ptr"))) TS_NodeAnnouncementInfo_clone_ptr(uint64_t arg) {
68935         LDKNodeAnnouncementInfo arg_conv;
68936         arg_conv.inner = untag_ptr(arg);
68937         arg_conv.is_owned = ptr_is_owned(arg);
68938         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68939         arg_conv.is_owned = false;
68940         int64_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
68941         return ret_conv;
68942 }
68943
68944 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_clone"))) TS_NodeAnnouncementInfo_clone(uint64_t orig) {
68945         LDKNodeAnnouncementInfo orig_conv;
68946         orig_conv.inner = untag_ptr(orig);
68947         orig_conv.is_owned = ptr_is_owned(orig);
68948         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68949         orig_conv.is_owned = false;
68950         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
68951         uint64_t ret_ref = 0;
68952         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68953         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68954         return ret_ref;
68955 }
68956
68957 jboolean  __attribute__((export_name("TS_NodeAnnouncementInfo_eq"))) TS_NodeAnnouncementInfo_eq(uint64_t a, uint64_t b) {
68958         LDKNodeAnnouncementInfo a_conv;
68959         a_conv.inner = untag_ptr(a);
68960         a_conv.is_owned = ptr_is_owned(a);
68961         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68962         a_conv.is_owned = false;
68963         LDKNodeAnnouncementInfo b_conv;
68964         b_conv.inner = untag_ptr(b);
68965         b_conv.is_owned = ptr_is_owned(b);
68966         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68967         b_conv.is_owned = false;
68968         jboolean ret_conv = NodeAnnouncementInfo_eq(&a_conv, &b_conv);
68969         return ret_conv;
68970 }
68971
68972 uint64_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_addresses"))) TS_NodeAnnouncementInfo_addresses(uint64_t this_arg) {
68973         LDKNodeAnnouncementInfo this_arg_conv;
68974         this_arg_conv.inner = untag_ptr(this_arg);
68975         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68977         this_arg_conv.is_owned = false;
68978         LDKCVec_SocketAddressZ ret_var = NodeAnnouncementInfo_addresses(&this_arg_conv);
68979         uint64_tArray ret_arr = NULL;
68980         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
68981         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
68982         for (size_t p = 0; p < ret_var.datalen; p++) {
68983                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
68984                 *ret_conv_15_copy = ret_var.data[p];
68985                 uint64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
68986                 ret_arr_ptr[p] = ret_conv_15_ref;
68987         }
68988         
68989         FREE(ret_var.data);
68990         return ret_arr;
68991 }
68992
68993 int8_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_write"))) TS_NodeAnnouncementInfo_write(uint64_t obj) {
68994         LDKNodeAnnouncementInfo obj_conv;
68995         obj_conv.inner = untag_ptr(obj);
68996         obj_conv.is_owned = ptr_is_owned(obj);
68997         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
68998         obj_conv.is_owned = false;
68999         LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
69000         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
69001         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
69002         CVec_u8Z_free(ret_var);
69003         return ret_arr;
69004 }
69005
69006 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_read"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
69007         LDKu8slice ser_ref;
69008         ser_ref.datalen = ser->arr_len;
69009         ser_ref.data = ser->elems;
69010         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
69011         *ret_conv = NodeAnnouncementInfo_read(ser_ref);
69012         FREE(ser);
69013         return tag_ptr(ret_conv, true);
69014 }
69015
69016 void  __attribute__((export_name("TS_NodeAlias_free"))) TS_NodeAlias_free(uint64_t this_obj) {
69017         LDKNodeAlias this_obj_conv;
69018         this_obj_conv.inner = untag_ptr(this_obj);
69019         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69021         NodeAlias_free(this_obj_conv);
69022 }
69023
69024 int8_tArray  __attribute__((export_name("TS_NodeAlias_get_a"))) TS_NodeAlias_get_a(uint64_t this_ptr) {
69025         LDKNodeAlias this_ptr_conv;
69026         this_ptr_conv.inner = untag_ptr(this_ptr);
69027         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69029         this_ptr_conv.is_owned = false;
69030         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
69031         memcpy(ret_arr->elems, *NodeAlias_get_a(&this_ptr_conv), 32);
69032         return ret_arr;
69033 }
69034
69035 void  __attribute__((export_name("TS_NodeAlias_set_a"))) TS_NodeAlias_set_a(uint64_t this_ptr, int8_tArray val) {
69036         LDKNodeAlias this_ptr_conv;
69037         this_ptr_conv.inner = untag_ptr(this_ptr);
69038         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69040         this_ptr_conv.is_owned = false;
69041         LDKThirtyTwoBytes val_ref;
69042         CHECK(val->arr_len == 32);
69043         memcpy(val_ref.data, val->elems, 32); FREE(val);
69044         NodeAlias_set_a(&this_ptr_conv, val_ref);
69045 }
69046
69047 uint64_t  __attribute__((export_name("TS_NodeAlias_new"))) TS_NodeAlias_new(int8_tArray a_arg) {
69048         LDKThirtyTwoBytes a_arg_ref;
69049         CHECK(a_arg->arr_len == 32);
69050         memcpy(a_arg_ref.data, a_arg->elems, 32); FREE(a_arg);
69051         LDKNodeAlias ret_var = NodeAlias_new(a_arg_ref);
69052         uint64_t ret_ref = 0;
69053         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69054         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69055         return ret_ref;
69056 }
69057
69058 static inline uint64_t NodeAlias_clone_ptr(LDKNodeAlias *NONNULL_PTR arg) {
69059         LDKNodeAlias ret_var = NodeAlias_clone(arg);
69060         uint64_t ret_ref = 0;
69061         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69062         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69063         return ret_ref;
69064 }
69065 int64_t  __attribute__((export_name("TS_NodeAlias_clone_ptr"))) TS_NodeAlias_clone_ptr(uint64_t arg) {
69066         LDKNodeAlias arg_conv;
69067         arg_conv.inner = untag_ptr(arg);
69068         arg_conv.is_owned = ptr_is_owned(arg);
69069         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69070         arg_conv.is_owned = false;
69071         int64_t ret_conv = NodeAlias_clone_ptr(&arg_conv);
69072         return ret_conv;
69073 }
69074
69075 uint64_t  __attribute__((export_name("TS_NodeAlias_clone"))) TS_NodeAlias_clone(uint64_t orig) {
69076         LDKNodeAlias orig_conv;
69077         orig_conv.inner = untag_ptr(orig);
69078         orig_conv.is_owned = ptr_is_owned(orig);
69079         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69080         orig_conv.is_owned = false;
69081         LDKNodeAlias ret_var = NodeAlias_clone(&orig_conv);
69082         uint64_t ret_ref = 0;
69083         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69084         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69085         return ret_ref;
69086 }
69087
69088 int64_t  __attribute__((export_name("TS_NodeAlias_hash"))) TS_NodeAlias_hash(uint64_t o) {
69089         LDKNodeAlias o_conv;
69090         o_conv.inner = untag_ptr(o);
69091         o_conv.is_owned = ptr_is_owned(o);
69092         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
69093         o_conv.is_owned = false;
69094         int64_t ret_conv = NodeAlias_hash(&o_conv);
69095         return ret_conv;
69096 }
69097
69098 jboolean  __attribute__((export_name("TS_NodeAlias_eq"))) TS_NodeAlias_eq(uint64_t a, uint64_t b) {
69099         LDKNodeAlias a_conv;
69100         a_conv.inner = untag_ptr(a);
69101         a_conv.is_owned = ptr_is_owned(a);
69102         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
69103         a_conv.is_owned = false;
69104         LDKNodeAlias b_conv;
69105         b_conv.inner = untag_ptr(b);
69106         b_conv.is_owned = ptr_is_owned(b);
69107         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
69108         b_conv.is_owned = false;
69109         jboolean ret_conv = NodeAlias_eq(&a_conv, &b_conv);
69110         return ret_conv;
69111 }
69112
69113 int8_tArray  __attribute__((export_name("TS_NodeAlias_write"))) TS_NodeAlias_write(uint64_t obj) {
69114         LDKNodeAlias obj_conv;
69115         obj_conv.inner = untag_ptr(obj);
69116         obj_conv.is_owned = ptr_is_owned(obj);
69117         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
69118         obj_conv.is_owned = false;
69119         LDKCVec_u8Z ret_var = NodeAlias_write(&obj_conv);
69120         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
69121         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
69122         CVec_u8Z_free(ret_var);
69123         return ret_arr;
69124 }
69125
69126 uint64_t  __attribute__((export_name("TS_NodeAlias_read"))) TS_NodeAlias_read(int8_tArray ser) {
69127         LDKu8slice ser_ref;
69128         ser_ref.datalen = ser->arr_len;
69129         ser_ref.data = ser->elems;
69130         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
69131         *ret_conv = NodeAlias_read(ser_ref);
69132         FREE(ser);
69133         return tag_ptr(ret_conv, true);
69134 }
69135
69136 void  __attribute__((export_name("TS_NodeInfo_free"))) TS_NodeInfo_free(uint64_t this_obj) {
69137         LDKNodeInfo this_obj_conv;
69138         this_obj_conv.inner = untag_ptr(this_obj);
69139         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69141         NodeInfo_free(this_obj_conv);
69142 }
69143
69144 int64_tArray  __attribute__((export_name("TS_NodeInfo_get_channels"))) TS_NodeInfo_get_channels(uint64_t this_ptr) {
69145         LDKNodeInfo this_ptr_conv;
69146         this_ptr_conv.inner = untag_ptr(this_ptr);
69147         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69149         this_ptr_conv.is_owned = false;
69150         LDKCVec_u64Z ret_var = NodeInfo_get_channels(&this_ptr_conv);
69151         int64_tArray ret_arr = NULL;
69152         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
69153         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
69154         for (size_t i = 0; i < ret_var.datalen; i++) {
69155                 int64_t ret_conv_8_conv = ret_var.data[i];
69156                 ret_arr_ptr[i] = ret_conv_8_conv;
69157         }
69158         
69159         FREE(ret_var.data);
69160         return ret_arr;
69161 }
69162
69163 void  __attribute__((export_name("TS_NodeInfo_set_channels"))) TS_NodeInfo_set_channels(uint64_t this_ptr, int64_tArray val) {
69164         LDKNodeInfo this_ptr_conv;
69165         this_ptr_conv.inner = untag_ptr(this_ptr);
69166         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69168         this_ptr_conv.is_owned = false;
69169         LDKCVec_u64Z val_constr;
69170         val_constr.datalen = val->arr_len;
69171         if (val_constr.datalen > 0)
69172                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
69173         else
69174                 val_constr.data = NULL;
69175         int64_t* val_vals = val->elems;
69176         for (size_t i = 0; i < val_constr.datalen; i++) {
69177                 int64_t val_conv_8 = val_vals[i];
69178                 val_constr.data[i] = val_conv_8;
69179         }
69180         FREE(val);
69181         NodeInfo_set_channels(&this_ptr_conv, val_constr);
69182 }
69183
69184 uint64_t  __attribute__((export_name("TS_NodeInfo_get_announcement_info"))) TS_NodeInfo_get_announcement_info(uint64_t this_ptr) {
69185         LDKNodeInfo this_ptr_conv;
69186         this_ptr_conv.inner = untag_ptr(this_ptr);
69187         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69189         this_ptr_conv.is_owned = false;
69190         LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
69191         uint64_t ret_ref = 0;
69192         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69193         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69194         return ret_ref;
69195 }
69196
69197 void  __attribute__((export_name("TS_NodeInfo_set_announcement_info"))) TS_NodeInfo_set_announcement_info(uint64_t this_ptr, uint64_t val) {
69198         LDKNodeInfo this_ptr_conv;
69199         this_ptr_conv.inner = untag_ptr(this_ptr);
69200         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69202         this_ptr_conv.is_owned = false;
69203         LDKNodeAnnouncementInfo val_conv;
69204         val_conv.inner = untag_ptr(val);
69205         val_conv.is_owned = ptr_is_owned(val);
69206         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
69207         val_conv = NodeAnnouncementInfo_clone(&val_conv);
69208         NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
69209 }
69210
69211 uint64_t  __attribute__((export_name("TS_NodeInfo_new"))) TS_NodeInfo_new(int64_tArray channels_arg, uint64_t announcement_info_arg) {
69212         LDKCVec_u64Z channels_arg_constr;
69213         channels_arg_constr.datalen = channels_arg->arr_len;
69214         if (channels_arg_constr.datalen > 0)
69215                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
69216         else
69217                 channels_arg_constr.data = NULL;
69218         int64_t* channels_arg_vals = channels_arg->elems;
69219         for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
69220                 int64_t channels_arg_conv_8 = channels_arg_vals[i];
69221                 channels_arg_constr.data[i] = channels_arg_conv_8;
69222         }
69223         FREE(channels_arg);
69224         LDKNodeAnnouncementInfo announcement_info_arg_conv;
69225         announcement_info_arg_conv.inner = untag_ptr(announcement_info_arg);
69226         announcement_info_arg_conv.is_owned = ptr_is_owned(announcement_info_arg);
69227         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
69228         announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
69229         LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, announcement_info_arg_conv);
69230         uint64_t ret_ref = 0;
69231         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69232         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69233         return ret_ref;
69234 }
69235
69236 static inline uint64_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
69237         LDKNodeInfo ret_var = NodeInfo_clone(arg);
69238         uint64_t ret_ref = 0;
69239         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69240         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69241         return ret_ref;
69242 }
69243 int64_t  __attribute__((export_name("TS_NodeInfo_clone_ptr"))) TS_NodeInfo_clone_ptr(uint64_t arg) {
69244         LDKNodeInfo arg_conv;
69245         arg_conv.inner = untag_ptr(arg);
69246         arg_conv.is_owned = ptr_is_owned(arg);
69247         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69248         arg_conv.is_owned = false;
69249         int64_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
69250         return ret_conv;
69251 }
69252
69253 uint64_t  __attribute__((export_name("TS_NodeInfo_clone"))) TS_NodeInfo_clone(uint64_t orig) {
69254         LDKNodeInfo orig_conv;
69255         orig_conv.inner = untag_ptr(orig);
69256         orig_conv.is_owned = ptr_is_owned(orig);
69257         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69258         orig_conv.is_owned = false;
69259         LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
69260         uint64_t ret_ref = 0;
69261         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69262         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69263         return ret_ref;
69264 }
69265
69266 jboolean  __attribute__((export_name("TS_NodeInfo_eq"))) TS_NodeInfo_eq(uint64_t a, uint64_t b) {
69267         LDKNodeInfo a_conv;
69268         a_conv.inner = untag_ptr(a);
69269         a_conv.is_owned = ptr_is_owned(a);
69270         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
69271         a_conv.is_owned = false;
69272         LDKNodeInfo b_conv;
69273         b_conv.inner = untag_ptr(b);
69274         b_conv.is_owned = ptr_is_owned(b);
69275         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
69276         b_conv.is_owned = false;
69277         jboolean ret_conv = NodeInfo_eq(&a_conv, &b_conv);
69278         return ret_conv;
69279 }
69280
69281 jboolean  __attribute__((export_name("TS_NodeInfo_is_tor_only"))) TS_NodeInfo_is_tor_only(uint64_t this_arg) {
69282         LDKNodeInfo this_arg_conv;
69283         this_arg_conv.inner = untag_ptr(this_arg);
69284         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69286         this_arg_conv.is_owned = false;
69287         jboolean ret_conv = NodeInfo_is_tor_only(&this_arg_conv);
69288         return ret_conv;
69289 }
69290
69291 int8_tArray  __attribute__((export_name("TS_NodeInfo_write"))) TS_NodeInfo_write(uint64_t obj) {
69292         LDKNodeInfo obj_conv;
69293         obj_conv.inner = untag_ptr(obj);
69294         obj_conv.is_owned = ptr_is_owned(obj);
69295         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
69296         obj_conv.is_owned = false;
69297         LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
69298         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
69299         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
69300         CVec_u8Z_free(ret_var);
69301         return ret_arr;
69302 }
69303
69304 uint64_t  __attribute__((export_name("TS_NodeInfo_read"))) TS_NodeInfo_read(int8_tArray ser) {
69305         LDKu8slice ser_ref;
69306         ser_ref.datalen = ser->arr_len;
69307         ser_ref.data = ser->elems;
69308         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
69309         *ret_conv = NodeInfo_read(ser_ref);
69310         FREE(ser);
69311         return tag_ptr(ret_conv, true);
69312 }
69313
69314 int8_tArray  __attribute__((export_name("TS_NetworkGraph_write"))) TS_NetworkGraph_write(uint64_t obj) {
69315         LDKNetworkGraph obj_conv;
69316         obj_conv.inner = untag_ptr(obj);
69317         obj_conv.is_owned = ptr_is_owned(obj);
69318         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
69319         obj_conv.is_owned = false;
69320         LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
69321         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
69322         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
69323         CVec_u8Z_free(ret_var);
69324         return ret_arr;
69325 }
69326
69327 uint64_t  __attribute__((export_name("TS_NetworkGraph_read"))) TS_NetworkGraph_read(int8_tArray ser, uint64_t arg) {
69328         LDKu8slice ser_ref;
69329         ser_ref.datalen = ser->arr_len;
69330         ser_ref.data = ser->elems;
69331         void* arg_ptr = untag_ptr(arg);
69332         CHECK_ACCESS(arg_ptr);
69333         LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
69334         if (arg_conv.free == LDKLogger_JCalls_free) {
69335                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69336                 LDKLogger_JCalls_cloned(&arg_conv);
69337         }
69338         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
69339         *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
69340         FREE(ser);
69341         return tag_ptr(ret_conv, true);
69342 }
69343
69344 uint64_t  __attribute__((export_name("TS_NetworkGraph_new"))) TS_NetworkGraph_new(uint32_t network, uint64_t logger) {
69345         LDKNetwork network_conv = LDKNetwork_from_js(network);
69346         void* logger_ptr = untag_ptr(logger);
69347         CHECK_ACCESS(logger_ptr);
69348         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
69349         if (logger_conv.free == LDKLogger_JCalls_free) {
69350                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69351                 LDKLogger_JCalls_cloned(&logger_conv);
69352         }
69353         LDKNetworkGraph ret_var = NetworkGraph_new(network_conv, logger_conv);
69354         uint64_t ret_ref = 0;
69355         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69356         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69357         return ret_ref;
69358 }
69359
69360 uint64_t  __attribute__((export_name("TS_NetworkGraph_read_only"))) TS_NetworkGraph_read_only(uint64_t this_arg) {
69361         LDKNetworkGraph this_arg_conv;
69362         this_arg_conv.inner = untag_ptr(this_arg);
69363         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69365         this_arg_conv.is_owned = false;
69366         LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
69367         uint64_t ret_ref = 0;
69368         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69369         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69370         return ret_ref;
69371 }
69372
69373 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) {
69374         LDKNetworkGraph this_arg_conv;
69375         this_arg_conv.inner = untag_ptr(this_arg);
69376         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69378         this_arg_conv.is_owned = false;
69379         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
69380         *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
69381         uint64_t ret_ref = tag_ptr(ret_copy, true);
69382         return ret_ref;
69383 }
69384
69385 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) {
69386         LDKNetworkGraph this_arg_conv;
69387         this_arg_conv.inner = untag_ptr(this_arg);
69388         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69390         this_arg_conv.is_owned = false;
69391         NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
69392 }
69393
69394 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_node_from_announcement"))) TS_NetworkGraph_update_node_from_announcement(uint64_t this_arg, uint64_t msg) {
69395         LDKNetworkGraph this_arg_conv;
69396         this_arg_conv.inner = untag_ptr(this_arg);
69397         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69399         this_arg_conv.is_owned = false;
69400         LDKNodeAnnouncement msg_conv;
69401         msg_conv.inner = untag_ptr(msg);
69402         msg_conv.is_owned = ptr_is_owned(msg);
69403         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
69404         msg_conv.is_owned = false;
69405         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
69406         *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
69407         return tag_ptr(ret_conv, true);
69408 }
69409
69410 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) {
69411         LDKNetworkGraph this_arg_conv;
69412         this_arg_conv.inner = untag_ptr(this_arg);
69413         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69415         this_arg_conv.is_owned = false;
69416         LDKUnsignedNodeAnnouncement msg_conv;
69417         msg_conv.inner = untag_ptr(msg);
69418         msg_conv.is_owned = ptr_is_owned(msg);
69419         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
69420         msg_conv.is_owned = false;
69421         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
69422         *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
69423         return tag_ptr(ret_conv, true);
69424 }
69425
69426 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) {
69427         LDKNetworkGraph this_arg_conv;
69428         this_arg_conv.inner = untag_ptr(this_arg);
69429         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69431         this_arg_conv.is_owned = false;
69432         LDKChannelAnnouncement msg_conv;
69433         msg_conv.inner = untag_ptr(msg);
69434         msg_conv.is_owned = ptr_is_owned(msg);
69435         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
69436         msg_conv.is_owned = false;
69437         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
69438         CHECK_ACCESS(utxo_lookup_ptr);
69439         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
69440         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
69441         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
69442                 // Manually implement clone for Java trait instances
69443                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
69444                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69445                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
69446                 }
69447         }
69448         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
69449         *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
69450         return tag_ptr(ret_conv, true);
69451 }
69452
69453 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) {
69454         LDKNetworkGraph this_arg_conv;
69455         this_arg_conv.inner = untag_ptr(this_arg);
69456         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69458         this_arg_conv.is_owned = false;
69459         LDKChannelAnnouncement msg_conv;
69460         msg_conv.inner = untag_ptr(msg);
69461         msg_conv.is_owned = ptr_is_owned(msg);
69462         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
69463         msg_conv.is_owned = false;
69464         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
69465         *ret_conv = NetworkGraph_update_channel_from_announcement_no_lookup(&this_arg_conv, &msg_conv);
69466         return tag_ptr(ret_conv, true);
69467 }
69468
69469 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) {
69470         LDKNetworkGraph this_arg_conv;
69471         this_arg_conv.inner = untag_ptr(this_arg);
69472         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69474         this_arg_conv.is_owned = false;
69475         LDKUnsignedChannelAnnouncement msg_conv;
69476         msg_conv.inner = untag_ptr(msg);
69477         msg_conv.is_owned = ptr_is_owned(msg);
69478         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
69479         msg_conv.is_owned = false;
69480         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
69481         CHECK_ACCESS(utxo_lookup_ptr);
69482         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
69483         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
69484         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
69485                 // Manually implement clone for Java trait instances
69486                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
69487                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69488                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
69489                 }
69490         }
69491         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
69492         *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
69493         return tag_ptr(ret_conv, true);
69494 }
69495
69496 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) {
69497         LDKNetworkGraph this_arg_conv;
69498         this_arg_conv.inner = untag_ptr(this_arg);
69499         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69501         this_arg_conv.is_owned = false;
69502         LDKChannelFeatures features_conv;
69503         features_conv.inner = untag_ptr(features);
69504         features_conv.is_owned = ptr_is_owned(features);
69505         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
69506         features_conv = ChannelFeatures_clone(&features_conv);
69507         LDKPublicKey node_id_1_ref;
69508         CHECK(node_id_1->arr_len == 33);
69509         memcpy(node_id_1_ref.compressed_form, node_id_1->elems, 33); FREE(node_id_1);
69510         LDKPublicKey node_id_2_ref;
69511         CHECK(node_id_2->arr_len == 33);
69512         memcpy(node_id_2_ref.compressed_form, node_id_2->elems, 33); FREE(node_id_2);
69513         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
69514         *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);
69515         return tag_ptr(ret_conv, true);
69516 }
69517
69518 void  __attribute__((export_name("TS_NetworkGraph_channel_failed_permanent"))) TS_NetworkGraph_channel_failed_permanent(uint64_t this_arg, int64_t short_channel_id) {
69519         LDKNetworkGraph this_arg_conv;
69520         this_arg_conv.inner = untag_ptr(this_arg);
69521         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69523         this_arg_conv.is_owned = false;
69524         NetworkGraph_channel_failed_permanent(&this_arg_conv, short_channel_id);
69525 }
69526
69527 void  __attribute__((export_name("TS_NetworkGraph_node_failed_permanent"))) TS_NetworkGraph_node_failed_permanent(uint64_t this_arg, int8_tArray node_id) {
69528         LDKNetworkGraph this_arg_conv;
69529         this_arg_conv.inner = untag_ptr(this_arg);
69530         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69532         this_arg_conv.is_owned = false;
69533         LDKPublicKey node_id_ref;
69534         CHECK(node_id->arr_len == 33);
69535         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
69536         NetworkGraph_node_failed_permanent(&this_arg_conv, node_id_ref);
69537 }
69538
69539 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) {
69540         LDKNetworkGraph this_arg_conv;
69541         this_arg_conv.inner = untag_ptr(this_arg);
69542         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69544         this_arg_conv.is_owned = false;
69545         NetworkGraph_remove_stale_channels_and_tracking_with_time(&this_arg_conv, current_time_unix);
69546 }
69547
69548 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel"))) TS_NetworkGraph_update_channel(uint64_t this_arg, uint64_t msg) {
69549         LDKNetworkGraph this_arg_conv;
69550         this_arg_conv.inner = untag_ptr(this_arg);
69551         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69553         this_arg_conv.is_owned = false;
69554         LDKChannelUpdate msg_conv;
69555         msg_conv.inner = untag_ptr(msg);
69556         msg_conv.is_owned = ptr_is_owned(msg);
69557         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
69558         msg_conv.is_owned = false;
69559         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
69560         *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
69561         return tag_ptr(ret_conv, true);
69562 }
69563
69564 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel_unsigned"))) TS_NetworkGraph_update_channel_unsigned(uint64_t this_arg, uint64_t msg) {
69565         LDKNetworkGraph this_arg_conv;
69566         this_arg_conv.inner = untag_ptr(this_arg);
69567         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69569         this_arg_conv.is_owned = false;
69570         LDKUnsignedChannelUpdate msg_conv;
69571         msg_conv.inner = untag_ptr(msg);
69572         msg_conv.is_owned = ptr_is_owned(msg);
69573         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
69574         msg_conv.is_owned = false;
69575         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
69576         *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
69577         return tag_ptr(ret_conv, true);
69578 }
69579
69580 uint64_t  __attribute__((export_name("TS_NetworkGraph_verify_channel_update"))) TS_NetworkGraph_verify_channel_update(uint64_t this_arg, uint64_t msg) {
69581         LDKNetworkGraph this_arg_conv;
69582         this_arg_conv.inner = untag_ptr(this_arg);
69583         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69585         this_arg_conv.is_owned = false;
69586         LDKChannelUpdate msg_conv;
69587         msg_conv.inner = untag_ptr(msg);
69588         msg_conv.is_owned = ptr_is_owned(msg);
69589         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
69590         msg_conv.is_owned = false;
69591         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
69592         *ret_conv = NetworkGraph_verify_channel_update(&this_arg_conv, &msg_conv);
69593         return tag_ptr(ret_conv, true);
69594 }
69595
69596 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_channel"))) TS_ReadOnlyNetworkGraph_channel(uint64_t this_arg, int64_t short_channel_id) {
69597         LDKReadOnlyNetworkGraph this_arg_conv;
69598         this_arg_conv.inner = untag_ptr(this_arg);
69599         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69601         this_arg_conv.is_owned = false;
69602         LDKChannelInfo ret_var = ReadOnlyNetworkGraph_channel(&this_arg_conv, short_channel_id);
69603         uint64_t ret_ref = 0;
69604         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69605         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69606         return ret_ref;
69607 }
69608
69609 int64_tArray  __attribute__((export_name("TS_ReadOnlyNetworkGraph_list_channels"))) TS_ReadOnlyNetworkGraph_list_channels(uint64_t this_arg) {
69610         LDKReadOnlyNetworkGraph this_arg_conv;
69611         this_arg_conv.inner = untag_ptr(this_arg);
69612         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69614         this_arg_conv.is_owned = false;
69615         LDKCVec_u64Z ret_var = ReadOnlyNetworkGraph_list_channels(&this_arg_conv);
69616         int64_tArray ret_arr = NULL;
69617         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
69618         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
69619         for (size_t i = 0; i < ret_var.datalen; i++) {
69620                 int64_t ret_conv_8_conv = ret_var.data[i];
69621                 ret_arr_ptr[i] = ret_conv_8_conv;
69622         }
69623         
69624         FREE(ret_var.data);
69625         return ret_arr;
69626 }
69627
69628 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_node"))) TS_ReadOnlyNetworkGraph_node(uint64_t this_arg, uint64_t node_id) {
69629         LDKReadOnlyNetworkGraph this_arg_conv;
69630         this_arg_conv.inner = untag_ptr(this_arg);
69631         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69633         this_arg_conv.is_owned = false;
69634         LDKNodeId node_id_conv;
69635         node_id_conv.inner = untag_ptr(node_id);
69636         node_id_conv.is_owned = ptr_is_owned(node_id);
69637         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
69638         node_id_conv.is_owned = false;
69639         LDKNodeInfo ret_var = ReadOnlyNetworkGraph_node(&this_arg_conv, &node_id_conv);
69640         uint64_t ret_ref = 0;
69641         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69642         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69643         return ret_ref;
69644 }
69645
69646 uint64_tArray  __attribute__((export_name("TS_ReadOnlyNetworkGraph_list_nodes"))) TS_ReadOnlyNetworkGraph_list_nodes(uint64_t this_arg) {
69647         LDKReadOnlyNetworkGraph this_arg_conv;
69648         this_arg_conv.inner = untag_ptr(this_arg);
69649         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69651         this_arg_conv.is_owned = false;
69652         LDKCVec_NodeIdZ ret_var = ReadOnlyNetworkGraph_list_nodes(&this_arg_conv);
69653         uint64_tArray ret_arr = NULL;
69654         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
69655         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
69656         for (size_t i = 0; i < ret_var.datalen; i++) {
69657                 LDKNodeId ret_conv_8_var = ret_var.data[i];
69658                 uint64_t ret_conv_8_ref = 0;
69659                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_8_var);
69660                 ret_conv_8_ref = tag_ptr(ret_conv_8_var.inner, ret_conv_8_var.is_owned);
69661                 ret_arr_ptr[i] = ret_conv_8_ref;
69662         }
69663         
69664         FREE(ret_var.data);
69665         return ret_arr;
69666 }
69667
69668 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_get_addresses"))) TS_ReadOnlyNetworkGraph_get_addresses(uint64_t this_arg, int8_tArray pubkey) {
69669         LDKReadOnlyNetworkGraph this_arg_conv;
69670         this_arg_conv.inner = untag_ptr(this_arg);
69671         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69673         this_arg_conv.is_owned = false;
69674         LDKPublicKey pubkey_ref;
69675         CHECK(pubkey->arr_len == 33);
69676         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
69677         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
69678         *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
69679         uint64_t ret_ref = tag_ptr(ret_copy, true);
69680         return ret_ref;
69681 }
69682
69683 void  __attribute__((export_name("TS_DefaultRouter_free"))) TS_DefaultRouter_free(uint64_t this_obj) {
69684         LDKDefaultRouter this_obj_conv;
69685         this_obj_conv.inner = untag_ptr(this_obj);
69686         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69688         DefaultRouter_free(this_obj_conv);
69689 }
69690
69691 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) {
69692         LDKNetworkGraph network_graph_conv;
69693         network_graph_conv.inner = untag_ptr(network_graph);
69694         network_graph_conv.is_owned = ptr_is_owned(network_graph);
69695         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
69696         network_graph_conv.is_owned = false;
69697         void* logger_ptr = untag_ptr(logger);
69698         CHECK_ACCESS(logger_ptr);
69699         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
69700         if (logger_conv.free == LDKLogger_JCalls_free) {
69701                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69702                 LDKLogger_JCalls_cloned(&logger_conv);
69703         }
69704         void* entropy_source_ptr = untag_ptr(entropy_source);
69705         CHECK_ACCESS(entropy_source_ptr);
69706         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
69707         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
69708                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69709                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
69710         }
69711         void* scorer_ptr = untag_ptr(scorer);
69712         CHECK_ACCESS(scorer_ptr);
69713         LDKLockableScore scorer_conv = *(LDKLockableScore*)(scorer_ptr);
69714         if (scorer_conv.free == LDKLockableScore_JCalls_free) {
69715                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69716                 LDKLockableScore_JCalls_cloned(&scorer_conv);
69717         }
69718         LDKProbabilisticScoringFeeParameters score_params_conv;
69719         score_params_conv.inner = untag_ptr(score_params);
69720         score_params_conv.is_owned = ptr_is_owned(score_params);
69721         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
69722         score_params_conv = ProbabilisticScoringFeeParameters_clone(&score_params_conv);
69723         LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, entropy_source_conv, scorer_conv, score_params_conv);
69724         uint64_t ret_ref = 0;
69725         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69726         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69727         return ret_ref;
69728 }
69729
69730 uint64_t  __attribute__((export_name("TS_DefaultRouter_as_Router"))) TS_DefaultRouter_as_Router(uint64_t this_arg) {
69731         LDKDefaultRouter this_arg_conv;
69732         this_arg_conv.inner = untag_ptr(this_arg);
69733         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69735         this_arg_conv.is_owned = false;
69736         LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
69737         *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
69738         return tag_ptr(ret_ret, true);
69739 }
69740
69741 uint64_t  __attribute__((export_name("TS_DefaultRouter_as_MessageRouter"))) TS_DefaultRouter_as_MessageRouter(uint64_t this_arg) {
69742         LDKDefaultRouter this_arg_conv;
69743         this_arg_conv.inner = untag_ptr(this_arg);
69744         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69746         this_arg_conv.is_owned = false;
69747         LDKMessageRouter* ret_ret = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
69748         *ret_ret = DefaultRouter_as_MessageRouter(&this_arg_conv);
69749         return tag_ptr(ret_ret, true);
69750 }
69751
69752 void  __attribute__((export_name("TS_Router_free"))) TS_Router_free(uint64_t this_ptr) {
69753         if (!ptr_is_owned(this_ptr)) return;
69754         void* this_ptr_ptr = untag_ptr(this_ptr);
69755         CHECK_ACCESS(this_ptr_ptr);
69756         LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
69757         FREE(untag_ptr(this_ptr));
69758         Router_free(this_ptr_conv);
69759 }
69760
69761 void  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_free"))) TS_ScorerAccountingForInFlightHtlcs_free(uint64_t this_obj) {
69762         LDKScorerAccountingForInFlightHtlcs this_obj_conv;
69763         this_obj_conv.inner = untag_ptr(this_obj);
69764         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69766         ScorerAccountingForInFlightHtlcs_free(this_obj_conv);
69767 }
69768
69769 uint64_t  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_new"))) TS_ScorerAccountingForInFlightHtlcs_new(uint64_t scorer, uint64_t inflight_htlcs) {
69770         void* scorer_ptr = untag_ptr(scorer);
69771         CHECK_ACCESS(scorer_ptr);
69772         LDKScoreLookUp scorer_conv = *(LDKScoreLookUp*)(scorer_ptr);
69773         if (scorer_conv.free == LDKScoreLookUp_JCalls_free) {
69774                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69775                 LDKScoreLookUp_JCalls_cloned(&scorer_conv);
69776         }
69777         LDKInFlightHtlcs inflight_htlcs_conv;
69778         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
69779         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
69780         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
69781         inflight_htlcs_conv.is_owned = false;
69782         LDKScorerAccountingForInFlightHtlcs ret_var = ScorerAccountingForInFlightHtlcs_new(scorer_conv, &inflight_htlcs_conv);
69783         uint64_t ret_ref = 0;
69784         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69785         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69786         return ret_ref;
69787 }
69788
69789 uint64_t  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_as_ScoreLookUp"))) TS_ScorerAccountingForInFlightHtlcs_as_ScoreLookUp(uint64_t this_arg) {
69790         LDKScorerAccountingForInFlightHtlcs this_arg_conv;
69791         this_arg_conv.inner = untag_ptr(this_arg);
69792         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69794         this_arg_conv.is_owned = false;
69795         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
69796         *ret_ret = ScorerAccountingForInFlightHtlcs_as_ScoreLookUp(&this_arg_conv);
69797         return tag_ptr(ret_ret, true);
69798 }
69799
69800 void  __attribute__((export_name("TS_InFlightHtlcs_free"))) TS_InFlightHtlcs_free(uint64_t this_obj) {
69801         LDKInFlightHtlcs this_obj_conv;
69802         this_obj_conv.inner = untag_ptr(this_obj);
69803         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69805         InFlightHtlcs_free(this_obj_conv);
69806 }
69807
69808 static inline uint64_t InFlightHtlcs_clone_ptr(LDKInFlightHtlcs *NONNULL_PTR arg) {
69809         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(arg);
69810         uint64_t ret_ref = 0;
69811         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69812         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69813         return ret_ref;
69814 }
69815 int64_t  __attribute__((export_name("TS_InFlightHtlcs_clone_ptr"))) TS_InFlightHtlcs_clone_ptr(uint64_t arg) {
69816         LDKInFlightHtlcs arg_conv;
69817         arg_conv.inner = untag_ptr(arg);
69818         arg_conv.is_owned = ptr_is_owned(arg);
69819         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69820         arg_conv.is_owned = false;
69821         int64_t ret_conv = InFlightHtlcs_clone_ptr(&arg_conv);
69822         return ret_conv;
69823 }
69824
69825 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_clone"))) TS_InFlightHtlcs_clone(uint64_t orig) {
69826         LDKInFlightHtlcs orig_conv;
69827         orig_conv.inner = untag_ptr(orig);
69828         orig_conv.is_owned = ptr_is_owned(orig);
69829         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69830         orig_conv.is_owned = false;
69831         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(&orig_conv);
69832         uint64_t ret_ref = 0;
69833         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69834         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69835         return ret_ref;
69836 }
69837
69838 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_new"))) TS_InFlightHtlcs_new() {
69839         LDKInFlightHtlcs ret_var = InFlightHtlcs_new();
69840         uint64_t ret_ref = 0;
69841         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69842         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69843         return ret_ref;
69844 }
69845
69846 void  __attribute__((export_name("TS_InFlightHtlcs_process_path"))) TS_InFlightHtlcs_process_path(uint64_t this_arg, uint64_t path, int8_tArray payer_node_id) {
69847         LDKInFlightHtlcs this_arg_conv;
69848         this_arg_conv.inner = untag_ptr(this_arg);
69849         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69851         this_arg_conv.is_owned = false;
69852         LDKPath path_conv;
69853         path_conv.inner = untag_ptr(path);
69854         path_conv.is_owned = ptr_is_owned(path);
69855         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
69856         path_conv.is_owned = false;
69857         LDKPublicKey payer_node_id_ref;
69858         CHECK(payer_node_id->arr_len == 33);
69859         memcpy(payer_node_id_ref.compressed_form, payer_node_id->elems, 33); FREE(payer_node_id);
69860         InFlightHtlcs_process_path(&this_arg_conv, &path_conv, payer_node_id_ref);
69861 }
69862
69863 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) {
69864         LDKInFlightHtlcs this_arg_conv;
69865         this_arg_conv.inner = untag_ptr(this_arg);
69866         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69868         this_arg_conv.is_owned = false;
69869         LDKNodeId source_conv;
69870         source_conv.inner = untag_ptr(source);
69871         source_conv.is_owned = ptr_is_owned(source);
69872         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
69873         source_conv.is_owned = false;
69874         LDKNodeId target_conv;
69875         target_conv.inner = untag_ptr(target);
69876         target_conv.is_owned = ptr_is_owned(target);
69877         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
69878         target_conv.is_owned = false;
69879         InFlightHtlcs_add_inflight_htlc(&this_arg_conv, &source_conv, &target_conv, channel_scid, used_msat);
69880 }
69881
69882 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) {
69883         LDKInFlightHtlcs this_arg_conv;
69884         this_arg_conv.inner = untag_ptr(this_arg);
69885         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69887         this_arg_conv.is_owned = false;
69888         LDKNodeId source_conv;
69889         source_conv.inner = untag_ptr(source);
69890         source_conv.is_owned = ptr_is_owned(source);
69891         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
69892         source_conv.is_owned = false;
69893         LDKNodeId target_conv;
69894         target_conv.inner = untag_ptr(target);
69895         target_conv.is_owned = ptr_is_owned(target);
69896         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
69897         target_conv.is_owned = false;
69898         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
69899         *ret_copy = InFlightHtlcs_used_liquidity_msat(&this_arg_conv, &source_conv, &target_conv, channel_scid);
69900         uint64_t ret_ref = tag_ptr(ret_copy, true);
69901         return ret_ref;
69902 }
69903
69904 int8_tArray  __attribute__((export_name("TS_InFlightHtlcs_write"))) TS_InFlightHtlcs_write(uint64_t obj) {
69905         LDKInFlightHtlcs obj_conv;
69906         obj_conv.inner = untag_ptr(obj);
69907         obj_conv.is_owned = ptr_is_owned(obj);
69908         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
69909         obj_conv.is_owned = false;
69910         LDKCVec_u8Z ret_var = InFlightHtlcs_write(&obj_conv);
69911         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
69912         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
69913         CVec_u8Z_free(ret_var);
69914         return ret_arr;
69915 }
69916
69917 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_read"))) TS_InFlightHtlcs_read(int8_tArray ser) {
69918         LDKu8slice ser_ref;
69919         ser_ref.datalen = ser->arr_len;
69920         ser_ref.data = ser->elems;
69921         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
69922         *ret_conv = InFlightHtlcs_read(ser_ref);
69923         FREE(ser);
69924         return tag_ptr(ret_conv, true);
69925 }
69926
69927 void  __attribute__((export_name("TS_RouteHop_free"))) TS_RouteHop_free(uint64_t this_obj) {
69928         LDKRouteHop this_obj_conv;
69929         this_obj_conv.inner = untag_ptr(this_obj);
69930         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69932         RouteHop_free(this_obj_conv);
69933 }
69934
69935 int8_tArray  __attribute__((export_name("TS_RouteHop_get_pubkey"))) TS_RouteHop_get_pubkey(uint64_t this_ptr) {
69936         LDKRouteHop this_ptr_conv;
69937         this_ptr_conv.inner = untag_ptr(this_ptr);
69938         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69940         this_ptr_conv.is_owned = false;
69941         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
69942         memcpy(ret_arr->elems, RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
69943         return ret_arr;
69944 }
69945
69946 void  __attribute__((export_name("TS_RouteHop_set_pubkey"))) TS_RouteHop_set_pubkey(uint64_t this_ptr, int8_tArray val) {
69947         LDKRouteHop this_ptr_conv;
69948         this_ptr_conv.inner = untag_ptr(this_ptr);
69949         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69951         this_ptr_conv.is_owned = false;
69952         LDKPublicKey val_ref;
69953         CHECK(val->arr_len == 33);
69954         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
69955         RouteHop_set_pubkey(&this_ptr_conv, val_ref);
69956 }
69957
69958 uint64_t  __attribute__((export_name("TS_RouteHop_get_node_features"))) TS_RouteHop_get_node_features(uint64_t this_ptr) {
69959         LDKRouteHop this_ptr_conv;
69960         this_ptr_conv.inner = untag_ptr(this_ptr);
69961         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69963         this_ptr_conv.is_owned = false;
69964         LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
69965         uint64_t ret_ref = 0;
69966         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69967         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69968         return ret_ref;
69969 }
69970
69971 void  __attribute__((export_name("TS_RouteHop_set_node_features"))) TS_RouteHop_set_node_features(uint64_t this_ptr, uint64_t val) {
69972         LDKRouteHop this_ptr_conv;
69973         this_ptr_conv.inner = untag_ptr(this_ptr);
69974         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69976         this_ptr_conv.is_owned = false;
69977         LDKNodeFeatures val_conv;
69978         val_conv.inner = untag_ptr(val);
69979         val_conv.is_owned = ptr_is_owned(val);
69980         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
69981         val_conv = NodeFeatures_clone(&val_conv);
69982         RouteHop_set_node_features(&this_ptr_conv, val_conv);
69983 }
69984
69985 int64_t  __attribute__((export_name("TS_RouteHop_get_short_channel_id"))) TS_RouteHop_get_short_channel_id(uint64_t this_ptr) {
69986         LDKRouteHop this_ptr_conv;
69987         this_ptr_conv.inner = untag_ptr(this_ptr);
69988         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69990         this_ptr_conv.is_owned = false;
69991         int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
69992         return ret_conv;
69993 }
69994
69995 void  __attribute__((export_name("TS_RouteHop_set_short_channel_id"))) TS_RouteHop_set_short_channel_id(uint64_t this_ptr, int64_t val) {
69996         LDKRouteHop this_ptr_conv;
69997         this_ptr_conv.inner = untag_ptr(this_ptr);
69998         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70000         this_ptr_conv.is_owned = false;
70001         RouteHop_set_short_channel_id(&this_ptr_conv, val);
70002 }
70003
70004 uint64_t  __attribute__((export_name("TS_RouteHop_get_channel_features"))) TS_RouteHop_get_channel_features(uint64_t this_ptr) {
70005         LDKRouteHop this_ptr_conv;
70006         this_ptr_conv.inner = untag_ptr(this_ptr);
70007         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70009         this_ptr_conv.is_owned = false;
70010         LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
70011         uint64_t ret_ref = 0;
70012         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70013         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70014         return ret_ref;
70015 }
70016
70017 void  __attribute__((export_name("TS_RouteHop_set_channel_features"))) TS_RouteHop_set_channel_features(uint64_t this_ptr, uint64_t val) {
70018         LDKRouteHop this_ptr_conv;
70019         this_ptr_conv.inner = untag_ptr(this_ptr);
70020         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70022         this_ptr_conv.is_owned = false;
70023         LDKChannelFeatures val_conv;
70024         val_conv.inner = untag_ptr(val);
70025         val_conv.is_owned = ptr_is_owned(val);
70026         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
70027         val_conv = ChannelFeatures_clone(&val_conv);
70028         RouteHop_set_channel_features(&this_ptr_conv, val_conv);
70029 }
70030
70031 int64_t  __attribute__((export_name("TS_RouteHop_get_fee_msat"))) TS_RouteHop_get_fee_msat(uint64_t this_ptr) {
70032         LDKRouteHop this_ptr_conv;
70033         this_ptr_conv.inner = untag_ptr(this_ptr);
70034         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70036         this_ptr_conv.is_owned = false;
70037         int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
70038         return ret_conv;
70039 }
70040
70041 void  __attribute__((export_name("TS_RouteHop_set_fee_msat"))) TS_RouteHop_set_fee_msat(uint64_t this_ptr, int64_t val) {
70042         LDKRouteHop this_ptr_conv;
70043         this_ptr_conv.inner = untag_ptr(this_ptr);
70044         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70046         this_ptr_conv.is_owned = false;
70047         RouteHop_set_fee_msat(&this_ptr_conv, val);
70048 }
70049
70050 int32_t  __attribute__((export_name("TS_RouteHop_get_cltv_expiry_delta"))) TS_RouteHop_get_cltv_expiry_delta(uint64_t this_ptr) {
70051         LDKRouteHop this_ptr_conv;
70052         this_ptr_conv.inner = untag_ptr(this_ptr);
70053         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70055         this_ptr_conv.is_owned = false;
70056         int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
70057         return ret_conv;
70058 }
70059
70060 void  __attribute__((export_name("TS_RouteHop_set_cltv_expiry_delta"))) TS_RouteHop_set_cltv_expiry_delta(uint64_t this_ptr, int32_t val) {
70061         LDKRouteHop this_ptr_conv;
70062         this_ptr_conv.inner = untag_ptr(this_ptr);
70063         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70065         this_ptr_conv.is_owned = false;
70066         RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
70067 }
70068
70069 jboolean  __attribute__((export_name("TS_RouteHop_get_maybe_announced_channel"))) TS_RouteHop_get_maybe_announced_channel(uint64_t this_ptr) {
70070         LDKRouteHop this_ptr_conv;
70071         this_ptr_conv.inner = untag_ptr(this_ptr);
70072         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70074         this_ptr_conv.is_owned = false;
70075         jboolean ret_conv = RouteHop_get_maybe_announced_channel(&this_ptr_conv);
70076         return ret_conv;
70077 }
70078
70079 void  __attribute__((export_name("TS_RouteHop_set_maybe_announced_channel"))) TS_RouteHop_set_maybe_announced_channel(uint64_t this_ptr, jboolean val) {
70080         LDKRouteHop this_ptr_conv;
70081         this_ptr_conv.inner = untag_ptr(this_ptr);
70082         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70084         this_ptr_conv.is_owned = false;
70085         RouteHop_set_maybe_announced_channel(&this_ptr_conv, val);
70086 }
70087
70088 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) {
70089         LDKPublicKey pubkey_arg_ref;
70090         CHECK(pubkey_arg->arr_len == 33);
70091         memcpy(pubkey_arg_ref.compressed_form, pubkey_arg->elems, 33); FREE(pubkey_arg);
70092         LDKNodeFeatures node_features_arg_conv;
70093         node_features_arg_conv.inner = untag_ptr(node_features_arg);
70094         node_features_arg_conv.is_owned = ptr_is_owned(node_features_arg);
70095         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
70096         node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
70097         LDKChannelFeatures channel_features_arg_conv;
70098         channel_features_arg_conv.inner = untag_ptr(channel_features_arg);
70099         channel_features_arg_conv.is_owned = ptr_is_owned(channel_features_arg);
70100         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
70101         channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
70102         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);
70103         uint64_t ret_ref = 0;
70104         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70105         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70106         return ret_ref;
70107 }
70108
70109 static inline uint64_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
70110         LDKRouteHop ret_var = RouteHop_clone(arg);
70111         uint64_t ret_ref = 0;
70112         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70113         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70114         return ret_ref;
70115 }
70116 int64_t  __attribute__((export_name("TS_RouteHop_clone_ptr"))) TS_RouteHop_clone_ptr(uint64_t arg) {
70117         LDKRouteHop arg_conv;
70118         arg_conv.inner = untag_ptr(arg);
70119         arg_conv.is_owned = ptr_is_owned(arg);
70120         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70121         arg_conv.is_owned = false;
70122         int64_t ret_conv = RouteHop_clone_ptr(&arg_conv);
70123         return ret_conv;
70124 }
70125
70126 uint64_t  __attribute__((export_name("TS_RouteHop_clone"))) TS_RouteHop_clone(uint64_t orig) {
70127         LDKRouteHop orig_conv;
70128         orig_conv.inner = untag_ptr(orig);
70129         orig_conv.is_owned = ptr_is_owned(orig);
70130         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70131         orig_conv.is_owned = false;
70132         LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
70133         uint64_t ret_ref = 0;
70134         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70135         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70136         return ret_ref;
70137 }
70138
70139 int64_t  __attribute__((export_name("TS_RouteHop_hash"))) TS_RouteHop_hash(uint64_t o) {
70140         LDKRouteHop o_conv;
70141         o_conv.inner = untag_ptr(o);
70142         o_conv.is_owned = ptr_is_owned(o);
70143         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
70144         o_conv.is_owned = false;
70145         int64_t ret_conv = RouteHop_hash(&o_conv);
70146         return ret_conv;
70147 }
70148
70149 jboolean  __attribute__((export_name("TS_RouteHop_eq"))) TS_RouteHop_eq(uint64_t a, uint64_t b) {
70150         LDKRouteHop a_conv;
70151         a_conv.inner = untag_ptr(a);
70152         a_conv.is_owned = ptr_is_owned(a);
70153         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70154         a_conv.is_owned = false;
70155         LDKRouteHop b_conv;
70156         b_conv.inner = untag_ptr(b);
70157         b_conv.is_owned = ptr_is_owned(b);
70158         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
70159         b_conv.is_owned = false;
70160         jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
70161         return ret_conv;
70162 }
70163
70164 int8_tArray  __attribute__((export_name("TS_RouteHop_write"))) TS_RouteHop_write(uint64_t obj) {
70165         LDKRouteHop obj_conv;
70166         obj_conv.inner = untag_ptr(obj);
70167         obj_conv.is_owned = ptr_is_owned(obj);
70168         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70169         obj_conv.is_owned = false;
70170         LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
70171         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
70172         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
70173         CVec_u8Z_free(ret_var);
70174         return ret_arr;
70175 }
70176
70177 uint64_t  __attribute__((export_name("TS_RouteHop_read"))) TS_RouteHop_read(int8_tArray ser) {
70178         LDKu8slice ser_ref;
70179         ser_ref.datalen = ser->arr_len;
70180         ser_ref.data = ser->elems;
70181         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
70182         *ret_conv = RouteHop_read(ser_ref);
70183         FREE(ser);
70184         return tag_ptr(ret_conv, true);
70185 }
70186
70187 void  __attribute__((export_name("TS_BlindedTail_free"))) TS_BlindedTail_free(uint64_t this_obj) {
70188         LDKBlindedTail this_obj_conv;
70189         this_obj_conv.inner = untag_ptr(this_obj);
70190         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70192         BlindedTail_free(this_obj_conv);
70193 }
70194
70195 uint64_tArray  __attribute__((export_name("TS_BlindedTail_get_hops"))) TS_BlindedTail_get_hops(uint64_t this_ptr) {
70196         LDKBlindedTail this_ptr_conv;
70197         this_ptr_conv.inner = untag_ptr(this_ptr);
70198         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70200         this_ptr_conv.is_owned = false;
70201         LDKCVec_BlindedHopZ ret_var = BlindedTail_get_hops(&this_ptr_conv);
70202         uint64_tArray ret_arr = NULL;
70203         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
70204         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
70205         for (size_t m = 0; m < ret_var.datalen; m++) {
70206                 LDKBlindedHop ret_conv_12_var = ret_var.data[m];
70207                 uint64_t ret_conv_12_ref = 0;
70208                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_var);
70209                 ret_conv_12_ref = tag_ptr(ret_conv_12_var.inner, ret_conv_12_var.is_owned);
70210                 ret_arr_ptr[m] = ret_conv_12_ref;
70211         }
70212         
70213         FREE(ret_var.data);
70214         return ret_arr;
70215 }
70216
70217 void  __attribute__((export_name("TS_BlindedTail_set_hops"))) TS_BlindedTail_set_hops(uint64_t this_ptr, uint64_tArray val) {
70218         LDKBlindedTail this_ptr_conv;
70219         this_ptr_conv.inner = untag_ptr(this_ptr);
70220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70222         this_ptr_conv.is_owned = false;
70223         LDKCVec_BlindedHopZ val_constr;
70224         val_constr.datalen = val->arr_len;
70225         if (val_constr.datalen > 0)
70226                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
70227         else
70228                 val_constr.data = NULL;
70229         uint64_t* val_vals = val->elems;
70230         for (size_t m = 0; m < val_constr.datalen; m++) {
70231                 uint64_t val_conv_12 = val_vals[m];
70232                 LDKBlindedHop val_conv_12_conv;
70233                 val_conv_12_conv.inner = untag_ptr(val_conv_12);
70234                 val_conv_12_conv.is_owned = ptr_is_owned(val_conv_12);
70235                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv);
70236                 val_conv_12_conv = BlindedHop_clone(&val_conv_12_conv);
70237                 val_constr.data[m] = val_conv_12_conv;
70238         }
70239         FREE(val);
70240         BlindedTail_set_hops(&this_ptr_conv, val_constr);
70241 }
70242
70243 int8_tArray  __attribute__((export_name("TS_BlindedTail_get_blinding_point"))) TS_BlindedTail_get_blinding_point(uint64_t this_ptr) {
70244         LDKBlindedTail this_ptr_conv;
70245         this_ptr_conv.inner = untag_ptr(this_ptr);
70246         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70248         this_ptr_conv.is_owned = false;
70249         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
70250         memcpy(ret_arr->elems, BlindedTail_get_blinding_point(&this_ptr_conv).compressed_form, 33);
70251         return ret_arr;
70252 }
70253
70254 void  __attribute__((export_name("TS_BlindedTail_set_blinding_point"))) TS_BlindedTail_set_blinding_point(uint64_t this_ptr, int8_tArray val) {
70255         LDKBlindedTail this_ptr_conv;
70256         this_ptr_conv.inner = untag_ptr(this_ptr);
70257         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70259         this_ptr_conv.is_owned = false;
70260         LDKPublicKey val_ref;
70261         CHECK(val->arr_len == 33);
70262         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
70263         BlindedTail_set_blinding_point(&this_ptr_conv, val_ref);
70264 }
70265
70266 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) {
70267         LDKBlindedTail this_ptr_conv;
70268         this_ptr_conv.inner = untag_ptr(this_ptr);
70269         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70271         this_ptr_conv.is_owned = false;
70272         int32_t ret_conv = BlindedTail_get_excess_final_cltv_expiry_delta(&this_ptr_conv);
70273         return ret_conv;
70274 }
70275
70276 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) {
70277         LDKBlindedTail this_ptr_conv;
70278         this_ptr_conv.inner = untag_ptr(this_ptr);
70279         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70281         this_ptr_conv.is_owned = false;
70282         BlindedTail_set_excess_final_cltv_expiry_delta(&this_ptr_conv, val);
70283 }
70284
70285 int64_t  __attribute__((export_name("TS_BlindedTail_get_final_value_msat"))) TS_BlindedTail_get_final_value_msat(uint64_t this_ptr) {
70286         LDKBlindedTail this_ptr_conv;
70287         this_ptr_conv.inner = untag_ptr(this_ptr);
70288         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70290         this_ptr_conv.is_owned = false;
70291         int64_t ret_conv = BlindedTail_get_final_value_msat(&this_ptr_conv);
70292         return ret_conv;
70293 }
70294
70295 void  __attribute__((export_name("TS_BlindedTail_set_final_value_msat"))) TS_BlindedTail_set_final_value_msat(uint64_t this_ptr, int64_t val) {
70296         LDKBlindedTail this_ptr_conv;
70297         this_ptr_conv.inner = untag_ptr(this_ptr);
70298         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70300         this_ptr_conv.is_owned = false;
70301         BlindedTail_set_final_value_msat(&this_ptr_conv, val);
70302 }
70303
70304 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) {
70305         LDKCVec_BlindedHopZ hops_arg_constr;
70306         hops_arg_constr.datalen = hops_arg->arr_len;
70307         if (hops_arg_constr.datalen > 0)
70308                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
70309         else
70310                 hops_arg_constr.data = NULL;
70311         uint64_t* hops_arg_vals = hops_arg->elems;
70312         for (size_t m = 0; m < hops_arg_constr.datalen; m++) {
70313                 uint64_t hops_arg_conv_12 = hops_arg_vals[m];
70314                 LDKBlindedHop hops_arg_conv_12_conv;
70315                 hops_arg_conv_12_conv.inner = untag_ptr(hops_arg_conv_12);
70316                 hops_arg_conv_12_conv.is_owned = ptr_is_owned(hops_arg_conv_12);
70317                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_12_conv);
70318                 hops_arg_conv_12_conv = BlindedHop_clone(&hops_arg_conv_12_conv);
70319                 hops_arg_constr.data[m] = hops_arg_conv_12_conv;
70320         }
70321         FREE(hops_arg);
70322         LDKPublicKey blinding_point_arg_ref;
70323         CHECK(blinding_point_arg->arr_len == 33);
70324         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
70325         LDKBlindedTail ret_var = BlindedTail_new(hops_arg_constr, blinding_point_arg_ref, excess_final_cltv_expiry_delta_arg, final_value_msat_arg);
70326         uint64_t ret_ref = 0;
70327         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70328         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70329         return ret_ref;
70330 }
70331
70332 static inline uint64_t BlindedTail_clone_ptr(LDKBlindedTail *NONNULL_PTR arg) {
70333         LDKBlindedTail ret_var = BlindedTail_clone(arg);
70334         uint64_t ret_ref = 0;
70335         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70336         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70337         return ret_ref;
70338 }
70339 int64_t  __attribute__((export_name("TS_BlindedTail_clone_ptr"))) TS_BlindedTail_clone_ptr(uint64_t arg) {
70340         LDKBlindedTail arg_conv;
70341         arg_conv.inner = untag_ptr(arg);
70342         arg_conv.is_owned = ptr_is_owned(arg);
70343         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70344         arg_conv.is_owned = false;
70345         int64_t ret_conv = BlindedTail_clone_ptr(&arg_conv);
70346         return ret_conv;
70347 }
70348
70349 uint64_t  __attribute__((export_name("TS_BlindedTail_clone"))) TS_BlindedTail_clone(uint64_t orig) {
70350         LDKBlindedTail orig_conv;
70351         orig_conv.inner = untag_ptr(orig);
70352         orig_conv.is_owned = ptr_is_owned(orig);
70353         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70354         orig_conv.is_owned = false;
70355         LDKBlindedTail ret_var = BlindedTail_clone(&orig_conv);
70356         uint64_t ret_ref = 0;
70357         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70358         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70359         return ret_ref;
70360 }
70361
70362 int64_t  __attribute__((export_name("TS_BlindedTail_hash"))) TS_BlindedTail_hash(uint64_t o) {
70363         LDKBlindedTail o_conv;
70364         o_conv.inner = untag_ptr(o);
70365         o_conv.is_owned = ptr_is_owned(o);
70366         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
70367         o_conv.is_owned = false;
70368         int64_t ret_conv = BlindedTail_hash(&o_conv);
70369         return ret_conv;
70370 }
70371
70372 jboolean  __attribute__((export_name("TS_BlindedTail_eq"))) TS_BlindedTail_eq(uint64_t a, uint64_t b) {
70373         LDKBlindedTail a_conv;
70374         a_conv.inner = untag_ptr(a);
70375         a_conv.is_owned = ptr_is_owned(a);
70376         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70377         a_conv.is_owned = false;
70378         LDKBlindedTail b_conv;
70379         b_conv.inner = untag_ptr(b);
70380         b_conv.is_owned = ptr_is_owned(b);
70381         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
70382         b_conv.is_owned = false;
70383         jboolean ret_conv = BlindedTail_eq(&a_conv, &b_conv);
70384         return ret_conv;
70385 }
70386
70387 int8_tArray  __attribute__((export_name("TS_BlindedTail_write"))) TS_BlindedTail_write(uint64_t obj) {
70388         LDKBlindedTail obj_conv;
70389         obj_conv.inner = untag_ptr(obj);
70390         obj_conv.is_owned = ptr_is_owned(obj);
70391         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70392         obj_conv.is_owned = false;
70393         LDKCVec_u8Z ret_var = BlindedTail_write(&obj_conv);
70394         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
70395         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
70396         CVec_u8Z_free(ret_var);
70397         return ret_arr;
70398 }
70399
70400 uint64_t  __attribute__((export_name("TS_BlindedTail_read"))) TS_BlindedTail_read(int8_tArray ser) {
70401         LDKu8slice ser_ref;
70402         ser_ref.datalen = ser->arr_len;
70403         ser_ref.data = ser->elems;
70404         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
70405         *ret_conv = BlindedTail_read(ser_ref);
70406         FREE(ser);
70407         return tag_ptr(ret_conv, true);
70408 }
70409
70410 void  __attribute__((export_name("TS_Path_free"))) TS_Path_free(uint64_t this_obj) {
70411         LDKPath this_obj_conv;
70412         this_obj_conv.inner = untag_ptr(this_obj);
70413         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70415         Path_free(this_obj_conv);
70416 }
70417
70418 uint64_tArray  __attribute__((export_name("TS_Path_get_hops"))) TS_Path_get_hops(uint64_t this_ptr) {
70419         LDKPath this_ptr_conv;
70420         this_ptr_conv.inner = untag_ptr(this_ptr);
70421         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70423         this_ptr_conv.is_owned = false;
70424         LDKCVec_RouteHopZ ret_var = Path_get_hops(&this_ptr_conv);
70425         uint64_tArray ret_arr = NULL;
70426         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
70427         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
70428         for (size_t k = 0; k < ret_var.datalen; k++) {
70429                 LDKRouteHop ret_conv_10_var = ret_var.data[k];
70430                 uint64_t ret_conv_10_ref = 0;
70431                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
70432                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
70433                 ret_arr_ptr[k] = ret_conv_10_ref;
70434         }
70435         
70436         FREE(ret_var.data);
70437         return ret_arr;
70438 }
70439
70440 void  __attribute__((export_name("TS_Path_set_hops"))) TS_Path_set_hops(uint64_t this_ptr, uint64_tArray val) {
70441         LDKPath this_ptr_conv;
70442         this_ptr_conv.inner = untag_ptr(this_ptr);
70443         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70445         this_ptr_conv.is_owned = false;
70446         LDKCVec_RouteHopZ val_constr;
70447         val_constr.datalen = val->arr_len;
70448         if (val_constr.datalen > 0)
70449                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
70450         else
70451                 val_constr.data = NULL;
70452         uint64_t* val_vals = val->elems;
70453         for (size_t k = 0; k < val_constr.datalen; k++) {
70454                 uint64_t val_conv_10 = val_vals[k];
70455                 LDKRouteHop val_conv_10_conv;
70456                 val_conv_10_conv.inner = untag_ptr(val_conv_10);
70457                 val_conv_10_conv.is_owned = ptr_is_owned(val_conv_10);
70458                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_10_conv);
70459                 val_conv_10_conv = RouteHop_clone(&val_conv_10_conv);
70460                 val_constr.data[k] = val_conv_10_conv;
70461         }
70462         FREE(val);
70463         Path_set_hops(&this_ptr_conv, val_constr);
70464 }
70465
70466 uint64_t  __attribute__((export_name("TS_Path_get_blinded_tail"))) TS_Path_get_blinded_tail(uint64_t this_ptr) {
70467         LDKPath this_ptr_conv;
70468         this_ptr_conv.inner = untag_ptr(this_ptr);
70469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70471         this_ptr_conv.is_owned = false;
70472         LDKBlindedTail ret_var = Path_get_blinded_tail(&this_ptr_conv);
70473         uint64_t ret_ref = 0;
70474         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70475         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70476         return ret_ref;
70477 }
70478
70479 void  __attribute__((export_name("TS_Path_set_blinded_tail"))) TS_Path_set_blinded_tail(uint64_t this_ptr, uint64_t val) {
70480         LDKPath this_ptr_conv;
70481         this_ptr_conv.inner = untag_ptr(this_ptr);
70482         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70484         this_ptr_conv.is_owned = false;
70485         LDKBlindedTail val_conv;
70486         val_conv.inner = untag_ptr(val);
70487         val_conv.is_owned = ptr_is_owned(val);
70488         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
70489         val_conv = BlindedTail_clone(&val_conv);
70490         Path_set_blinded_tail(&this_ptr_conv, val_conv);
70491 }
70492
70493 uint64_t  __attribute__((export_name("TS_Path_new"))) TS_Path_new(uint64_tArray hops_arg, uint64_t blinded_tail_arg) {
70494         LDKCVec_RouteHopZ hops_arg_constr;
70495         hops_arg_constr.datalen = hops_arg->arr_len;
70496         if (hops_arg_constr.datalen > 0)
70497                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
70498         else
70499                 hops_arg_constr.data = NULL;
70500         uint64_t* hops_arg_vals = hops_arg->elems;
70501         for (size_t k = 0; k < hops_arg_constr.datalen; k++) {
70502                 uint64_t hops_arg_conv_10 = hops_arg_vals[k];
70503                 LDKRouteHop hops_arg_conv_10_conv;
70504                 hops_arg_conv_10_conv.inner = untag_ptr(hops_arg_conv_10);
70505                 hops_arg_conv_10_conv.is_owned = ptr_is_owned(hops_arg_conv_10);
70506                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_10_conv);
70507                 hops_arg_conv_10_conv = RouteHop_clone(&hops_arg_conv_10_conv);
70508                 hops_arg_constr.data[k] = hops_arg_conv_10_conv;
70509         }
70510         FREE(hops_arg);
70511         LDKBlindedTail blinded_tail_arg_conv;
70512         blinded_tail_arg_conv.inner = untag_ptr(blinded_tail_arg);
70513         blinded_tail_arg_conv.is_owned = ptr_is_owned(blinded_tail_arg);
70514         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_tail_arg_conv);
70515         blinded_tail_arg_conv = BlindedTail_clone(&blinded_tail_arg_conv);
70516         LDKPath ret_var = Path_new(hops_arg_constr, blinded_tail_arg_conv);
70517         uint64_t ret_ref = 0;
70518         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70519         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70520         return ret_ref;
70521 }
70522
70523 static inline uint64_t Path_clone_ptr(LDKPath *NONNULL_PTR arg) {
70524         LDKPath ret_var = Path_clone(arg);
70525         uint64_t ret_ref = 0;
70526         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70527         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70528         return ret_ref;
70529 }
70530 int64_t  __attribute__((export_name("TS_Path_clone_ptr"))) TS_Path_clone_ptr(uint64_t arg) {
70531         LDKPath arg_conv;
70532         arg_conv.inner = untag_ptr(arg);
70533         arg_conv.is_owned = ptr_is_owned(arg);
70534         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70535         arg_conv.is_owned = false;
70536         int64_t ret_conv = Path_clone_ptr(&arg_conv);
70537         return ret_conv;
70538 }
70539
70540 uint64_t  __attribute__((export_name("TS_Path_clone"))) TS_Path_clone(uint64_t orig) {
70541         LDKPath orig_conv;
70542         orig_conv.inner = untag_ptr(orig);
70543         orig_conv.is_owned = ptr_is_owned(orig);
70544         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70545         orig_conv.is_owned = false;
70546         LDKPath ret_var = Path_clone(&orig_conv);
70547         uint64_t ret_ref = 0;
70548         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70549         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70550         return ret_ref;
70551 }
70552
70553 int64_t  __attribute__((export_name("TS_Path_hash"))) TS_Path_hash(uint64_t o) {
70554         LDKPath 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         int64_t ret_conv = Path_hash(&o_conv);
70560         return ret_conv;
70561 }
70562
70563 jboolean  __attribute__((export_name("TS_Path_eq"))) TS_Path_eq(uint64_t a, uint64_t b) {
70564         LDKPath a_conv;
70565         a_conv.inner = untag_ptr(a);
70566         a_conv.is_owned = ptr_is_owned(a);
70567         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70568         a_conv.is_owned = false;
70569         LDKPath b_conv;
70570         b_conv.inner = untag_ptr(b);
70571         b_conv.is_owned = ptr_is_owned(b);
70572         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
70573         b_conv.is_owned = false;
70574         jboolean ret_conv = Path_eq(&a_conv, &b_conv);
70575         return ret_conv;
70576 }
70577
70578 int64_t  __attribute__((export_name("TS_Path_fee_msat"))) TS_Path_fee_msat(uint64_t this_arg) {
70579         LDKPath this_arg_conv;
70580         this_arg_conv.inner = untag_ptr(this_arg);
70581         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70583         this_arg_conv.is_owned = false;
70584         int64_t ret_conv = Path_fee_msat(&this_arg_conv);
70585         return ret_conv;
70586 }
70587
70588 int64_t  __attribute__((export_name("TS_Path_final_value_msat"))) TS_Path_final_value_msat(uint64_t this_arg) {
70589         LDKPath this_arg_conv;
70590         this_arg_conv.inner = untag_ptr(this_arg);
70591         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70593         this_arg_conv.is_owned = false;
70594         int64_t ret_conv = Path_final_value_msat(&this_arg_conv);
70595         return ret_conv;
70596 }
70597
70598 uint64_t  __attribute__((export_name("TS_Path_final_cltv_expiry_delta"))) TS_Path_final_cltv_expiry_delta(uint64_t this_arg) {
70599         LDKPath this_arg_conv;
70600         this_arg_conv.inner = untag_ptr(this_arg);
70601         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70603         this_arg_conv.is_owned = false;
70604         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
70605         *ret_copy = Path_final_cltv_expiry_delta(&this_arg_conv);
70606         uint64_t ret_ref = tag_ptr(ret_copy, true);
70607         return ret_ref;
70608 }
70609
70610 void  __attribute__((export_name("TS_Route_free"))) TS_Route_free(uint64_t this_obj) {
70611         LDKRoute this_obj_conv;
70612         this_obj_conv.inner = untag_ptr(this_obj);
70613         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70615         Route_free(this_obj_conv);
70616 }
70617
70618 uint64_tArray  __attribute__((export_name("TS_Route_get_paths"))) TS_Route_get_paths(uint64_t this_ptr) {
70619         LDKRoute this_ptr_conv;
70620         this_ptr_conv.inner = untag_ptr(this_ptr);
70621         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70623         this_ptr_conv.is_owned = false;
70624         LDKCVec_PathZ ret_var = Route_get_paths(&this_ptr_conv);
70625         uint64_tArray ret_arr = NULL;
70626         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
70627         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
70628         for (size_t g = 0; g < ret_var.datalen; g++) {
70629                 LDKPath ret_conv_6_var = ret_var.data[g];
70630                 uint64_t ret_conv_6_ref = 0;
70631                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
70632                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
70633                 ret_arr_ptr[g] = ret_conv_6_ref;
70634         }
70635         
70636         FREE(ret_var.data);
70637         return ret_arr;
70638 }
70639
70640 void  __attribute__((export_name("TS_Route_set_paths"))) TS_Route_set_paths(uint64_t this_ptr, uint64_tArray val) {
70641         LDKRoute this_ptr_conv;
70642         this_ptr_conv.inner = untag_ptr(this_ptr);
70643         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70645         this_ptr_conv.is_owned = false;
70646         LDKCVec_PathZ val_constr;
70647         val_constr.datalen = val->arr_len;
70648         if (val_constr.datalen > 0)
70649                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
70650         else
70651                 val_constr.data = NULL;
70652         uint64_t* val_vals = val->elems;
70653         for (size_t g = 0; g < val_constr.datalen; g++) {
70654                 uint64_t val_conv_6 = val_vals[g];
70655                 LDKPath val_conv_6_conv;
70656                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
70657                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
70658                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
70659                 val_conv_6_conv = Path_clone(&val_conv_6_conv);
70660                 val_constr.data[g] = val_conv_6_conv;
70661         }
70662         FREE(val);
70663         Route_set_paths(&this_ptr_conv, val_constr);
70664 }
70665
70666 uint64_t  __attribute__((export_name("TS_Route_get_route_params"))) TS_Route_get_route_params(uint64_t this_ptr) {
70667         LDKRoute this_ptr_conv;
70668         this_ptr_conv.inner = untag_ptr(this_ptr);
70669         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70671         this_ptr_conv.is_owned = false;
70672         LDKRouteParameters ret_var = Route_get_route_params(&this_ptr_conv);
70673         uint64_t ret_ref = 0;
70674         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70675         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70676         return ret_ref;
70677 }
70678
70679 void  __attribute__((export_name("TS_Route_set_route_params"))) TS_Route_set_route_params(uint64_t this_ptr, uint64_t val) {
70680         LDKRoute this_ptr_conv;
70681         this_ptr_conv.inner = untag_ptr(this_ptr);
70682         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70684         this_ptr_conv.is_owned = false;
70685         LDKRouteParameters val_conv;
70686         val_conv.inner = untag_ptr(val);
70687         val_conv.is_owned = ptr_is_owned(val);
70688         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
70689         val_conv = RouteParameters_clone(&val_conv);
70690         Route_set_route_params(&this_ptr_conv, val_conv);
70691 }
70692
70693 uint64_t  __attribute__((export_name("TS_Route_new"))) TS_Route_new(uint64_tArray paths_arg, uint64_t route_params_arg) {
70694         LDKCVec_PathZ paths_arg_constr;
70695         paths_arg_constr.datalen = paths_arg->arr_len;
70696         if (paths_arg_constr.datalen > 0)
70697                 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
70698         else
70699                 paths_arg_constr.data = NULL;
70700         uint64_t* paths_arg_vals = paths_arg->elems;
70701         for (size_t g = 0; g < paths_arg_constr.datalen; g++) {
70702                 uint64_t paths_arg_conv_6 = paths_arg_vals[g];
70703                 LDKPath paths_arg_conv_6_conv;
70704                 paths_arg_conv_6_conv.inner = untag_ptr(paths_arg_conv_6);
70705                 paths_arg_conv_6_conv.is_owned = ptr_is_owned(paths_arg_conv_6);
70706                 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_6_conv);
70707                 paths_arg_conv_6_conv = Path_clone(&paths_arg_conv_6_conv);
70708                 paths_arg_constr.data[g] = paths_arg_conv_6_conv;
70709         }
70710         FREE(paths_arg);
70711         LDKRouteParameters route_params_arg_conv;
70712         route_params_arg_conv.inner = untag_ptr(route_params_arg);
70713         route_params_arg_conv.is_owned = ptr_is_owned(route_params_arg);
70714         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_arg_conv);
70715         route_params_arg_conv = RouteParameters_clone(&route_params_arg_conv);
70716         LDKRoute ret_var = Route_new(paths_arg_constr, route_params_arg_conv);
70717         uint64_t ret_ref = 0;
70718         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70719         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70720         return ret_ref;
70721 }
70722
70723 static inline uint64_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
70724         LDKRoute ret_var = Route_clone(arg);
70725         uint64_t ret_ref = 0;
70726         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70727         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70728         return ret_ref;
70729 }
70730 int64_t  __attribute__((export_name("TS_Route_clone_ptr"))) TS_Route_clone_ptr(uint64_t arg) {
70731         LDKRoute arg_conv;
70732         arg_conv.inner = untag_ptr(arg);
70733         arg_conv.is_owned = ptr_is_owned(arg);
70734         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70735         arg_conv.is_owned = false;
70736         int64_t ret_conv = Route_clone_ptr(&arg_conv);
70737         return ret_conv;
70738 }
70739
70740 uint64_t  __attribute__((export_name("TS_Route_clone"))) TS_Route_clone(uint64_t orig) {
70741         LDKRoute orig_conv;
70742         orig_conv.inner = untag_ptr(orig);
70743         orig_conv.is_owned = ptr_is_owned(orig);
70744         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70745         orig_conv.is_owned = false;
70746         LDKRoute ret_var = Route_clone(&orig_conv);
70747         uint64_t ret_ref = 0;
70748         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70749         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70750         return ret_ref;
70751 }
70752
70753 int64_t  __attribute__((export_name("TS_Route_hash"))) TS_Route_hash(uint64_t o) {
70754         LDKRoute o_conv;
70755         o_conv.inner = untag_ptr(o);
70756         o_conv.is_owned = ptr_is_owned(o);
70757         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
70758         o_conv.is_owned = false;
70759         int64_t ret_conv = Route_hash(&o_conv);
70760         return ret_conv;
70761 }
70762
70763 jboolean  __attribute__((export_name("TS_Route_eq"))) TS_Route_eq(uint64_t a, uint64_t b) {
70764         LDKRoute a_conv;
70765         a_conv.inner = untag_ptr(a);
70766         a_conv.is_owned = ptr_is_owned(a);
70767         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70768         a_conv.is_owned = false;
70769         LDKRoute b_conv;
70770         b_conv.inner = untag_ptr(b);
70771         b_conv.is_owned = ptr_is_owned(b);
70772         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
70773         b_conv.is_owned = false;
70774         jboolean ret_conv = Route_eq(&a_conv, &b_conv);
70775         return ret_conv;
70776 }
70777
70778 int64_t  __attribute__((export_name("TS_Route_get_total_fees"))) TS_Route_get_total_fees(uint64_t this_arg) {
70779         LDKRoute this_arg_conv;
70780         this_arg_conv.inner = untag_ptr(this_arg);
70781         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70783         this_arg_conv.is_owned = false;
70784         int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
70785         return ret_conv;
70786 }
70787
70788 int64_t  __attribute__((export_name("TS_Route_get_total_amount"))) TS_Route_get_total_amount(uint64_t this_arg) {
70789         LDKRoute this_arg_conv;
70790         this_arg_conv.inner = untag_ptr(this_arg);
70791         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70793         this_arg_conv.is_owned = false;
70794         int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
70795         return ret_conv;
70796 }
70797
70798 int8_tArray  __attribute__((export_name("TS_Route_write"))) TS_Route_write(uint64_t obj) {
70799         LDKRoute obj_conv;
70800         obj_conv.inner = untag_ptr(obj);
70801         obj_conv.is_owned = ptr_is_owned(obj);
70802         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70803         obj_conv.is_owned = false;
70804         LDKCVec_u8Z ret_var = Route_write(&obj_conv);
70805         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
70806         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
70807         CVec_u8Z_free(ret_var);
70808         return ret_arr;
70809 }
70810
70811 uint64_t  __attribute__((export_name("TS_Route_read"))) TS_Route_read(int8_tArray ser) {
70812         LDKu8slice ser_ref;
70813         ser_ref.datalen = ser->arr_len;
70814         ser_ref.data = ser->elems;
70815         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
70816         *ret_conv = Route_read(ser_ref);
70817         FREE(ser);
70818         return tag_ptr(ret_conv, true);
70819 }
70820
70821 void  __attribute__((export_name("TS_RouteParameters_free"))) TS_RouteParameters_free(uint64_t this_obj) {
70822         LDKRouteParameters this_obj_conv;
70823         this_obj_conv.inner = untag_ptr(this_obj);
70824         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70826         RouteParameters_free(this_obj_conv);
70827 }
70828
70829 uint64_t  __attribute__((export_name("TS_RouteParameters_get_payment_params"))) TS_RouteParameters_get_payment_params(uint64_t this_ptr) {
70830         LDKRouteParameters this_ptr_conv;
70831         this_ptr_conv.inner = untag_ptr(this_ptr);
70832         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70834         this_ptr_conv.is_owned = false;
70835         LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
70836         uint64_t ret_ref = 0;
70837         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70838         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70839         return ret_ref;
70840 }
70841
70842 void  __attribute__((export_name("TS_RouteParameters_set_payment_params"))) TS_RouteParameters_set_payment_params(uint64_t this_ptr, uint64_t val) {
70843         LDKRouteParameters this_ptr_conv;
70844         this_ptr_conv.inner = untag_ptr(this_ptr);
70845         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70847         this_ptr_conv.is_owned = false;
70848         LDKPaymentParameters val_conv;
70849         val_conv.inner = untag_ptr(val);
70850         val_conv.is_owned = ptr_is_owned(val);
70851         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
70852         val_conv = PaymentParameters_clone(&val_conv);
70853         RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
70854 }
70855
70856 int64_t  __attribute__((export_name("TS_RouteParameters_get_final_value_msat"))) TS_RouteParameters_get_final_value_msat(uint64_t this_ptr) {
70857         LDKRouteParameters this_ptr_conv;
70858         this_ptr_conv.inner = untag_ptr(this_ptr);
70859         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70861         this_ptr_conv.is_owned = false;
70862         int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
70863         return ret_conv;
70864 }
70865
70866 void  __attribute__((export_name("TS_RouteParameters_set_final_value_msat"))) TS_RouteParameters_set_final_value_msat(uint64_t this_ptr, int64_t val) {
70867         LDKRouteParameters this_ptr_conv;
70868         this_ptr_conv.inner = untag_ptr(this_ptr);
70869         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70871         this_ptr_conv.is_owned = false;
70872         RouteParameters_set_final_value_msat(&this_ptr_conv, val);
70873 }
70874
70875 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) {
70876         LDKRouteParameters this_ptr_conv;
70877         this_ptr_conv.inner = untag_ptr(this_ptr);
70878         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70880         this_ptr_conv.is_owned = false;
70881         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
70882         *ret_copy = RouteParameters_get_max_total_routing_fee_msat(&this_ptr_conv);
70883         uint64_t ret_ref = tag_ptr(ret_copy, true);
70884         return ret_ref;
70885 }
70886
70887 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) {
70888         LDKRouteParameters this_ptr_conv;
70889         this_ptr_conv.inner = untag_ptr(this_ptr);
70890         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70892         this_ptr_conv.is_owned = false;
70893         void* val_ptr = untag_ptr(val);
70894         CHECK_ACCESS(val_ptr);
70895         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
70896         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
70897         RouteParameters_set_max_total_routing_fee_msat(&this_ptr_conv, val_conv);
70898 }
70899
70900 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) {
70901         LDKPaymentParameters payment_params_arg_conv;
70902         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
70903         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
70904         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
70905         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
70906         void* max_total_routing_fee_msat_arg_ptr = untag_ptr(max_total_routing_fee_msat_arg);
70907         CHECK_ACCESS(max_total_routing_fee_msat_arg_ptr);
70908         LDKCOption_u64Z max_total_routing_fee_msat_arg_conv = *(LDKCOption_u64Z*)(max_total_routing_fee_msat_arg_ptr);
70909         max_total_routing_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(max_total_routing_fee_msat_arg));
70910         LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg, max_total_routing_fee_msat_arg_conv);
70911         uint64_t ret_ref = 0;
70912         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70913         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70914         return ret_ref;
70915 }
70916
70917 static inline uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
70918         LDKRouteParameters ret_var = RouteParameters_clone(arg);
70919         uint64_t ret_ref = 0;
70920         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70921         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70922         return ret_ref;
70923 }
70924 int64_t  __attribute__((export_name("TS_RouteParameters_clone_ptr"))) TS_RouteParameters_clone_ptr(uint64_t arg) {
70925         LDKRouteParameters arg_conv;
70926         arg_conv.inner = untag_ptr(arg);
70927         arg_conv.is_owned = ptr_is_owned(arg);
70928         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70929         arg_conv.is_owned = false;
70930         int64_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
70931         return ret_conv;
70932 }
70933
70934 uint64_t  __attribute__((export_name("TS_RouteParameters_clone"))) TS_RouteParameters_clone(uint64_t orig) {
70935         LDKRouteParameters orig_conv;
70936         orig_conv.inner = untag_ptr(orig);
70937         orig_conv.is_owned = ptr_is_owned(orig);
70938         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70939         orig_conv.is_owned = false;
70940         LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
70941         uint64_t ret_ref = 0;
70942         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70943         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70944         return ret_ref;
70945 }
70946
70947 int64_t  __attribute__((export_name("TS_RouteParameters_hash"))) TS_RouteParameters_hash(uint64_t o) {
70948         LDKRouteParameters o_conv;
70949         o_conv.inner = untag_ptr(o);
70950         o_conv.is_owned = ptr_is_owned(o);
70951         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
70952         o_conv.is_owned = false;
70953         int64_t ret_conv = RouteParameters_hash(&o_conv);
70954         return ret_conv;
70955 }
70956
70957 jboolean  __attribute__((export_name("TS_RouteParameters_eq"))) TS_RouteParameters_eq(uint64_t a, uint64_t b) {
70958         LDKRouteParameters a_conv;
70959         a_conv.inner = untag_ptr(a);
70960         a_conv.is_owned = ptr_is_owned(a);
70961         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70962         a_conv.is_owned = false;
70963         LDKRouteParameters b_conv;
70964         b_conv.inner = untag_ptr(b);
70965         b_conv.is_owned = ptr_is_owned(b);
70966         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
70967         b_conv.is_owned = false;
70968         jboolean ret_conv = RouteParameters_eq(&a_conv, &b_conv);
70969         return ret_conv;
70970 }
70971
70972 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) {
70973         LDKPaymentParameters payment_params_conv;
70974         payment_params_conv.inner = untag_ptr(payment_params);
70975         payment_params_conv.is_owned = ptr_is_owned(payment_params);
70976         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_conv);
70977         payment_params_conv = PaymentParameters_clone(&payment_params_conv);
70978         LDKRouteParameters ret_var = RouteParameters_from_payment_params_and_value(payment_params_conv, final_value_msat);
70979         uint64_t ret_ref = 0;
70980         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70981         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70982         return ret_ref;
70983 }
70984
70985 int8_tArray  __attribute__((export_name("TS_RouteParameters_write"))) TS_RouteParameters_write(uint64_t obj) {
70986         LDKRouteParameters obj_conv;
70987         obj_conv.inner = untag_ptr(obj);
70988         obj_conv.is_owned = ptr_is_owned(obj);
70989         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70990         obj_conv.is_owned = false;
70991         LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
70992         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
70993         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
70994         CVec_u8Z_free(ret_var);
70995         return ret_arr;
70996 }
70997
70998 uint64_t  __attribute__((export_name("TS_RouteParameters_read"))) TS_RouteParameters_read(int8_tArray ser) {
70999         LDKu8slice ser_ref;
71000         ser_ref.datalen = ser->arr_len;
71001         ser_ref.data = ser->elems;
71002         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
71003         *ret_conv = RouteParameters_read(ser_ref);
71004         FREE(ser);
71005         return tag_ptr(ret_conv, true);
71006 }
71007
71008 void  __attribute__((export_name("TS_PaymentParameters_free"))) TS_PaymentParameters_free(uint64_t this_obj) {
71009         LDKPaymentParameters this_obj_conv;
71010         this_obj_conv.inner = untag_ptr(this_obj);
71011         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71013         PaymentParameters_free(this_obj_conv);
71014 }
71015
71016 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_payee"))) TS_PaymentParameters_get_payee(uint64_t this_ptr) {
71017         LDKPaymentParameters this_ptr_conv;
71018         this_ptr_conv.inner = untag_ptr(this_ptr);
71019         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71021         this_ptr_conv.is_owned = false;
71022         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
71023         *ret_copy = PaymentParameters_get_payee(&this_ptr_conv);
71024         uint64_t ret_ref = tag_ptr(ret_copy, true);
71025         return ret_ref;
71026 }
71027
71028 void  __attribute__((export_name("TS_PaymentParameters_set_payee"))) TS_PaymentParameters_set_payee(uint64_t this_ptr, uint64_t val) {
71029         LDKPaymentParameters this_ptr_conv;
71030         this_ptr_conv.inner = untag_ptr(this_ptr);
71031         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71033         this_ptr_conv.is_owned = false;
71034         void* val_ptr = untag_ptr(val);
71035         CHECK_ACCESS(val_ptr);
71036         LDKPayee val_conv = *(LDKPayee*)(val_ptr);
71037         val_conv = Payee_clone((LDKPayee*)untag_ptr(val));
71038         PaymentParameters_set_payee(&this_ptr_conv, val_conv);
71039 }
71040
71041 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_expiry_time"))) TS_PaymentParameters_get_expiry_time(uint64_t this_ptr) {
71042         LDKPaymentParameters this_ptr_conv;
71043         this_ptr_conv.inner = untag_ptr(this_ptr);
71044         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71046         this_ptr_conv.is_owned = false;
71047         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
71048         *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
71049         uint64_t ret_ref = tag_ptr(ret_copy, true);
71050         return ret_ref;
71051 }
71052
71053 void  __attribute__((export_name("TS_PaymentParameters_set_expiry_time"))) TS_PaymentParameters_set_expiry_time(uint64_t this_ptr, uint64_t val) {
71054         LDKPaymentParameters this_ptr_conv;
71055         this_ptr_conv.inner = untag_ptr(this_ptr);
71056         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71058         this_ptr_conv.is_owned = false;
71059         void* val_ptr = untag_ptr(val);
71060         CHECK_ACCESS(val_ptr);
71061         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
71062         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
71063         PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
71064 }
71065
71066 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) {
71067         LDKPaymentParameters this_ptr_conv;
71068         this_ptr_conv.inner = untag_ptr(this_ptr);
71069         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71071         this_ptr_conv.is_owned = false;
71072         int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
71073         return ret_conv;
71074 }
71075
71076 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) {
71077         LDKPaymentParameters this_ptr_conv;
71078         this_ptr_conv.inner = untag_ptr(this_ptr);
71079         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71081         this_ptr_conv.is_owned = false;
71082         PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
71083 }
71084
71085 int8_t  __attribute__((export_name("TS_PaymentParameters_get_max_path_count"))) TS_PaymentParameters_get_max_path_count(uint64_t this_ptr) {
71086         LDKPaymentParameters this_ptr_conv;
71087         this_ptr_conv.inner = untag_ptr(this_ptr);
71088         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71090         this_ptr_conv.is_owned = false;
71091         int8_t ret_conv = PaymentParameters_get_max_path_count(&this_ptr_conv);
71092         return ret_conv;
71093 }
71094
71095 void  __attribute__((export_name("TS_PaymentParameters_set_max_path_count"))) TS_PaymentParameters_set_max_path_count(uint64_t this_ptr, int8_t val) {
71096         LDKPaymentParameters this_ptr_conv;
71097         this_ptr_conv.inner = untag_ptr(this_ptr);
71098         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71100         this_ptr_conv.is_owned = false;
71101         PaymentParameters_set_max_path_count(&this_ptr_conv, val);
71102 }
71103
71104 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) {
71105         LDKPaymentParameters this_ptr_conv;
71106         this_ptr_conv.inner = untag_ptr(this_ptr);
71107         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71109         this_ptr_conv.is_owned = false;
71110         int8_t ret_conv = PaymentParameters_get_max_channel_saturation_power_of_half(&this_ptr_conv);
71111         return ret_conv;
71112 }
71113
71114 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) {
71115         LDKPaymentParameters this_ptr_conv;
71116         this_ptr_conv.inner = untag_ptr(this_ptr);
71117         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71119         this_ptr_conv.is_owned = false;
71120         PaymentParameters_set_max_channel_saturation_power_of_half(&this_ptr_conv, val);
71121 }
71122
71123 int64_tArray  __attribute__((export_name("TS_PaymentParameters_get_previously_failed_channels"))) TS_PaymentParameters_get_previously_failed_channels(uint64_t this_ptr) {
71124         LDKPaymentParameters this_ptr_conv;
71125         this_ptr_conv.inner = untag_ptr(this_ptr);
71126         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71128         this_ptr_conv.is_owned = false;
71129         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_channels(&this_ptr_conv);
71130         int64_tArray ret_arr = NULL;
71131         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
71132         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
71133         for (size_t i = 0; i < ret_var.datalen; i++) {
71134                 int64_t ret_conv_8_conv = ret_var.data[i];
71135                 ret_arr_ptr[i] = ret_conv_8_conv;
71136         }
71137         
71138         FREE(ret_var.data);
71139         return ret_arr;
71140 }
71141
71142 void  __attribute__((export_name("TS_PaymentParameters_set_previously_failed_channels"))) TS_PaymentParameters_set_previously_failed_channels(uint64_t this_ptr, int64_tArray val) {
71143         LDKPaymentParameters this_ptr_conv;
71144         this_ptr_conv.inner = untag_ptr(this_ptr);
71145         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71147         this_ptr_conv.is_owned = false;
71148         LDKCVec_u64Z val_constr;
71149         val_constr.datalen = val->arr_len;
71150         if (val_constr.datalen > 0)
71151                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
71152         else
71153                 val_constr.data = NULL;
71154         int64_t* val_vals = val->elems;
71155         for (size_t i = 0; i < val_constr.datalen; i++) {
71156                 int64_t val_conv_8 = val_vals[i];
71157                 val_constr.data[i] = val_conv_8;
71158         }
71159         FREE(val);
71160         PaymentParameters_set_previously_failed_channels(&this_ptr_conv, val_constr);
71161 }
71162
71163 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) {
71164         LDKPaymentParameters this_ptr_conv;
71165         this_ptr_conv.inner = untag_ptr(this_ptr);
71166         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71168         this_ptr_conv.is_owned = false;
71169         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_blinded_path_idxs(&this_ptr_conv);
71170         int64_tArray ret_arr = NULL;
71171         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
71172         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
71173         for (size_t i = 0; i < ret_var.datalen; i++) {
71174                 int64_t ret_conv_8_conv = ret_var.data[i];
71175                 ret_arr_ptr[i] = ret_conv_8_conv;
71176         }
71177         
71178         FREE(ret_var.data);
71179         return ret_arr;
71180 }
71181
71182 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) {
71183         LDKPaymentParameters this_ptr_conv;
71184         this_ptr_conv.inner = untag_ptr(this_ptr);
71185         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71187         this_ptr_conv.is_owned = false;
71188         LDKCVec_u64Z val_constr;
71189         val_constr.datalen = val->arr_len;
71190         if (val_constr.datalen > 0)
71191                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
71192         else
71193                 val_constr.data = NULL;
71194         int64_t* val_vals = val->elems;
71195         for (size_t i = 0; i < val_constr.datalen; i++) {
71196                 int64_t val_conv_8 = val_vals[i];
71197                 val_constr.data[i] = val_conv_8;
71198         }
71199         FREE(val);
71200         PaymentParameters_set_previously_failed_blinded_path_idxs(&this_ptr_conv, val_constr);
71201 }
71202
71203 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) {
71204         void* payee_arg_ptr = untag_ptr(payee_arg);
71205         CHECK_ACCESS(payee_arg_ptr);
71206         LDKPayee payee_arg_conv = *(LDKPayee*)(payee_arg_ptr);
71207         payee_arg_conv = Payee_clone((LDKPayee*)untag_ptr(payee_arg));
71208         void* expiry_time_arg_ptr = untag_ptr(expiry_time_arg);
71209         CHECK_ACCESS(expiry_time_arg_ptr);
71210         LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
71211         expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(expiry_time_arg));
71212         LDKCVec_u64Z previously_failed_channels_arg_constr;
71213         previously_failed_channels_arg_constr.datalen = previously_failed_channels_arg->arr_len;
71214         if (previously_failed_channels_arg_constr.datalen > 0)
71215                 previously_failed_channels_arg_constr.data = MALLOC(previously_failed_channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
71216         else
71217                 previously_failed_channels_arg_constr.data = NULL;
71218         int64_t* previously_failed_channels_arg_vals = previously_failed_channels_arg->elems;
71219         for (size_t i = 0; i < previously_failed_channels_arg_constr.datalen; i++) {
71220                 int64_t previously_failed_channels_arg_conv_8 = previously_failed_channels_arg_vals[i];
71221                 previously_failed_channels_arg_constr.data[i] = previously_failed_channels_arg_conv_8;
71222         }
71223         FREE(previously_failed_channels_arg);
71224         LDKCVec_u64Z previously_failed_blinded_path_idxs_arg_constr;
71225         previously_failed_blinded_path_idxs_arg_constr.datalen = previously_failed_blinded_path_idxs_arg->arr_len;
71226         if (previously_failed_blinded_path_idxs_arg_constr.datalen > 0)
71227                 previously_failed_blinded_path_idxs_arg_constr.data = MALLOC(previously_failed_blinded_path_idxs_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
71228         else
71229                 previously_failed_blinded_path_idxs_arg_constr.data = NULL;
71230         int64_t* previously_failed_blinded_path_idxs_arg_vals = previously_failed_blinded_path_idxs_arg->elems;
71231         for (size_t i = 0; i < previously_failed_blinded_path_idxs_arg_constr.datalen; i++) {
71232                 int64_t previously_failed_blinded_path_idxs_arg_conv_8 = previously_failed_blinded_path_idxs_arg_vals[i];
71233                 previously_failed_blinded_path_idxs_arg_constr.data[i] = previously_failed_blinded_path_idxs_arg_conv_8;
71234         }
71235         FREE(previously_failed_blinded_path_idxs_arg);
71236         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);
71237         uint64_t ret_ref = 0;
71238         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71239         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71240         return ret_ref;
71241 }
71242
71243 static inline uint64_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
71244         LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
71245         uint64_t ret_ref = 0;
71246         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71247         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71248         return ret_ref;
71249 }
71250 int64_t  __attribute__((export_name("TS_PaymentParameters_clone_ptr"))) TS_PaymentParameters_clone_ptr(uint64_t arg) {
71251         LDKPaymentParameters arg_conv;
71252         arg_conv.inner = untag_ptr(arg);
71253         arg_conv.is_owned = ptr_is_owned(arg);
71254         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71255         arg_conv.is_owned = false;
71256         int64_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
71257         return ret_conv;
71258 }
71259
71260 uint64_t  __attribute__((export_name("TS_PaymentParameters_clone"))) TS_PaymentParameters_clone(uint64_t orig) {
71261         LDKPaymentParameters orig_conv;
71262         orig_conv.inner = untag_ptr(orig);
71263         orig_conv.is_owned = ptr_is_owned(orig);
71264         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71265         orig_conv.is_owned = false;
71266         LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
71267         uint64_t ret_ref = 0;
71268         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71269         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71270         return ret_ref;
71271 }
71272
71273 int64_t  __attribute__((export_name("TS_PaymentParameters_hash"))) TS_PaymentParameters_hash(uint64_t o) {
71274         LDKPaymentParameters o_conv;
71275         o_conv.inner = untag_ptr(o);
71276         o_conv.is_owned = ptr_is_owned(o);
71277         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
71278         o_conv.is_owned = false;
71279         int64_t ret_conv = PaymentParameters_hash(&o_conv);
71280         return ret_conv;
71281 }
71282
71283 jboolean  __attribute__((export_name("TS_PaymentParameters_eq"))) TS_PaymentParameters_eq(uint64_t a, uint64_t b) {
71284         LDKPaymentParameters a_conv;
71285         a_conv.inner = untag_ptr(a);
71286         a_conv.is_owned = ptr_is_owned(a);
71287         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
71288         a_conv.is_owned = false;
71289         LDKPaymentParameters b_conv;
71290         b_conv.inner = untag_ptr(b);
71291         b_conv.is_owned = ptr_is_owned(b);
71292         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
71293         b_conv.is_owned = false;
71294         jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
71295         return ret_conv;
71296 }
71297
71298 int8_tArray  __attribute__((export_name("TS_PaymentParameters_write"))) TS_PaymentParameters_write(uint64_t obj) {
71299         LDKPaymentParameters obj_conv;
71300         obj_conv.inner = untag_ptr(obj);
71301         obj_conv.is_owned = ptr_is_owned(obj);
71302         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71303         obj_conv.is_owned = false;
71304         LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
71305         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
71306         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
71307         CVec_u8Z_free(ret_var);
71308         return ret_arr;
71309 }
71310
71311 uint64_t  __attribute__((export_name("TS_PaymentParameters_read"))) TS_PaymentParameters_read(int8_tArray ser, int32_t arg) {
71312         LDKu8slice ser_ref;
71313         ser_ref.datalen = ser->arr_len;
71314         ser_ref.data = ser->elems;
71315         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
71316         *ret_conv = PaymentParameters_read(ser_ref, arg);
71317         FREE(ser);
71318         return tag_ptr(ret_conv, true);
71319 }
71320
71321 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) {
71322         LDKPublicKey payee_pubkey_ref;
71323         CHECK(payee_pubkey->arr_len == 33);
71324         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
71325         LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref, final_cltv_expiry_delta);
71326         uint64_t ret_ref = 0;
71327         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71328         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71329         return ret_ref;
71330 }
71331
71332 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) {
71333         LDKPublicKey payee_pubkey_ref;
71334         CHECK(payee_pubkey->arr_len == 33);
71335         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
71336         LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref, final_cltv_expiry_delta, allow_mpp);
71337         uint64_t ret_ref = 0;
71338         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71339         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71340         return ret_ref;
71341 }
71342
71343 uint64_t  __attribute__((export_name("TS_PaymentParameters_from_bolt12_invoice"))) TS_PaymentParameters_from_bolt12_invoice(uint64_t invoice) {
71344         LDKBolt12Invoice invoice_conv;
71345         invoice_conv.inner = untag_ptr(invoice);
71346         invoice_conv.is_owned = ptr_is_owned(invoice);
71347         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
71348         invoice_conv.is_owned = false;
71349         LDKPaymentParameters ret_var = PaymentParameters_from_bolt12_invoice(&invoice_conv);
71350         uint64_t ret_ref = 0;
71351         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71352         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71353         return ret_ref;
71354 }
71355
71356 uint64_t  __attribute__((export_name("TS_PaymentParameters_blinded"))) TS_PaymentParameters_blinded(uint64_tArray blinded_route_hints) {
71357         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ blinded_route_hints_constr;
71358         blinded_route_hints_constr.datalen = blinded_route_hints->arr_len;
71359         if (blinded_route_hints_constr.datalen > 0)
71360                 blinded_route_hints_constr.data = MALLOC(blinded_route_hints_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
71361         else
71362                 blinded_route_hints_constr.data = NULL;
71363         uint64_t* blinded_route_hints_vals = blinded_route_hints->elems;
71364         for (size_t l = 0; l < blinded_route_hints_constr.datalen; l++) {
71365                 uint64_t blinded_route_hints_conv_37 = blinded_route_hints_vals[l];
71366                 void* blinded_route_hints_conv_37_ptr = untag_ptr(blinded_route_hints_conv_37);
71367                 CHECK_ACCESS(blinded_route_hints_conv_37_ptr);
71368                 LDKC2Tuple_BlindedPayInfoBlindedPathZ blinded_route_hints_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(blinded_route_hints_conv_37_ptr);
71369                 blinded_route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(blinded_route_hints_conv_37));
71370                 blinded_route_hints_constr.data[l] = blinded_route_hints_conv_37_conv;
71371         }
71372         FREE(blinded_route_hints);
71373         LDKPaymentParameters ret_var = PaymentParameters_blinded(blinded_route_hints_constr);
71374         uint64_t ret_ref = 0;
71375         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71376         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71377         return ret_ref;
71378 }
71379
71380 void  __attribute__((export_name("TS_Payee_free"))) TS_Payee_free(uint64_t this_ptr) {
71381         if (!ptr_is_owned(this_ptr)) return;
71382         void* this_ptr_ptr = untag_ptr(this_ptr);
71383         CHECK_ACCESS(this_ptr_ptr);
71384         LDKPayee this_ptr_conv = *(LDKPayee*)(this_ptr_ptr);
71385         FREE(untag_ptr(this_ptr));
71386         Payee_free(this_ptr_conv);
71387 }
71388
71389 static inline uint64_t Payee_clone_ptr(LDKPayee *NONNULL_PTR arg) {
71390         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
71391         *ret_copy = Payee_clone(arg);
71392         uint64_t ret_ref = tag_ptr(ret_copy, true);
71393         return ret_ref;
71394 }
71395 int64_t  __attribute__((export_name("TS_Payee_clone_ptr"))) TS_Payee_clone_ptr(uint64_t arg) {
71396         LDKPayee* arg_conv = (LDKPayee*)untag_ptr(arg);
71397         int64_t ret_conv = Payee_clone_ptr(arg_conv);
71398         return ret_conv;
71399 }
71400
71401 uint64_t  __attribute__((export_name("TS_Payee_clone"))) TS_Payee_clone(uint64_t orig) {
71402         LDKPayee* orig_conv = (LDKPayee*)untag_ptr(orig);
71403         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
71404         *ret_copy = Payee_clone(orig_conv);
71405         uint64_t ret_ref = tag_ptr(ret_copy, true);
71406         return ret_ref;
71407 }
71408
71409 uint64_t  __attribute__((export_name("TS_Payee_blinded"))) TS_Payee_blinded(uint64_tArray route_hints, uint64_t features) {
71410         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints_constr;
71411         route_hints_constr.datalen = route_hints->arr_len;
71412         if (route_hints_constr.datalen > 0)
71413                 route_hints_constr.data = MALLOC(route_hints_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
71414         else
71415                 route_hints_constr.data = NULL;
71416         uint64_t* route_hints_vals = route_hints->elems;
71417         for (size_t l = 0; l < route_hints_constr.datalen; l++) {
71418                 uint64_t route_hints_conv_37 = route_hints_vals[l];
71419                 void* route_hints_conv_37_ptr = untag_ptr(route_hints_conv_37);
71420                 CHECK_ACCESS(route_hints_conv_37_ptr);
71421                 LDKC2Tuple_BlindedPayInfoBlindedPathZ route_hints_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(route_hints_conv_37_ptr);
71422                 route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(route_hints_conv_37));
71423                 route_hints_constr.data[l] = route_hints_conv_37_conv;
71424         }
71425         FREE(route_hints);
71426         LDKBolt12InvoiceFeatures features_conv;
71427         features_conv.inner = untag_ptr(features);
71428         features_conv.is_owned = ptr_is_owned(features);
71429         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
71430         features_conv = Bolt12InvoiceFeatures_clone(&features_conv);
71431         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
71432         *ret_copy = Payee_blinded(route_hints_constr, features_conv);
71433         uint64_t ret_ref = tag_ptr(ret_copy, true);
71434         return ret_ref;
71435 }
71436
71437 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) {
71438         LDKPublicKey node_id_ref;
71439         CHECK(node_id->arr_len == 33);
71440         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
71441         LDKCVec_RouteHintZ route_hints_constr;
71442         route_hints_constr.datalen = route_hints->arr_len;
71443         if (route_hints_constr.datalen > 0)
71444                 route_hints_constr.data = MALLOC(route_hints_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
71445         else
71446                 route_hints_constr.data = NULL;
71447         uint64_t* route_hints_vals = route_hints->elems;
71448         for (size_t l = 0; l < route_hints_constr.datalen; l++) {
71449                 uint64_t route_hints_conv_11 = route_hints_vals[l];
71450                 LDKRouteHint route_hints_conv_11_conv;
71451                 route_hints_conv_11_conv.inner = untag_ptr(route_hints_conv_11);
71452                 route_hints_conv_11_conv.is_owned = ptr_is_owned(route_hints_conv_11);
71453                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_conv_11_conv);
71454                 route_hints_conv_11_conv = RouteHint_clone(&route_hints_conv_11_conv);
71455                 route_hints_constr.data[l] = route_hints_conv_11_conv;
71456         }
71457         FREE(route_hints);
71458         LDKBolt11InvoiceFeatures features_conv;
71459         features_conv.inner = untag_ptr(features);
71460         features_conv.is_owned = ptr_is_owned(features);
71461         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
71462         features_conv = Bolt11InvoiceFeatures_clone(&features_conv);
71463         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
71464         *ret_copy = Payee_clear(node_id_ref, route_hints_constr, features_conv, final_cltv_expiry_delta);
71465         uint64_t ret_ref = tag_ptr(ret_copy, true);
71466         return ret_ref;
71467 }
71468
71469 int64_t  __attribute__((export_name("TS_Payee_hash"))) TS_Payee_hash(uint64_t o) {
71470         LDKPayee* o_conv = (LDKPayee*)untag_ptr(o);
71471         int64_t ret_conv = Payee_hash(o_conv);
71472         return ret_conv;
71473 }
71474
71475 jboolean  __attribute__((export_name("TS_Payee_eq"))) TS_Payee_eq(uint64_t a, uint64_t b) {
71476         LDKPayee* a_conv = (LDKPayee*)untag_ptr(a);
71477         LDKPayee* b_conv = (LDKPayee*)untag_ptr(b);
71478         jboolean ret_conv = Payee_eq(a_conv, b_conv);
71479         return ret_conv;
71480 }
71481
71482 void  __attribute__((export_name("TS_RouteHint_free"))) TS_RouteHint_free(uint64_t this_obj) {
71483         LDKRouteHint this_obj_conv;
71484         this_obj_conv.inner = untag_ptr(this_obj);
71485         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71487         RouteHint_free(this_obj_conv);
71488 }
71489
71490 uint64_tArray  __attribute__((export_name("TS_RouteHint_get_a"))) TS_RouteHint_get_a(uint64_t this_ptr) {
71491         LDKRouteHint this_ptr_conv;
71492         this_ptr_conv.inner = untag_ptr(this_ptr);
71493         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71495         this_ptr_conv.is_owned = false;
71496         LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
71497         uint64_tArray ret_arr = NULL;
71498         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
71499         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
71500         for (size_t o = 0; o < ret_var.datalen; o++) {
71501                 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
71502                 uint64_t ret_conv_14_ref = 0;
71503                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
71504                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
71505                 ret_arr_ptr[o] = ret_conv_14_ref;
71506         }
71507         
71508         FREE(ret_var.data);
71509         return ret_arr;
71510 }
71511
71512 void  __attribute__((export_name("TS_RouteHint_set_a"))) TS_RouteHint_set_a(uint64_t this_ptr, uint64_tArray val) {
71513         LDKRouteHint this_ptr_conv;
71514         this_ptr_conv.inner = untag_ptr(this_ptr);
71515         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71517         this_ptr_conv.is_owned = false;
71518         LDKCVec_RouteHintHopZ val_constr;
71519         val_constr.datalen = val->arr_len;
71520         if (val_constr.datalen > 0)
71521                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
71522         else
71523                 val_constr.data = NULL;
71524         uint64_t* val_vals = val->elems;
71525         for (size_t o = 0; o < val_constr.datalen; o++) {
71526                 uint64_t val_conv_14 = val_vals[o];
71527                 LDKRouteHintHop val_conv_14_conv;
71528                 val_conv_14_conv.inner = untag_ptr(val_conv_14);
71529                 val_conv_14_conv.is_owned = ptr_is_owned(val_conv_14);
71530                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
71531                 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
71532                 val_constr.data[o] = val_conv_14_conv;
71533         }
71534         FREE(val);
71535         RouteHint_set_a(&this_ptr_conv, val_constr);
71536 }
71537
71538 uint64_t  __attribute__((export_name("TS_RouteHint_new"))) TS_RouteHint_new(uint64_tArray a_arg) {
71539         LDKCVec_RouteHintHopZ a_arg_constr;
71540         a_arg_constr.datalen = a_arg->arr_len;
71541         if (a_arg_constr.datalen > 0)
71542                 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
71543         else
71544                 a_arg_constr.data = NULL;
71545         uint64_t* a_arg_vals = a_arg->elems;
71546         for (size_t o = 0; o < a_arg_constr.datalen; o++) {
71547                 uint64_t a_arg_conv_14 = a_arg_vals[o];
71548                 LDKRouteHintHop a_arg_conv_14_conv;
71549                 a_arg_conv_14_conv.inner = untag_ptr(a_arg_conv_14);
71550                 a_arg_conv_14_conv.is_owned = ptr_is_owned(a_arg_conv_14);
71551                 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
71552                 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
71553                 a_arg_constr.data[o] = a_arg_conv_14_conv;
71554         }
71555         FREE(a_arg);
71556         LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
71557         uint64_t ret_ref = 0;
71558         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71559         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71560         return ret_ref;
71561 }
71562
71563 static inline uint64_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
71564         LDKRouteHint ret_var = RouteHint_clone(arg);
71565         uint64_t ret_ref = 0;
71566         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71567         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71568         return ret_ref;
71569 }
71570 int64_t  __attribute__((export_name("TS_RouteHint_clone_ptr"))) TS_RouteHint_clone_ptr(uint64_t arg) {
71571         LDKRouteHint arg_conv;
71572         arg_conv.inner = untag_ptr(arg);
71573         arg_conv.is_owned = ptr_is_owned(arg);
71574         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71575         arg_conv.is_owned = false;
71576         int64_t ret_conv = RouteHint_clone_ptr(&arg_conv);
71577         return ret_conv;
71578 }
71579
71580 uint64_t  __attribute__((export_name("TS_RouteHint_clone"))) TS_RouteHint_clone(uint64_t orig) {
71581         LDKRouteHint orig_conv;
71582         orig_conv.inner = untag_ptr(orig);
71583         orig_conv.is_owned = ptr_is_owned(orig);
71584         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71585         orig_conv.is_owned = false;
71586         LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
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
71593 int64_t  __attribute__((export_name("TS_RouteHint_hash"))) TS_RouteHint_hash(uint64_t o) {
71594         LDKRouteHint o_conv;
71595         o_conv.inner = untag_ptr(o);
71596         o_conv.is_owned = ptr_is_owned(o);
71597         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
71598         o_conv.is_owned = false;
71599         int64_t ret_conv = RouteHint_hash(&o_conv);
71600         return ret_conv;
71601 }
71602
71603 jboolean  __attribute__((export_name("TS_RouteHint_eq"))) TS_RouteHint_eq(uint64_t a, uint64_t b) {
71604         LDKRouteHint a_conv;
71605         a_conv.inner = untag_ptr(a);
71606         a_conv.is_owned = ptr_is_owned(a);
71607         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
71608         a_conv.is_owned = false;
71609         LDKRouteHint b_conv;
71610         b_conv.inner = untag_ptr(b);
71611         b_conv.is_owned = ptr_is_owned(b);
71612         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
71613         b_conv.is_owned = false;
71614         jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
71615         return ret_conv;
71616 }
71617
71618 int8_tArray  __attribute__((export_name("TS_RouteHint_write"))) TS_RouteHint_write(uint64_t obj) {
71619         LDKRouteHint obj_conv;
71620         obj_conv.inner = untag_ptr(obj);
71621         obj_conv.is_owned = ptr_is_owned(obj);
71622         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71623         obj_conv.is_owned = false;
71624         LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
71625         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
71626         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
71627         CVec_u8Z_free(ret_var);
71628         return ret_arr;
71629 }
71630
71631 uint64_t  __attribute__((export_name("TS_RouteHint_read"))) TS_RouteHint_read(int8_tArray ser) {
71632         LDKu8slice ser_ref;
71633         ser_ref.datalen = ser->arr_len;
71634         ser_ref.data = ser->elems;
71635         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
71636         *ret_conv = RouteHint_read(ser_ref);
71637         FREE(ser);
71638         return tag_ptr(ret_conv, true);
71639 }
71640
71641 void  __attribute__((export_name("TS_RouteHintHop_free"))) TS_RouteHintHop_free(uint64_t this_obj) {
71642         LDKRouteHintHop this_obj_conv;
71643         this_obj_conv.inner = untag_ptr(this_obj);
71644         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71646         RouteHintHop_free(this_obj_conv);
71647 }
71648
71649 int8_tArray  __attribute__((export_name("TS_RouteHintHop_get_src_node_id"))) TS_RouteHintHop_get_src_node_id(uint64_t this_ptr) {
71650         LDKRouteHintHop this_ptr_conv;
71651         this_ptr_conv.inner = untag_ptr(this_ptr);
71652         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71654         this_ptr_conv.is_owned = false;
71655         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
71656         memcpy(ret_arr->elems, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
71657         return ret_arr;
71658 }
71659
71660 void  __attribute__((export_name("TS_RouteHintHop_set_src_node_id"))) TS_RouteHintHop_set_src_node_id(uint64_t this_ptr, int8_tArray val) {
71661         LDKRouteHintHop this_ptr_conv;
71662         this_ptr_conv.inner = untag_ptr(this_ptr);
71663         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71665         this_ptr_conv.is_owned = false;
71666         LDKPublicKey val_ref;
71667         CHECK(val->arr_len == 33);
71668         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
71669         RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
71670 }
71671
71672 int64_t  __attribute__((export_name("TS_RouteHintHop_get_short_channel_id"))) TS_RouteHintHop_get_short_channel_id(uint64_t this_ptr) {
71673         LDKRouteHintHop this_ptr_conv;
71674         this_ptr_conv.inner = untag_ptr(this_ptr);
71675         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71677         this_ptr_conv.is_owned = false;
71678         int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
71679         return ret_conv;
71680 }
71681
71682 void  __attribute__((export_name("TS_RouteHintHop_set_short_channel_id"))) TS_RouteHintHop_set_short_channel_id(uint64_t this_ptr, int64_t val) {
71683         LDKRouteHintHop this_ptr_conv;
71684         this_ptr_conv.inner = untag_ptr(this_ptr);
71685         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71687         this_ptr_conv.is_owned = false;
71688         RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
71689 }
71690
71691 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_fees"))) TS_RouteHintHop_get_fees(uint64_t this_ptr) {
71692         LDKRouteHintHop this_ptr_conv;
71693         this_ptr_conv.inner = untag_ptr(this_ptr);
71694         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71696         this_ptr_conv.is_owned = false;
71697         LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
71698         uint64_t ret_ref = 0;
71699         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71700         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71701         return ret_ref;
71702 }
71703
71704 void  __attribute__((export_name("TS_RouteHintHop_set_fees"))) TS_RouteHintHop_set_fees(uint64_t this_ptr, uint64_t val) {
71705         LDKRouteHintHop this_ptr_conv;
71706         this_ptr_conv.inner = untag_ptr(this_ptr);
71707         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71709         this_ptr_conv.is_owned = false;
71710         LDKRoutingFees val_conv;
71711         val_conv.inner = untag_ptr(val);
71712         val_conv.is_owned = ptr_is_owned(val);
71713         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
71714         val_conv = RoutingFees_clone(&val_conv);
71715         RouteHintHop_set_fees(&this_ptr_conv, val_conv);
71716 }
71717
71718 int16_t  __attribute__((export_name("TS_RouteHintHop_get_cltv_expiry_delta"))) TS_RouteHintHop_get_cltv_expiry_delta(uint64_t this_ptr) {
71719         LDKRouteHintHop this_ptr_conv;
71720         this_ptr_conv.inner = untag_ptr(this_ptr);
71721         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71723         this_ptr_conv.is_owned = false;
71724         int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
71725         return ret_conv;
71726 }
71727
71728 void  __attribute__((export_name("TS_RouteHintHop_set_cltv_expiry_delta"))) TS_RouteHintHop_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
71729         LDKRouteHintHop this_ptr_conv;
71730         this_ptr_conv.inner = untag_ptr(this_ptr);
71731         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71733         this_ptr_conv.is_owned = false;
71734         RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
71735 }
71736
71737 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_htlc_minimum_msat"))) TS_RouteHintHop_get_htlc_minimum_msat(uint64_t this_ptr) {
71738         LDKRouteHintHop this_ptr_conv;
71739         this_ptr_conv.inner = untag_ptr(this_ptr);
71740         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71742         this_ptr_conv.is_owned = false;
71743         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
71744         *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
71745         uint64_t ret_ref = tag_ptr(ret_copy, true);
71746         return ret_ref;
71747 }
71748
71749 void  __attribute__((export_name("TS_RouteHintHop_set_htlc_minimum_msat"))) TS_RouteHintHop_set_htlc_minimum_msat(uint64_t this_ptr, uint64_t val) {
71750         LDKRouteHintHop this_ptr_conv;
71751         this_ptr_conv.inner = untag_ptr(this_ptr);
71752         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71754         this_ptr_conv.is_owned = false;
71755         void* val_ptr = untag_ptr(val);
71756         CHECK_ACCESS(val_ptr);
71757         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
71758         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
71759         RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
71760 }
71761
71762 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_htlc_maximum_msat"))) TS_RouteHintHop_get_htlc_maximum_msat(uint64_t this_ptr) {
71763         LDKRouteHintHop this_ptr_conv;
71764         this_ptr_conv.inner = untag_ptr(this_ptr);
71765         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71767         this_ptr_conv.is_owned = false;
71768         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
71769         *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
71770         uint64_t ret_ref = tag_ptr(ret_copy, true);
71771         return ret_ref;
71772 }
71773
71774 void  __attribute__((export_name("TS_RouteHintHop_set_htlc_maximum_msat"))) TS_RouteHintHop_set_htlc_maximum_msat(uint64_t this_ptr, uint64_t val) {
71775         LDKRouteHintHop this_ptr_conv;
71776         this_ptr_conv.inner = untag_ptr(this_ptr);
71777         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71779         this_ptr_conv.is_owned = false;
71780         void* val_ptr = untag_ptr(val);
71781         CHECK_ACCESS(val_ptr);
71782         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
71783         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
71784         RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
71785 }
71786
71787 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) {
71788         LDKPublicKey src_node_id_arg_ref;
71789         CHECK(src_node_id_arg->arr_len == 33);
71790         memcpy(src_node_id_arg_ref.compressed_form, src_node_id_arg->elems, 33); FREE(src_node_id_arg);
71791         LDKRoutingFees fees_arg_conv;
71792         fees_arg_conv.inner = untag_ptr(fees_arg);
71793         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
71794         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
71795         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
71796         void* htlc_minimum_msat_arg_ptr = untag_ptr(htlc_minimum_msat_arg);
71797         CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
71798         LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
71799         htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_minimum_msat_arg));
71800         void* htlc_maximum_msat_arg_ptr = untag_ptr(htlc_maximum_msat_arg);
71801         CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
71802         LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
71803         htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat_arg));
71804         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);
71805         uint64_t ret_ref = 0;
71806         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71807         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71808         return ret_ref;
71809 }
71810
71811 static inline uint64_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
71812         LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
71813         uint64_t ret_ref = 0;
71814         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71815         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71816         return ret_ref;
71817 }
71818 int64_t  __attribute__((export_name("TS_RouteHintHop_clone_ptr"))) TS_RouteHintHop_clone_ptr(uint64_t arg) {
71819         LDKRouteHintHop arg_conv;
71820         arg_conv.inner = untag_ptr(arg);
71821         arg_conv.is_owned = ptr_is_owned(arg);
71822         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71823         arg_conv.is_owned = false;
71824         int64_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
71825         return ret_conv;
71826 }
71827
71828 uint64_t  __attribute__((export_name("TS_RouteHintHop_clone"))) TS_RouteHintHop_clone(uint64_t orig) {
71829         LDKRouteHintHop orig_conv;
71830         orig_conv.inner = untag_ptr(orig);
71831         orig_conv.is_owned = ptr_is_owned(orig);
71832         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71833         orig_conv.is_owned = false;
71834         LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
71835         uint64_t ret_ref = 0;
71836         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71837         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71838         return ret_ref;
71839 }
71840
71841 int64_t  __attribute__((export_name("TS_RouteHintHop_hash"))) TS_RouteHintHop_hash(uint64_t o) {
71842         LDKRouteHintHop o_conv;
71843         o_conv.inner = untag_ptr(o);
71844         o_conv.is_owned = ptr_is_owned(o);
71845         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
71846         o_conv.is_owned = false;
71847         int64_t ret_conv = RouteHintHop_hash(&o_conv);
71848         return ret_conv;
71849 }
71850
71851 jboolean  __attribute__((export_name("TS_RouteHintHop_eq"))) TS_RouteHintHop_eq(uint64_t a, uint64_t b) {
71852         LDKRouteHintHop a_conv;
71853         a_conv.inner = untag_ptr(a);
71854         a_conv.is_owned = ptr_is_owned(a);
71855         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
71856         a_conv.is_owned = false;
71857         LDKRouteHintHop b_conv;
71858         b_conv.inner = untag_ptr(b);
71859         b_conv.is_owned = ptr_is_owned(b);
71860         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
71861         b_conv.is_owned = false;
71862         jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
71863         return ret_conv;
71864 }
71865
71866 int8_tArray  __attribute__((export_name("TS_RouteHintHop_write"))) TS_RouteHintHop_write(uint64_t obj) {
71867         LDKRouteHintHop obj_conv;
71868         obj_conv.inner = untag_ptr(obj);
71869         obj_conv.is_owned = ptr_is_owned(obj);
71870         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71871         obj_conv.is_owned = false;
71872         LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
71873         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
71874         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
71875         CVec_u8Z_free(ret_var);
71876         return ret_arr;
71877 }
71878
71879 uint64_t  __attribute__((export_name("TS_RouteHintHop_read"))) TS_RouteHintHop_read(int8_tArray ser) {
71880         LDKu8slice ser_ref;
71881         ser_ref.datalen = ser->arr_len;
71882         ser_ref.data = ser->elems;
71883         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
71884         *ret_conv = RouteHintHop_read(ser_ref);
71885         FREE(ser);
71886         return tag_ptr(ret_conv, true);
71887 }
71888
71889 void  __attribute__((export_name("TS_FirstHopCandidate_free"))) TS_FirstHopCandidate_free(uint64_t this_obj) {
71890         LDKFirstHopCandidate this_obj_conv;
71891         this_obj_conv.inner = untag_ptr(this_obj);
71892         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71894         FirstHopCandidate_free(this_obj_conv);
71895 }
71896
71897 static inline uint64_t FirstHopCandidate_clone_ptr(LDKFirstHopCandidate *NONNULL_PTR arg) {
71898         LDKFirstHopCandidate ret_var = FirstHopCandidate_clone(arg);
71899         uint64_t ret_ref = 0;
71900         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71901         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71902         return ret_ref;
71903 }
71904 int64_t  __attribute__((export_name("TS_FirstHopCandidate_clone_ptr"))) TS_FirstHopCandidate_clone_ptr(uint64_t arg) {
71905         LDKFirstHopCandidate arg_conv;
71906         arg_conv.inner = untag_ptr(arg);
71907         arg_conv.is_owned = ptr_is_owned(arg);
71908         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71909         arg_conv.is_owned = false;
71910         int64_t ret_conv = FirstHopCandidate_clone_ptr(&arg_conv);
71911         return ret_conv;
71912 }
71913
71914 uint64_t  __attribute__((export_name("TS_FirstHopCandidate_clone"))) TS_FirstHopCandidate_clone(uint64_t orig) {
71915         LDKFirstHopCandidate orig_conv;
71916         orig_conv.inner = untag_ptr(orig);
71917         orig_conv.is_owned = ptr_is_owned(orig);
71918         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71919         orig_conv.is_owned = false;
71920         LDKFirstHopCandidate ret_var = FirstHopCandidate_clone(&orig_conv);
71921         uint64_t ret_ref = 0;
71922         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71923         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71924         return ret_ref;
71925 }
71926
71927 void  __attribute__((export_name("TS_PublicHopCandidate_free"))) TS_PublicHopCandidate_free(uint64_t this_obj) {
71928         LDKPublicHopCandidate this_obj_conv;
71929         this_obj_conv.inner = untag_ptr(this_obj);
71930         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71932         PublicHopCandidate_free(this_obj_conv);
71933 }
71934
71935 int64_t  __attribute__((export_name("TS_PublicHopCandidate_get_short_channel_id"))) TS_PublicHopCandidate_get_short_channel_id(uint64_t this_ptr) {
71936         LDKPublicHopCandidate this_ptr_conv;
71937         this_ptr_conv.inner = untag_ptr(this_ptr);
71938         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71940         this_ptr_conv.is_owned = false;
71941         int64_t ret_conv = PublicHopCandidate_get_short_channel_id(&this_ptr_conv);
71942         return ret_conv;
71943 }
71944
71945 void  __attribute__((export_name("TS_PublicHopCandidate_set_short_channel_id"))) TS_PublicHopCandidate_set_short_channel_id(uint64_t this_ptr, int64_t val) {
71946         LDKPublicHopCandidate this_ptr_conv;
71947         this_ptr_conv.inner = untag_ptr(this_ptr);
71948         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71950         this_ptr_conv.is_owned = false;
71951         PublicHopCandidate_set_short_channel_id(&this_ptr_conv, val);
71952 }
71953
71954 static inline uint64_t PublicHopCandidate_clone_ptr(LDKPublicHopCandidate *NONNULL_PTR arg) {
71955         LDKPublicHopCandidate ret_var = PublicHopCandidate_clone(arg);
71956         uint64_t ret_ref = 0;
71957         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71958         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71959         return ret_ref;
71960 }
71961 int64_t  __attribute__((export_name("TS_PublicHopCandidate_clone_ptr"))) TS_PublicHopCandidate_clone_ptr(uint64_t arg) {
71962         LDKPublicHopCandidate arg_conv;
71963         arg_conv.inner = untag_ptr(arg);
71964         arg_conv.is_owned = ptr_is_owned(arg);
71965         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71966         arg_conv.is_owned = false;
71967         int64_t ret_conv = PublicHopCandidate_clone_ptr(&arg_conv);
71968         return ret_conv;
71969 }
71970
71971 uint64_t  __attribute__((export_name("TS_PublicHopCandidate_clone"))) TS_PublicHopCandidate_clone(uint64_t orig) {
71972         LDKPublicHopCandidate orig_conv;
71973         orig_conv.inner = untag_ptr(orig);
71974         orig_conv.is_owned = ptr_is_owned(orig);
71975         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71976         orig_conv.is_owned = false;
71977         LDKPublicHopCandidate ret_var = PublicHopCandidate_clone(&orig_conv);
71978         uint64_t ret_ref = 0;
71979         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71980         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71981         return ret_ref;
71982 }
71983
71984 void  __attribute__((export_name("TS_PrivateHopCandidate_free"))) TS_PrivateHopCandidate_free(uint64_t this_obj) {
71985         LDKPrivateHopCandidate this_obj_conv;
71986         this_obj_conv.inner = untag_ptr(this_obj);
71987         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71989         PrivateHopCandidate_free(this_obj_conv);
71990 }
71991
71992 static inline uint64_t PrivateHopCandidate_clone_ptr(LDKPrivateHopCandidate *NONNULL_PTR arg) {
71993         LDKPrivateHopCandidate ret_var = PrivateHopCandidate_clone(arg);
71994         uint64_t ret_ref = 0;
71995         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71996         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71997         return ret_ref;
71998 }
71999 int64_t  __attribute__((export_name("TS_PrivateHopCandidate_clone_ptr"))) TS_PrivateHopCandidate_clone_ptr(uint64_t arg) {
72000         LDKPrivateHopCandidate arg_conv;
72001         arg_conv.inner = untag_ptr(arg);
72002         arg_conv.is_owned = ptr_is_owned(arg);
72003         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72004         arg_conv.is_owned = false;
72005         int64_t ret_conv = PrivateHopCandidate_clone_ptr(&arg_conv);
72006         return ret_conv;
72007 }
72008
72009 uint64_t  __attribute__((export_name("TS_PrivateHopCandidate_clone"))) TS_PrivateHopCandidate_clone(uint64_t orig) {
72010         LDKPrivateHopCandidate orig_conv;
72011         orig_conv.inner = untag_ptr(orig);
72012         orig_conv.is_owned = ptr_is_owned(orig);
72013         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72014         orig_conv.is_owned = false;
72015         LDKPrivateHopCandidate ret_var = PrivateHopCandidate_clone(&orig_conv);
72016         uint64_t ret_ref = 0;
72017         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72018         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72019         return ret_ref;
72020 }
72021
72022 void  __attribute__((export_name("TS_BlindedPathCandidate_free"))) TS_BlindedPathCandidate_free(uint64_t this_obj) {
72023         LDKBlindedPathCandidate this_obj_conv;
72024         this_obj_conv.inner = untag_ptr(this_obj);
72025         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72027         BlindedPathCandidate_free(this_obj_conv);
72028 }
72029
72030 static inline uint64_t BlindedPathCandidate_clone_ptr(LDKBlindedPathCandidate *NONNULL_PTR arg) {
72031         LDKBlindedPathCandidate ret_var = BlindedPathCandidate_clone(arg);
72032         uint64_t ret_ref = 0;
72033         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72034         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72035         return ret_ref;
72036 }
72037 int64_t  __attribute__((export_name("TS_BlindedPathCandidate_clone_ptr"))) TS_BlindedPathCandidate_clone_ptr(uint64_t arg) {
72038         LDKBlindedPathCandidate arg_conv;
72039         arg_conv.inner = untag_ptr(arg);
72040         arg_conv.is_owned = ptr_is_owned(arg);
72041         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72042         arg_conv.is_owned = false;
72043         int64_t ret_conv = BlindedPathCandidate_clone_ptr(&arg_conv);
72044         return ret_conv;
72045 }
72046
72047 uint64_t  __attribute__((export_name("TS_BlindedPathCandidate_clone"))) TS_BlindedPathCandidate_clone(uint64_t orig) {
72048         LDKBlindedPathCandidate orig_conv;
72049         orig_conv.inner = untag_ptr(orig);
72050         orig_conv.is_owned = ptr_is_owned(orig);
72051         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72052         orig_conv.is_owned = false;
72053         LDKBlindedPathCandidate ret_var = BlindedPathCandidate_clone(&orig_conv);
72054         uint64_t ret_ref = 0;
72055         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72056         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72057         return ret_ref;
72058 }
72059
72060 void  __attribute__((export_name("TS_OneHopBlindedPathCandidate_free"))) TS_OneHopBlindedPathCandidate_free(uint64_t this_obj) {
72061         LDKOneHopBlindedPathCandidate this_obj_conv;
72062         this_obj_conv.inner = untag_ptr(this_obj);
72063         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72065         OneHopBlindedPathCandidate_free(this_obj_conv);
72066 }
72067
72068 static inline uint64_t OneHopBlindedPathCandidate_clone_ptr(LDKOneHopBlindedPathCandidate *NONNULL_PTR arg) {
72069         LDKOneHopBlindedPathCandidate ret_var = OneHopBlindedPathCandidate_clone(arg);
72070         uint64_t ret_ref = 0;
72071         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72072         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72073         return ret_ref;
72074 }
72075 int64_t  __attribute__((export_name("TS_OneHopBlindedPathCandidate_clone_ptr"))) TS_OneHopBlindedPathCandidate_clone_ptr(uint64_t arg) {
72076         LDKOneHopBlindedPathCandidate arg_conv;
72077         arg_conv.inner = untag_ptr(arg);
72078         arg_conv.is_owned = ptr_is_owned(arg);
72079         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72080         arg_conv.is_owned = false;
72081         int64_t ret_conv = OneHopBlindedPathCandidate_clone_ptr(&arg_conv);
72082         return ret_conv;
72083 }
72084
72085 uint64_t  __attribute__((export_name("TS_OneHopBlindedPathCandidate_clone"))) TS_OneHopBlindedPathCandidate_clone(uint64_t orig) {
72086         LDKOneHopBlindedPathCandidate orig_conv;
72087         orig_conv.inner = untag_ptr(orig);
72088         orig_conv.is_owned = ptr_is_owned(orig);
72089         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72090         orig_conv.is_owned = false;
72091         LDKOneHopBlindedPathCandidate ret_var = OneHopBlindedPathCandidate_clone(&orig_conv);
72092         uint64_t ret_ref = 0;
72093         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72094         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72095         return ret_ref;
72096 }
72097
72098 void  __attribute__((export_name("TS_CandidateRouteHop_free"))) TS_CandidateRouteHop_free(uint64_t this_ptr) {
72099         if (!ptr_is_owned(this_ptr)) return;
72100         void* this_ptr_ptr = untag_ptr(this_ptr);
72101         CHECK_ACCESS(this_ptr_ptr);
72102         LDKCandidateRouteHop this_ptr_conv = *(LDKCandidateRouteHop*)(this_ptr_ptr);
72103         FREE(untag_ptr(this_ptr));
72104         CandidateRouteHop_free(this_ptr_conv);
72105 }
72106
72107 static inline uint64_t CandidateRouteHop_clone_ptr(LDKCandidateRouteHop *NONNULL_PTR arg) {
72108         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
72109         *ret_copy = CandidateRouteHop_clone(arg);
72110         uint64_t ret_ref = tag_ptr(ret_copy, true);
72111         return ret_ref;
72112 }
72113 int64_t  __attribute__((export_name("TS_CandidateRouteHop_clone_ptr"))) TS_CandidateRouteHop_clone_ptr(uint64_t arg) {
72114         LDKCandidateRouteHop* arg_conv = (LDKCandidateRouteHop*)untag_ptr(arg);
72115         int64_t ret_conv = CandidateRouteHop_clone_ptr(arg_conv);
72116         return ret_conv;
72117 }
72118
72119 uint64_t  __attribute__((export_name("TS_CandidateRouteHop_clone"))) TS_CandidateRouteHop_clone(uint64_t orig) {
72120         LDKCandidateRouteHop* orig_conv = (LDKCandidateRouteHop*)untag_ptr(orig);
72121         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
72122         *ret_copy = CandidateRouteHop_clone(orig_conv);
72123         uint64_t ret_ref = tag_ptr(ret_copy, true);
72124         return ret_ref;
72125 }
72126
72127 uint64_t  __attribute__((export_name("TS_CandidateRouteHop_first_hop"))) TS_CandidateRouteHop_first_hop(uint64_t a) {
72128         LDKFirstHopCandidate a_conv;
72129         a_conv.inner = untag_ptr(a);
72130         a_conv.is_owned = ptr_is_owned(a);
72131         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
72132         a_conv = FirstHopCandidate_clone(&a_conv);
72133         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
72134         *ret_copy = CandidateRouteHop_first_hop(a_conv);
72135         uint64_t ret_ref = tag_ptr(ret_copy, true);
72136         return ret_ref;
72137 }
72138
72139 uint64_t  __attribute__((export_name("TS_CandidateRouteHop_public_hop"))) TS_CandidateRouteHop_public_hop(uint64_t a) {
72140         LDKPublicHopCandidate a_conv;
72141         a_conv.inner = untag_ptr(a);
72142         a_conv.is_owned = ptr_is_owned(a);
72143         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
72144         a_conv = PublicHopCandidate_clone(&a_conv);
72145         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
72146         *ret_copy = CandidateRouteHop_public_hop(a_conv);
72147         uint64_t ret_ref = tag_ptr(ret_copy, true);
72148         return ret_ref;
72149 }
72150
72151 uint64_t  __attribute__((export_name("TS_CandidateRouteHop_private_hop"))) TS_CandidateRouteHop_private_hop(uint64_t a) {
72152         LDKPrivateHopCandidate a_conv;
72153         a_conv.inner = untag_ptr(a);
72154         a_conv.is_owned = ptr_is_owned(a);
72155         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
72156         a_conv = PrivateHopCandidate_clone(&a_conv);
72157         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
72158         *ret_copy = CandidateRouteHop_private_hop(a_conv);
72159         uint64_t ret_ref = tag_ptr(ret_copy, true);
72160         return ret_ref;
72161 }
72162
72163 uint64_t  __attribute__((export_name("TS_CandidateRouteHop_blinded"))) TS_CandidateRouteHop_blinded(uint64_t a) {
72164         LDKBlindedPathCandidate a_conv;
72165         a_conv.inner = untag_ptr(a);
72166         a_conv.is_owned = ptr_is_owned(a);
72167         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
72168         a_conv = BlindedPathCandidate_clone(&a_conv);
72169         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
72170         *ret_copy = CandidateRouteHop_blinded(a_conv);
72171         uint64_t ret_ref = tag_ptr(ret_copy, true);
72172         return ret_ref;
72173 }
72174
72175 uint64_t  __attribute__((export_name("TS_CandidateRouteHop_one_hop_blinded"))) TS_CandidateRouteHop_one_hop_blinded(uint64_t a) {
72176         LDKOneHopBlindedPathCandidate a_conv;
72177         a_conv.inner = untag_ptr(a);
72178         a_conv.is_owned = ptr_is_owned(a);
72179         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
72180         a_conv = OneHopBlindedPathCandidate_clone(&a_conv);
72181         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
72182         *ret_copy = CandidateRouteHop_one_hop_blinded(a_conv);
72183         uint64_t ret_ref = tag_ptr(ret_copy, true);
72184         return ret_ref;
72185 }
72186
72187 uint64_t  __attribute__((export_name("TS_CandidateRouteHop_globally_unique_short_channel_id"))) TS_CandidateRouteHop_globally_unique_short_channel_id(uint64_t this_arg) {
72188         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
72189         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
72190         *ret_copy = CandidateRouteHop_globally_unique_short_channel_id(this_arg_conv);
72191         uint64_t ret_ref = tag_ptr(ret_copy, true);
72192         return ret_ref;
72193 }
72194
72195 int32_t  __attribute__((export_name("TS_CandidateRouteHop_cltv_expiry_delta"))) TS_CandidateRouteHop_cltv_expiry_delta(uint64_t this_arg) {
72196         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
72197         int32_t ret_conv = CandidateRouteHop_cltv_expiry_delta(this_arg_conv);
72198         return ret_conv;
72199 }
72200
72201 int64_t  __attribute__((export_name("TS_CandidateRouteHop_htlc_minimum_msat"))) TS_CandidateRouteHop_htlc_minimum_msat(uint64_t this_arg) {
72202         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
72203         int64_t ret_conv = CandidateRouteHop_htlc_minimum_msat(this_arg_conv);
72204         return ret_conv;
72205 }
72206
72207 uint64_t  __attribute__((export_name("TS_CandidateRouteHop_fees"))) TS_CandidateRouteHop_fees(uint64_t this_arg) {
72208         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
72209         LDKRoutingFees ret_var = CandidateRouteHop_fees(this_arg_conv);
72210         uint64_t ret_ref = 0;
72211         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72212         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72213         return ret_ref;
72214 }
72215
72216 uint64_t  __attribute__((export_name("TS_CandidateRouteHop_source"))) TS_CandidateRouteHop_source(uint64_t this_arg) {
72217         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
72218         LDKNodeId ret_var = CandidateRouteHop_source(this_arg_conv);
72219         uint64_t ret_ref = 0;
72220         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72221         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72222         return ret_ref;
72223 }
72224
72225 uint64_t  __attribute__((export_name("TS_CandidateRouteHop_target"))) TS_CandidateRouteHop_target(uint64_t this_arg) {
72226         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
72227         LDKNodeId ret_var = CandidateRouteHop_target(this_arg_conv);
72228         uint64_t ret_ref = 0;
72229         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72230         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72231         return ret_ref;
72232 }
72233
72234 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) {
72235         LDKPublicKey our_node_pubkey_ref;
72236         CHECK(our_node_pubkey->arr_len == 33);
72237         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
72238         LDKRouteParameters route_params_conv;
72239         route_params_conv.inner = untag_ptr(route_params);
72240         route_params_conv.is_owned = ptr_is_owned(route_params);
72241         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
72242         route_params_conv.is_owned = false;
72243         LDKNetworkGraph network_graph_conv;
72244         network_graph_conv.inner = untag_ptr(network_graph);
72245         network_graph_conv.is_owned = ptr_is_owned(network_graph);
72246         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
72247         network_graph_conv.is_owned = false;
72248         LDKCVec_ChannelDetailsZ first_hops_constr;
72249         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
72250         if (first_hops != 0) {
72251                 first_hops_constr.datalen = first_hops->arr_len;
72252                 if (first_hops_constr.datalen > 0)
72253                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
72254                 else
72255                         first_hops_constr.data = NULL;
72256                 uint64_t* first_hops_vals = first_hops->elems;
72257                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
72258                         uint64_t first_hops_conv_16 = first_hops_vals[q];
72259                         LDKChannelDetails first_hops_conv_16_conv;
72260                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
72261                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
72262                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
72263                         first_hops_conv_16_conv.is_owned = false;
72264                         first_hops_constr.data[q] = first_hops_conv_16_conv;
72265                 }
72266                 FREE(first_hops);
72267                 first_hops_ptr = &first_hops_constr;
72268         }
72269         void* logger_ptr = untag_ptr(logger);
72270         CHECK_ACCESS(logger_ptr);
72271         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
72272         if (logger_conv.free == LDKLogger_JCalls_free) {
72273                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
72274                 LDKLogger_JCalls_cloned(&logger_conv);
72275         }
72276         void* scorer_ptr = untag_ptr(scorer);
72277         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
72278         LDKScoreLookUp* scorer_conv = (LDKScoreLookUp*)scorer_ptr;
72279         LDKProbabilisticScoringFeeParameters score_params_conv;
72280         score_params_conv.inner = untag_ptr(score_params);
72281         score_params_conv.is_owned = ptr_is_owned(score_params);
72282         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
72283         score_params_conv.is_owned = false;
72284         uint8_t random_seed_bytes_arr[32];
72285         CHECK(random_seed_bytes->arr_len == 32);
72286         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
72287         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
72288         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
72289         *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);
72290         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
72291         return tag_ptr(ret_conv, true);
72292 }
72293
72294 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) {
72295         LDKPublicKey our_node_pubkey_ref;
72296         CHECK(our_node_pubkey->arr_len == 33);
72297         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
72298         LDKCVec_PublicKeyZ hops_constr;
72299         hops_constr.datalen = hops->arr_len;
72300         if (hops_constr.datalen > 0)
72301                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
72302         else
72303                 hops_constr.data = NULL;
72304         int8_tArray* hops_vals = (void*) hops->elems;
72305         for (size_t m = 0; m < hops_constr.datalen; m++) {
72306                 int8_tArray hops_conv_12 = hops_vals[m];
72307                 LDKPublicKey hops_conv_12_ref;
72308                 CHECK(hops_conv_12->arr_len == 33);
72309                 memcpy(hops_conv_12_ref.compressed_form, hops_conv_12->elems, 33); FREE(hops_conv_12);
72310                 hops_constr.data[m] = hops_conv_12_ref;
72311         }
72312         FREE(hops);
72313         LDKRouteParameters route_params_conv;
72314         route_params_conv.inner = untag_ptr(route_params);
72315         route_params_conv.is_owned = ptr_is_owned(route_params);
72316         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
72317         route_params_conv.is_owned = false;
72318         LDKNetworkGraph network_graph_conv;
72319         network_graph_conv.inner = untag_ptr(network_graph);
72320         network_graph_conv.is_owned = ptr_is_owned(network_graph);
72321         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
72322         network_graph_conv.is_owned = false;
72323         void* logger_ptr = untag_ptr(logger);
72324         CHECK_ACCESS(logger_ptr);
72325         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
72326         if (logger_conv.free == LDKLogger_JCalls_free) {
72327                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
72328                 LDKLogger_JCalls_cloned(&logger_conv);
72329         }
72330         uint8_t random_seed_bytes_arr[32];
72331         CHECK(random_seed_bytes->arr_len == 32);
72332         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
72333         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
72334         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
72335         *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
72336         return tag_ptr(ret_conv, true);
72337 }
72338
72339 void  __attribute__((export_name("TS_ScoreLookUp_free"))) TS_ScoreLookUp_free(uint64_t this_ptr) {
72340         if (!ptr_is_owned(this_ptr)) return;
72341         void* this_ptr_ptr = untag_ptr(this_ptr);
72342         CHECK_ACCESS(this_ptr_ptr);
72343         LDKScoreLookUp this_ptr_conv = *(LDKScoreLookUp*)(this_ptr_ptr);
72344         FREE(untag_ptr(this_ptr));
72345         ScoreLookUp_free(this_ptr_conv);
72346 }
72347
72348 void  __attribute__((export_name("TS_ScoreUpdate_free"))) TS_ScoreUpdate_free(uint64_t this_ptr) {
72349         if (!ptr_is_owned(this_ptr)) return;
72350         void* this_ptr_ptr = untag_ptr(this_ptr);
72351         CHECK_ACCESS(this_ptr_ptr);
72352         LDKScoreUpdate this_ptr_conv = *(LDKScoreUpdate*)(this_ptr_ptr);
72353         FREE(untag_ptr(this_ptr));
72354         ScoreUpdate_free(this_ptr_conv);
72355 }
72356
72357 void  __attribute__((export_name("TS_Score_free"))) TS_Score_free(uint64_t this_ptr) {
72358         if (!ptr_is_owned(this_ptr)) return;
72359         void* this_ptr_ptr = untag_ptr(this_ptr);
72360         CHECK_ACCESS(this_ptr_ptr);
72361         LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
72362         FREE(untag_ptr(this_ptr));
72363         Score_free(this_ptr_conv);
72364 }
72365
72366 void  __attribute__((export_name("TS_LockableScore_free"))) TS_LockableScore_free(uint64_t this_ptr) {
72367         if (!ptr_is_owned(this_ptr)) return;
72368         void* this_ptr_ptr = untag_ptr(this_ptr);
72369         CHECK_ACCESS(this_ptr_ptr);
72370         LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
72371         FREE(untag_ptr(this_ptr));
72372         LockableScore_free(this_ptr_conv);
72373 }
72374
72375 void  __attribute__((export_name("TS_WriteableScore_free"))) TS_WriteableScore_free(uint64_t this_ptr) {
72376         if (!ptr_is_owned(this_ptr)) return;
72377         void* this_ptr_ptr = untag_ptr(this_ptr);
72378         CHECK_ACCESS(this_ptr_ptr);
72379         LDKWriteableScore this_ptr_conv = *(LDKWriteableScore*)(this_ptr_ptr);
72380         FREE(untag_ptr(this_ptr));
72381         WriteableScore_free(this_ptr_conv);
72382 }
72383
72384 void  __attribute__((export_name("TS_MultiThreadedLockableScore_free"))) TS_MultiThreadedLockableScore_free(uint64_t this_obj) {
72385         LDKMultiThreadedLockableScore this_obj_conv;
72386         this_obj_conv.inner = untag_ptr(this_obj);
72387         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72389         MultiThreadedLockableScore_free(this_obj_conv);
72390 }
72391
72392 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_as_LockableScore"))) TS_MultiThreadedLockableScore_as_LockableScore(uint64_t this_arg) {
72393         LDKMultiThreadedLockableScore this_arg_conv;
72394         this_arg_conv.inner = untag_ptr(this_arg);
72395         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72397         this_arg_conv.is_owned = false;
72398         LDKLockableScore* ret_ret = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
72399         *ret_ret = MultiThreadedLockableScore_as_LockableScore(&this_arg_conv);
72400         return tag_ptr(ret_ret, true);
72401 }
72402
72403 int8_tArray  __attribute__((export_name("TS_MultiThreadedLockableScore_write"))) TS_MultiThreadedLockableScore_write(uint64_t obj) {
72404         LDKMultiThreadedLockableScore obj_conv;
72405         obj_conv.inner = untag_ptr(obj);
72406         obj_conv.is_owned = ptr_is_owned(obj);
72407         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
72408         obj_conv.is_owned = false;
72409         LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
72410         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
72411         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
72412         CVec_u8Z_free(ret_var);
72413         return ret_arr;
72414 }
72415
72416 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_as_WriteableScore"))) TS_MultiThreadedLockableScore_as_WriteableScore(uint64_t this_arg) {
72417         LDKMultiThreadedLockableScore this_arg_conv;
72418         this_arg_conv.inner = untag_ptr(this_arg);
72419         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72421         this_arg_conv.is_owned = false;
72422         LDKWriteableScore* ret_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
72423         *ret_ret = MultiThreadedLockableScore_as_WriteableScore(&this_arg_conv);
72424         return tag_ptr(ret_ret, true);
72425 }
72426
72427 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_new"))) TS_MultiThreadedLockableScore_new(uint64_t score) {
72428         void* score_ptr = untag_ptr(score);
72429         CHECK_ACCESS(score_ptr);
72430         LDKScore score_conv = *(LDKScore*)(score_ptr);
72431         if (score_conv.free == LDKScore_JCalls_free) {
72432                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
72433                 LDKScore_JCalls_cloned(&score_conv);
72434         }
72435         LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
72436         uint64_t ret_ref = 0;
72437         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72438         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72439         return ret_ref;
72440 }
72441
72442 void  __attribute__((export_name("TS_MultiThreadedScoreLockRead_free"))) TS_MultiThreadedScoreLockRead_free(uint64_t this_obj) {
72443         LDKMultiThreadedScoreLockRead this_obj_conv;
72444         this_obj_conv.inner = untag_ptr(this_obj);
72445         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72447         MultiThreadedScoreLockRead_free(this_obj_conv);
72448 }
72449
72450 void  __attribute__((export_name("TS_MultiThreadedScoreLockWrite_free"))) TS_MultiThreadedScoreLockWrite_free(uint64_t this_obj) {
72451         LDKMultiThreadedScoreLockWrite this_obj_conv;
72452         this_obj_conv.inner = untag_ptr(this_obj);
72453         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72455         MultiThreadedScoreLockWrite_free(this_obj_conv);
72456 }
72457
72458 uint64_t  __attribute__((export_name("TS_MultiThreadedScoreLockRead_as_ScoreLookUp"))) TS_MultiThreadedScoreLockRead_as_ScoreLookUp(uint64_t this_arg) {
72459         LDKMultiThreadedScoreLockRead this_arg_conv;
72460         this_arg_conv.inner = untag_ptr(this_arg);
72461         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72463         this_arg_conv.is_owned = false;
72464         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
72465         *ret_ret = MultiThreadedScoreLockRead_as_ScoreLookUp(&this_arg_conv);
72466         return tag_ptr(ret_ret, true);
72467 }
72468
72469 int8_tArray  __attribute__((export_name("TS_MultiThreadedScoreLockWrite_write"))) TS_MultiThreadedScoreLockWrite_write(uint64_t obj) {
72470         LDKMultiThreadedScoreLockWrite obj_conv;
72471         obj_conv.inner = untag_ptr(obj);
72472         obj_conv.is_owned = ptr_is_owned(obj);
72473         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
72474         obj_conv.is_owned = false;
72475         LDKCVec_u8Z ret_var = MultiThreadedScoreLockWrite_write(&obj_conv);
72476         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
72477         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
72478         CVec_u8Z_free(ret_var);
72479         return ret_arr;
72480 }
72481
72482 uint64_t  __attribute__((export_name("TS_MultiThreadedScoreLockWrite_as_ScoreUpdate"))) TS_MultiThreadedScoreLockWrite_as_ScoreUpdate(uint64_t this_arg) {
72483         LDKMultiThreadedScoreLockWrite this_arg_conv;
72484         this_arg_conv.inner = untag_ptr(this_arg);
72485         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72487         this_arg_conv.is_owned = false;
72488         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
72489         *ret_ret = MultiThreadedScoreLockWrite_as_ScoreUpdate(&this_arg_conv);
72490         return tag_ptr(ret_ret, true);
72491 }
72492
72493 void  __attribute__((export_name("TS_ChannelUsage_free"))) TS_ChannelUsage_free(uint64_t this_obj) {
72494         LDKChannelUsage this_obj_conv;
72495         this_obj_conv.inner = untag_ptr(this_obj);
72496         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72498         ChannelUsage_free(this_obj_conv);
72499 }
72500
72501 int64_t  __attribute__((export_name("TS_ChannelUsage_get_amount_msat"))) TS_ChannelUsage_get_amount_msat(uint64_t this_ptr) {
72502         LDKChannelUsage this_ptr_conv;
72503         this_ptr_conv.inner = untag_ptr(this_ptr);
72504         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72506         this_ptr_conv.is_owned = false;
72507         int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
72508         return ret_conv;
72509 }
72510
72511 void  __attribute__((export_name("TS_ChannelUsage_set_amount_msat"))) TS_ChannelUsage_set_amount_msat(uint64_t this_ptr, int64_t val) {
72512         LDKChannelUsage this_ptr_conv;
72513         this_ptr_conv.inner = untag_ptr(this_ptr);
72514         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72516         this_ptr_conv.is_owned = false;
72517         ChannelUsage_set_amount_msat(&this_ptr_conv, val);
72518 }
72519
72520 int64_t  __attribute__((export_name("TS_ChannelUsage_get_inflight_htlc_msat"))) TS_ChannelUsage_get_inflight_htlc_msat(uint64_t this_ptr) {
72521         LDKChannelUsage this_ptr_conv;
72522         this_ptr_conv.inner = untag_ptr(this_ptr);
72523         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72525         this_ptr_conv.is_owned = false;
72526         int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
72527         return ret_conv;
72528 }
72529
72530 void  __attribute__((export_name("TS_ChannelUsage_set_inflight_htlc_msat"))) TS_ChannelUsage_set_inflight_htlc_msat(uint64_t this_ptr, int64_t val) {
72531         LDKChannelUsage this_ptr_conv;
72532         this_ptr_conv.inner = untag_ptr(this_ptr);
72533         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72535         this_ptr_conv.is_owned = false;
72536         ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
72537 }
72538
72539 uint64_t  __attribute__((export_name("TS_ChannelUsage_get_effective_capacity"))) TS_ChannelUsage_get_effective_capacity(uint64_t this_ptr) {
72540         LDKChannelUsage this_ptr_conv;
72541         this_ptr_conv.inner = untag_ptr(this_ptr);
72542         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72544         this_ptr_conv.is_owned = false;
72545         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
72546         *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
72547         uint64_t ret_ref = tag_ptr(ret_copy, true);
72548         return ret_ref;
72549 }
72550
72551 void  __attribute__((export_name("TS_ChannelUsage_set_effective_capacity"))) TS_ChannelUsage_set_effective_capacity(uint64_t this_ptr, uint64_t val) {
72552         LDKChannelUsage this_ptr_conv;
72553         this_ptr_conv.inner = untag_ptr(this_ptr);
72554         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72556         this_ptr_conv.is_owned = false;
72557         void* val_ptr = untag_ptr(val);
72558         CHECK_ACCESS(val_ptr);
72559         LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
72560         val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(val));
72561         ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
72562 }
72563
72564 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) {
72565         void* effective_capacity_arg_ptr = untag_ptr(effective_capacity_arg);
72566         CHECK_ACCESS(effective_capacity_arg_ptr);
72567         LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
72568         effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(effective_capacity_arg));
72569         LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
72570         uint64_t ret_ref = 0;
72571         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72572         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72573         return ret_ref;
72574 }
72575
72576 static inline uint64_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
72577         LDKChannelUsage ret_var = ChannelUsage_clone(arg);
72578         uint64_t ret_ref = 0;
72579         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72580         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72581         return ret_ref;
72582 }
72583 int64_t  __attribute__((export_name("TS_ChannelUsage_clone_ptr"))) TS_ChannelUsage_clone_ptr(uint64_t arg) {
72584         LDKChannelUsage arg_conv;
72585         arg_conv.inner = untag_ptr(arg);
72586         arg_conv.is_owned = ptr_is_owned(arg);
72587         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72588         arg_conv.is_owned = false;
72589         int64_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
72590         return ret_conv;
72591 }
72592
72593 uint64_t  __attribute__((export_name("TS_ChannelUsage_clone"))) TS_ChannelUsage_clone(uint64_t orig) {
72594         LDKChannelUsage orig_conv;
72595         orig_conv.inner = untag_ptr(orig);
72596         orig_conv.is_owned = ptr_is_owned(orig);
72597         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72598         orig_conv.is_owned = false;
72599         LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
72600         uint64_t ret_ref = 0;
72601         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72602         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72603         return ret_ref;
72604 }
72605
72606 void  __attribute__((export_name("TS_FixedPenaltyScorer_free"))) TS_FixedPenaltyScorer_free(uint64_t this_obj) {
72607         LDKFixedPenaltyScorer this_obj_conv;
72608         this_obj_conv.inner = untag_ptr(this_obj);
72609         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72611         FixedPenaltyScorer_free(this_obj_conv);
72612 }
72613
72614 static inline uint64_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
72615         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
72616         uint64_t ret_ref = 0;
72617         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72618         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72619         return ret_ref;
72620 }
72621 int64_t  __attribute__((export_name("TS_FixedPenaltyScorer_clone_ptr"))) TS_FixedPenaltyScorer_clone_ptr(uint64_t arg) {
72622         LDKFixedPenaltyScorer arg_conv;
72623         arg_conv.inner = untag_ptr(arg);
72624         arg_conv.is_owned = ptr_is_owned(arg);
72625         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72626         arg_conv.is_owned = false;
72627         int64_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
72628         return ret_conv;
72629 }
72630
72631 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_clone"))) TS_FixedPenaltyScorer_clone(uint64_t orig) {
72632         LDKFixedPenaltyScorer orig_conv;
72633         orig_conv.inner = untag_ptr(orig);
72634         orig_conv.is_owned = ptr_is_owned(orig);
72635         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72636         orig_conv.is_owned = false;
72637         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
72638         uint64_t ret_ref = 0;
72639         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72640         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72641         return ret_ref;
72642 }
72643
72644 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_with_penalty"))) TS_FixedPenaltyScorer_with_penalty(int64_t penalty_msat) {
72645         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
72646         uint64_t ret_ref = 0;
72647         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72648         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72649         return ret_ref;
72650 }
72651
72652 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_as_ScoreLookUp"))) TS_FixedPenaltyScorer_as_ScoreLookUp(uint64_t this_arg) {
72653         LDKFixedPenaltyScorer this_arg_conv;
72654         this_arg_conv.inner = untag_ptr(this_arg);
72655         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72657         this_arg_conv.is_owned = false;
72658         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
72659         *ret_ret = FixedPenaltyScorer_as_ScoreLookUp(&this_arg_conv);
72660         return tag_ptr(ret_ret, true);
72661 }
72662
72663 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_as_ScoreUpdate"))) TS_FixedPenaltyScorer_as_ScoreUpdate(uint64_t this_arg) {
72664         LDKFixedPenaltyScorer this_arg_conv;
72665         this_arg_conv.inner = untag_ptr(this_arg);
72666         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72668         this_arg_conv.is_owned = false;
72669         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
72670         *ret_ret = FixedPenaltyScorer_as_ScoreUpdate(&this_arg_conv);
72671         return tag_ptr(ret_ret, true);
72672 }
72673
72674 int8_tArray  __attribute__((export_name("TS_FixedPenaltyScorer_write"))) TS_FixedPenaltyScorer_write(uint64_t obj) {
72675         LDKFixedPenaltyScorer obj_conv;
72676         obj_conv.inner = untag_ptr(obj);
72677         obj_conv.is_owned = ptr_is_owned(obj);
72678         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
72679         obj_conv.is_owned = false;
72680         LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
72681         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
72682         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
72683         CVec_u8Z_free(ret_var);
72684         return ret_arr;
72685 }
72686
72687 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_read"))) TS_FixedPenaltyScorer_read(int8_tArray ser, int64_t arg) {
72688         LDKu8slice ser_ref;
72689         ser_ref.datalen = ser->arr_len;
72690         ser_ref.data = ser->elems;
72691         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
72692         *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
72693         FREE(ser);
72694         return tag_ptr(ret_conv, true);
72695 }
72696
72697 void  __attribute__((export_name("TS_ProbabilisticScorer_free"))) TS_ProbabilisticScorer_free(uint64_t this_obj) {
72698         LDKProbabilisticScorer this_obj_conv;
72699         this_obj_conv.inner = untag_ptr(this_obj);
72700         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72702         ProbabilisticScorer_free(this_obj_conv);
72703 }
72704
72705 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_free"))) TS_ProbabilisticScoringFeeParameters_free(uint64_t this_obj) {
72706         LDKProbabilisticScoringFeeParameters this_obj_conv;
72707         this_obj_conv.inner = untag_ptr(this_obj);
72708         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72710         ProbabilisticScoringFeeParameters_free(this_obj_conv);
72711 }
72712
72713 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_base_penalty_msat"))) TS_ProbabilisticScoringFeeParameters_get_base_penalty_msat(uint64_t this_ptr) {
72714         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72715         this_ptr_conv.inner = untag_ptr(this_ptr);
72716         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72718         this_ptr_conv.is_owned = false;
72719         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_base_penalty_msat(&this_ptr_conv);
72720         return ret_conv;
72721 }
72722
72723 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_set_base_penalty_msat"))) TS_ProbabilisticScoringFeeParameters_set_base_penalty_msat(uint64_t this_ptr, int64_t val) {
72724         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72725         this_ptr_conv.inner = untag_ptr(this_ptr);
72726         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72728         this_ptr_conv.is_owned = false;
72729         ProbabilisticScoringFeeParameters_set_base_penalty_msat(&this_ptr_conv, val);
72730 }
72731
72732 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) {
72733         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72734         this_ptr_conv.inner = untag_ptr(this_ptr);
72735         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72737         this_ptr_conv.is_owned = false;
72738         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_base_penalty_amount_multiplier_msat(&this_ptr_conv);
72739         return ret_conv;
72740 }
72741
72742 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) {
72743         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72744         this_ptr_conv.inner = untag_ptr(this_ptr);
72745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72747         this_ptr_conv.is_owned = false;
72748         ProbabilisticScoringFeeParameters_set_base_penalty_amount_multiplier_msat(&this_ptr_conv, val);
72749 }
72750
72751 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat"))) TS_ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat(uint64_t this_ptr) {
72752         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72753         this_ptr_conv.inner = untag_ptr(this_ptr);
72754         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72756         this_ptr_conv.is_owned = false;
72757         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
72758         return ret_conv;
72759 }
72760
72761 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) {
72762         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72763         this_ptr_conv.inner = untag_ptr(this_ptr);
72764         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72766         this_ptr_conv.is_owned = false;
72767         ProbabilisticScoringFeeParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
72768 }
72769
72770 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) {
72771         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72772         this_ptr_conv.inner = untag_ptr(this_ptr);
72773         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72775         this_ptr_conv.is_owned = false;
72776         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
72777         return ret_conv;
72778 }
72779
72780 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) {
72781         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72782         this_ptr_conv.inner = untag_ptr(this_ptr);
72783         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72785         this_ptr_conv.is_owned = false;
72786         ProbabilisticScoringFeeParameters_set_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
72787 }
72788
72789 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) {
72790         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72791         this_ptr_conv.inner = untag_ptr(this_ptr);
72792         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72794         this_ptr_conv.is_owned = false;
72795         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv);
72796         return ret_conv;
72797 }
72798
72799 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) {
72800         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72801         this_ptr_conv.inner = untag_ptr(this_ptr);
72802         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72804         this_ptr_conv.is_owned = false;
72805         ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
72806 }
72807
72808 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) {
72809         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72810         this_ptr_conv.inner = untag_ptr(this_ptr);
72811         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72813         this_ptr_conv.is_owned = false;
72814         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
72815         return ret_conv;
72816 }
72817
72818 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) {
72819         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72820         this_ptr_conv.inner = untag_ptr(this_ptr);
72821         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72823         this_ptr_conv.is_owned = false;
72824         ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
72825 }
72826
72827 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat"))) TS_ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat(uint64_t this_ptr) {
72828         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72829         this_ptr_conv.inner = untag_ptr(this_ptr);
72830         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72832         this_ptr_conv.is_owned = false;
72833         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat(&this_ptr_conv);
72834         return ret_conv;
72835 }
72836
72837 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) {
72838         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72839         this_ptr_conv.inner = untag_ptr(this_ptr);
72840         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72842         this_ptr_conv.is_owned = false;
72843         ProbabilisticScoringFeeParameters_set_anti_probing_penalty_msat(&this_ptr_conv, val);
72844 }
72845
72846 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat"))) TS_ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat(uint64_t this_ptr) {
72847         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72848         this_ptr_conv.inner = untag_ptr(this_ptr);
72849         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72851         this_ptr_conv.is_owned = false;
72852         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat(&this_ptr_conv);
72853         return ret_conv;
72854 }
72855
72856 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) {
72857         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72858         this_ptr_conv.inner = untag_ptr(this_ptr);
72859         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72861         this_ptr_conv.is_owned = false;
72862         ProbabilisticScoringFeeParameters_set_considered_impossible_penalty_msat(&this_ptr_conv, val);
72863 }
72864
72865 jboolean  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_linear_success_probability"))) TS_ProbabilisticScoringFeeParameters_get_linear_success_probability(uint64_t this_ptr) {
72866         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72867         this_ptr_conv.inner = untag_ptr(this_ptr);
72868         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72870         this_ptr_conv.is_owned = false;
72871         jboolean ret_conv = ProbabilisticScoringFeeParameters_get_linear_success_probability(&this_ptr_conv);
72872         return ret_conv;
72873 }
72874
72875 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_set_linear_success_probability"))) TS_ProbabilisticScoringFeeParameters_set_linear_success_probability(uint64_t this_ptr, jboolean val) {
72876         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72877         this_ptr_conv.inner = untag_ptr(this_ptr);
72878         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72880         this_ptr_conv.is_owned = false;
72881         ProbabilisticScoringFeeParameters_set_linear_success_probability(&this_ptr_conv, val);
72882 }
72883
72884 static inline uint64_t ProbabilisticScoringFeeParameters_clone_ptr(LDKProbabilisticScoringFeeParameters *NONNULL_PTR arg) {
72885         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_clone(arg);
72886         uint64_t ret_ref = 0;
72887         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72888         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72889         return ret_ref;
72890 }
72891 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_clone_ptr"))) TS_ProbabilisticScoringFeeParameters_clone_ptr(uint64_t arg) {
72892         LDKProbabilisticScoringFeeParameters arg_conv;
72893         arg_conv.inner = untag_ptr(arg);
72894         arg_conv.is_owned = ptr_is_owned(arg);
72895         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72896         arg_conv.is_owned = false;
72897         int64_t ret_conv = ProbabilisticScoringFeeParameters_clone_ptr(&arg_conv);
72898         return ret_conv;
72899 }
72900
72901 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_clone"))) TS_ProbabilisticScoringFeeParameters_clone(uint64_t orig) {
72902         LDKProbabilisticScoringFeeParameters orig_conv;
72903         orig_conv.inner = untag_ptr(orig);
72904         orig_conv.is_owned = ptr_is_owned(orig);
72905         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72906         orig_conv.is_owned = false;
72907         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_clone(&orig_conv);
72908         uint64_t ret_ref = 0;
72909         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72910         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72911         return ret_ref;
72912 }
72913
72914 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_default"))) TS_ProbabilisticScoringFeeParameters_default() {
72915         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_default();
72916         uint64_t ret_ref = 0;
72917         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72918         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72919         return ret_ref;
72920 }
72921
72922 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_add_banned"))) TS_ProbabilisticScoringFeeParameters_add_banned(uint64_t this_arg, uint64_t node_id) {
72923         LDKProbabilisticScoringFeeParameters this_arg_conv;
72924         this_arg_conv.inner = untag_ptr(this_arg);
72925         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72927         this_arg_conv.is_owned = false;
72928         LDKNodeId node_id_conv;
72929         node_id_conv.inner = untag_ptr(node_id);
72930         node_id_conv.is_owned = ptr_is_owned(node_id);
72931         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
72932         node_id_conv.is_owned = false;
72933         ProbabilisticScoringFeeParameters_add_banned(&this_arg_conv, &node_id_conv);
72934 }
72935
72936 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_add_banned_from_list"))) TS_ProbabilisticScoringFeeParameters_add_banned_from_list(uint64_t this_arg, uint64_tArray node_ids) {
72937         LDKProbabilisticScoringFeeParameters this_arg_conv;
72938         this_arg_conv.inner = untag_ptr(this_arg);
72939         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72941         this_arg_conv.is_owned = false;
72942         LDKCVec_NodeIdZ node_ids_constr;
72943         node_ids_constr.datalen = node_ids->arr_len;
72944         if (node_ids_constr.datalen > 0)
72945                 node_ids_constr.data = MALLOC(node_ids_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
72946         else
72947                 node_ids_constr.data = NULL;
72948         uint64_t* node_ids_vals = node_ids->elems;
72949         for (size_t i = 0; i < node_ids_constr.datalen; i++) {
72950                 uint64_t node_ids_conv_8 = node_ids_vals[i];
72951                 LDKNodeId node_ids_conv_8_conv;
72952                 node_ids_conv_8_conv.inner = untag_ptr(node_ids_conv_8);
72953                 node_ids_conv_8_conv.is_owned = ptr_is_owned(node_ids_conv_8);
72954                 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_ids_conv_8_conv);
72955                 node_ids_conv_8_conv = NodeId_clone(&node_ids_conv_8_conv);
72956                 node_ids_constr.data[i] = node_ids_conv_8_conv;
72957         }
72958         FREE(node_ids);
72959         ProbabilisticScoringFeeParameters_add_banned_from_list(&this_arg_conv, node_ids_constr);
72960 }
72961
72962 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_remove_banned"))) TS_ProbabilisticScoringFeeParameters_remove_banned(uint64_t this_arg, uint64_t node_id) {
72963         LDKProbabilisticScoringFeeParameters this_arg_conv;
72964         this_arg_conv.inner = untag_ptr(this_arg);
72965         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72967         this_arg_conv.is_owned = false;
72968         LDKNodeId node_id_conv;
72969         node_id_conv.inner = untag_ptr(node_id);
72970         node_id_conv.is_owned = ptr_is_owned(node_id);
72971         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
72972         node_id_conv.is_owned = false;
72973         ProbabilisticScoringFeeParameters_remove_banned(&this_arg_conv, &node_id_conv);
72974 }
72975
72976 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) {
72977         LDKProbabilisticScoringFeeParameters this_arg_conv;
72978         this_arg_conv.inner = untag_ptr(this_arg);
72979         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72981         this_arg_conv.is_owned = false;
72982         LDKNodeId node_id_conv;
72983         node_id_conv.inner = untag_ptr(node_id);
72984         node_id_conv.is_owned = ptr_is_owned(node_id);
72985         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
72986         node_id_conv.is_owned = false;
72987         ProbabilisticScoringFeeParameters_set_manual_penalty(&this_arg_conv, &node_id_conv, penalty);
72988 }
72989
72990 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_remove_manual_penalty"))) TS_ProbabilisticScoringFeeParameters_remove_manual_penalty(uint64_t this_arg, uint64_t node_id) {
72991         LDKProbabilisticScoringFeeParameters this_arg_conv;
72992         this_arg_conv.inner = untag_ptr(this_arg);
72993         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72995         this_arg_conv.is_owned = false;
72996         LDKNodeId node_id_conv;
72997         node_id_conv.inner = untag_ptr(node_id);
72998         node_id_conv.is_owned = ptr_is_owned(node_id);
72999         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
73000         node_id_conv.is_owned = false;
73001         ProbabilisticScoringFeeParameters_remove_manual_penalty(&this_arg_conv, &node_id_conv);
73002 }
73003
73004 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_clear_manual_penalties"))) TS_ProbabilisticScoringFeeParameters_clear_manual_penalties(uint64_t this_arg) {
73005         LDKProbabilisticScoringFeeParameters this_arg_conv;
73006         this_arg_conv.inner = untag_ptr(this_arg);
73007         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73009         this_arg_conv.is_owned = false;
73010         ProbabilisticScoringFeeParameters_clear_manual_penalties(&this_arg_conv);
73011 }
73012
73013 void  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_free"))) TS_ProbabilisticScoringDecayParameters_free(uint64_t this_obj) {
73014         LDKProbabilisticScoringDecayParameters this_obj_conv;
73015         this_obj_conv.inner = untag_ptr(this_obj);
73016         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73018         ProbabilisticScoringDecayParameters_free(this_obj_conv);
73019 }
73020
73021 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) {
73022         LDKProbabilisticScoringDecayParameters this_ptr_conv;
73023         this_ptr_conv.inner = untag_ptr(this_ptr);
73024         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73026         this_ptr_conv.is_owned = false;
73027         int64_t ret_conv = ProbabilisticScoringDecayParameters_get_historical_no_updates_half_life(&this_ptr_conv);
73028         return ret_conv;
73029 }
73030
73031 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) {
73032         LDKProbabilisticScoringDecayParameters this_ptr_conv;
73033         this_ptr_conv.inner = untag_ptr(this_ptr);
73034         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73036         this_ptr_conv.is_owned = false;
73037         ProbabilisticScoringDecayParameters_set_historical_no_updates_half_life(&this_ptr_conv, val);
73038 }
73039
73040 int64_t  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life"))) TS_ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life(uint64_t this_ptr) {
73041         LDKProbabilisticScoringDecayParameters this_ptr_conv;
73042         this_ptr_conv.inner = untag_ptr(this_ptr);
73043         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73045         this_ptr_conv.is_owned = false;
73046         int64_t ret_conv = ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life(&this_ptr_conv);
73047         return ret_conv;
73048 }
73049
73050 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) {
73051         LDKProbabilisticScoringDecayParameters this_ptr_conv;
73052         this_ptr_conv.inner = untag_ptr(this_ptr);
73053         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73055         this_ptr_conv.is_owned = false;
73056         ProbabilisticScoringDecayParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
73057 }
73058
73059 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) {
73060         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_new(historical_no_updates_half_life_arg, liquidity_offset_half_life_arg);
73061         uint64_t ret_ref = 0;
73062         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73063         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73064         return ret_ref;
73065 }
73066
73067 static inline uint64_t ProbabilisticScoringDecayParameters_clone_ptr(LDKProbabilisticScoringDecayParameters *NONNULL_PTR arg) {
73068         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_clone(arg);
73069         uint64_t ret_ref = 0;
73070         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73071         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73072         return ret_ref;
73073 }
73074 int64_t  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_clone_ptr"))) TS_ProbabilisticScoringDecayParameters_clone_ptr(uint64_t arg) {
73075         LDKProbabilisticScoringDecayParameters arg_conv;
73076         arg_conv.inner = untag_ptr(arg);
73077         arg_conv.is_owned = ptr_is_owned(arg);
73078         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73079         arg_conv.is_owned = false;
73080         int64_t ret_conv = ProbabilisticScoringDecayParameters_clone_ptr(&arg_conv);
73081         return ret_conv;
73082 }
73083
73084 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_clone"))) TS_ProbabilisticScoringDecayParameters_clone(uint64_t orig) {
73085         LDKProbabilisticScoringDecayParameters orig_conv;
73086         orig_conv.inner = untag_ptr(orig);
73087         orig_conv.is_owned = ptr_is_owned(orig);
73088         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73089         orig_conv.is_owned = false;
73090         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_clone(&orig_conv);
73091         uint64_t ret_ref = 0;
73092         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73093         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73094         return ret_ref;
73095 }
73096
73097 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_default"))) TS_ProbabilisticScoringDecayParameters_default() {
73098         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_default();
73099         uint64_t ret_ref = 0;
73100         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73101         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73102         return ret_ref;
73103 }
73104
73105 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_new"))) TS_ProbabilisticScorer_new(uint64_t decay_params, uint64_t network_graph, uint64_t logger) {
73106         LDKProbabilisticScoringDecayParameters decay_params_conv;
73107         decay_params_conv.inner = untag_ptr(decay_params);
73108         decay_params_conv.is_owned = ptr_is_owned(decay_params);
73109         CHECK_INNER_FIELD_ACCESS_OR_NULL(decay_params_conv);
73110         decay_params_conv = ProbabilisticScoringDecayParameters_clone(&decay_params_conv);
73111         LDKNetworkGraph network_graph_conv;
73112         network_graph_conv.inner = untag_ptr(network_graph);
73113         network_graph_conv.is_owned = ptr_is_owned(network_graph);
73114         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
73115         network_graph_conv.is_owned = false;
73116         void* logger_ptr = untag_ptr(logger);
73117         CHECK_ACCESS(logger_ptr);
73118         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
73119         if (logger_conv.free == LDKLogger_JCalls_free) {
73120                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
73121                 LDKLogger_JCalls_cloned(&logger_conv);
73122         }
73123         LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(decay_params_conv, &network_graph_conv, logger_conv);
73124         uint64_t ret_ref = 0;
73125         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73126         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73127         return ret_ref;
73128 }
73129
73130 void  __attribute__((export_name("TS_ProbabilisticScorer_debug_log_liquidity_stats"))) TS_ProbabilisticScorer_debug_log_liquidity_stats(uint64_t this_arg) {
73131         LDKProbabilisticScorer this_arg_conv;
73132         this_arg_conv.inner = untag_ptr(this_arg);
73133         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73135         this_arg_conv.is_owned = false;
73136         ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
73137 }
73138
73139 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) {
73140         LDKProbabilisticScorer this_arg_conv;
73141         this_arg_conv.inner = untag_ptr(this_arg);
73142         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73144         this_arg_conv.is_owned = false;
73145         LDKNodeId target_conv;
73146         target_conv.inner = untag_ptr(target);
73147         target_conv.is_owned = ptr_is_owned(target);
73148         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
73149         target_conv.is_owned = false;
73150         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
73151         *ret_copy = ProbabilisticScorer_estimated_channel_liquidity_range(&this_arg_conv, scid, &target_conv);
73152         uint64_t ret_ref = tag_ptr(ret_copy, true);
73153         return ret_ref;
73154 }
73155
73156 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) {
73157         LDKProbabilisticScorer this_arg_conv;
73158         this_arg_conv.inner = untag_ptr(this_arg);
73159         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73161         this_arg_conv.is_owned = false;
73162         LDKNodeId target_conv;
73163         target_conv.inner = untag_ptr(target);
73164         target_conv.is_owned = ptr_is_owned(target);
73165         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
73166         target_conv.is_owned = false;
73167         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
73168         *ret_copy = ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(&this_arg_conv, scid, &target_conv);
73169         uint64_t ret_ref = tag_ptr(ret_copy, true);
73170         return ret_ref;
73171 }
73172
73173 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) {
73174         LDKProbabilisticScorer this_arg_conv;
73175         this_arg_conv.inner = untag_ptr(this_arg);
73176         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73178         this_arg_conv.is_owned = false;
73179         LDKNodeId target_conv;
73180         target_conv.inner = untag_ptr(target);
73181         target_conv.is_owned = ptr_is_owned(target);
73182         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
73183         target_conv.is_owned = false;
73184         LDKProbabilisticScoringFeeParameters params_conv;
73185         params_conv.inner = untag_ptr(params);
73186         params_conv.is_owned = ptr_is_owned(params);
73187         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
73188         params_conv.is_owned = false;
73189         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
73190         *ret_copy = ProbabilisticScorer_historical_estimated_payment_success_probability(&this_arg_conv, scid, &target_conv, amount_msat, &params_conv);
73191         uint64_t ret_ref = tag_ptr(ret_copy, true);
73192         return ret_ref;
73193 }
73194
73195 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_as_ScoreLookUp"))) TS_ProbabilisticScorer_as_ScoreLookUp(uint64_t this_arg) {
73196         LDKProbabilisticScorer this_arg_conv;
73197         this_arg_conv.inner = untag_ptr(this_arg);
73198         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73200         this_arg_conv.is_owned = false;
73201         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
73202         *ret_ret = ProbabilisticScorer_as_ScoreLookUp(&this_arg_conv);
73203         return tag_ptr(ret_ret, true);
73204 }
73205
73206 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_as_ScoreUpdate"))) TS_ProbabilisticScorer_as_ScoreUpdate(uint64_t this_arg) {
73207         LDKProbabilisticScorer this_arg_conv;
73208         this_arg_conv.inner = untag_ptr(this_arg);
73209         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73211         this_arg_conv.is_owned = false;
73212         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
73213         *ret_ret = ProbabilisticScorer_as_ScoreUpdate(&this_arg_conv);
73214         return tag_ptr(ret_ret, true);
73215 }
73216
73217 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_as_Score"))) TS_ProbabilisticScorer_as_Score(uint64_t this_arg) {
73218         LDKProbabilisticScorer this_arg_conv;
73219         this_arg_conv.inner = untag_ptr(this_arg);
73220         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73222         this_arg_conv.is_owned = false;
73223         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
73224         *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
73225         return tag_ptr(ret_ret, true);
73226 }
73227
73228 int8_tArray  __attribute__((export_name("TS_ProbabilisticScorer_write"))) TS_ProbabilisticScorer_write(uint64_t obj) {
73229         LDKProbabilisticScorer obj_conv;
73230         obj_conv.inner = untag_ptr(obj);
73231         obj_conv.is_owned = ptr_is_owned(obj);
73232         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
73233         obj_conv.is_owned = false;
73234         LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
73235         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
73236         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
73237         CVec_u8Z_free(ret_var);
73238         return ret_arr;
73239 }
73240
73241 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) {
73242         LDKu8slice ser_ref;
73243         ser_ref.datalen = ser->arr_len;
73244         ser_ref.data = ser->elems;
73245         LDKProbabilisticScoringDecayParameters arg_a_conv;
73246         arg_a_conv.inner = untag_ptr(arg_a);
73247         arg_a_conv.is_owned = ptr_is_owned(arg_a);
73248         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
73249         arg_a_conv = ProbabilisticScoringDecayParameters_clone(&arg_a_conv);
73250         LDKNetworkGraph arg_b_conv;
73251         arg_b_conv.inner = untag_ptr(arg_b);
73252         arg_b_conv.is_owned = ptr_is_owned(arg_b);
73253         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
73254         arg_b_conv.is_owned = false;
73255         void* arg_c_ptr = untag_ptr(arg_c);
73256         CHECK_ACCESS(arg_c_ptr);
73257         LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
73258         if (arg_c_conv.free == LDKLogger_JCalls_free) {
73259                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
73260                 LDKLogger_JCalls_cloned(&arg_c_conv);
73261         }
73262         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
73263         *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
73264         FREE(ser);
73265         return tag_ptr(ret_conv, true);
73266 }
73267
73268 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_free"))) TS_DelayedPaymentOutputDescriptor_free(uint64_t this_obj) {
73269         LDKDelayedPaymentOutputDescriptor this_obj_conv;
73270         this_obj_conv.inner = untag_ptr(this_obj);
73271         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73273         DelayedPaymentOutputDescriptor_free(this_obj_conv);
73274 }
73275
73276 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_outpoint"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint64_t this_ptr) {
73277         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73278         this_ptr_conv.inner = untag_ptr(this_ptr);
73279         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73281         this_ptr_conv.is_owned = false;
73282         LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
73283         uint64_t ret_ref = 0;
73284         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73285         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73286         return ret_ref;
73287 }
73288
73289 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_outpoint"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
73290         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73291         this_ptr_conv.inner = untag_ptr(this_ptr);
73292         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73294         this_ptr_conv.is_owned = false;
73295         LDKOutPoint val_conv;
73296         val_conv.inner = untag_ptr(val);
73297         val_conv.is_owned = ptr_is_owned(val);
73298         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
73299         val_conv = OutPoint_clone(&val_conv);
73300         DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
73301 }
73302
73303 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint64_t this_ptr) {
73304         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73305         this_ptr_conv.inner = untag_ptr(this_ptr);
73306         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73308         this_ptr_conv.is_owned = false;
73309         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
73310         memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
73311         return ret_arr;
73312 }
73313
73314 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
73315         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73316         this_ptr_conv.inner = untag_ptr(this_ptr);
73317         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73319         this_ptr_conv.is_owned = false;
73320         LDKPublicKey val_ref;
73321         CHECK(val->arr_len == 33);
73322         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
73323         DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
73324 }
73325
73326 int16_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint64_t this_ptr) {
73327         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73328         this_ptr_conv.inner = untag_ptr(this_ptr);
73329         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73331         this_ptr_conv.is_owned = false;
73332         int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
73333         return ret_conv;
73334 }
73335
73336 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint64_t this_ptr, int16_t val) {
73337         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73338         this_ptr_conv.inner = untag_ptr(this_ptr);
73339         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73341         this_ptr_conv.is_owned = false;
73342         DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
73343 }
73344
73345 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_output"))) TS_DelayedPaymentOutputDescriptor_get_output(uint64_t this_ptr) {
73346         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73347         this_ptr_conv.inner = untag_ptr(this_ptr);
73348         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73350         this_ptr_conv.is_owned = false;
73351         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
73352         *ret_ref = DelayedPaymentOutputDescriptor_get_output(&this_ptr_conv);
73353         return tag_ptr(ret_ref, true);
73354 }
73355
73356 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_output"))) TS_DelayedPaymentOutputDescriptor_set_output(uint64_t this_ptr, uint64_t val) {
73357         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73358         this_ptr_conv.inner = untag_ptr(this_ptr);
73359         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73361         this_ptr_conv.is_owned = false;
73362         void* val_ptr = untag_ptr(val);
73363         CHECK_ACCESS(val_ptr);
73364         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
73365         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
73366         DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
73367 }
73368
73369 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint64_t this_ptr) {
73370         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73371         this_ptr_conv.inner = untag_ptr(this_ptr);
73372         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73374         this_ptr_conv.is_owned = false;
73375         LDKRevocationKey ret_var = DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv);
73376         uint64_t ret_ref = 0;
73377         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73378         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73379         return ret_ref;
73380 }
73381
73382 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint64_t this_ptr, uint64_t val) {
73383         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73384         this_ptr_conv.inner = untag_ptr(this_ptr);
73385         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73387         this_ptr_conv.is_owned = false;
73388         LDKRevocationKey val_conv;
73389         val_conv.inner = untag_ptr(val);
73390         val_conv.is_owned = ptr_is_owned(val);
73391         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
73392         val_conv = RevocationKey_clone(&val_conv);
73393         DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_conv);
73394 }
73395
73396 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint64_t this_ptr) {
73397         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73398         this_ptr_conv.inner = untag_ptr(this_ptr);
73399         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73401         this_ptr_conv.is_owned = false;
73402         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
73403         memcpy(ret_arr->elems, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
73404         return ret_arr;
73405 }
73406
73407 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint64_t this_ptr, int8_tArray val) {
73408         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73409         this_ptr_conv.inner = untag_ptr(this_ptr);
73410         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73412         this_ptr_conv.is_owned = false;
73413         LDKThirtyTwoBytes val_ref;
73414         CHECK(val->arr_len == 32);
73415         memcpy(val_ref.data, val->elems, 32); FREE(val);
73416         DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
73417 }
73418
73419 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint64_t this_ptr) {
73420         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73421         this_ptr_conv.inner = untag_ptr(this_ptr);
73422         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73424         this_ptr_conv.is_owned = false;
73425         int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
73426         return ret_conv;
73427 }
73428
73429 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
73430         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73431         this_ptr_conv.inner = untag_ptr(this_ptr);
73432         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73434         this_ptr_conv.is_owned = false;
73435         DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
73436 }
73437
73438 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_transaction_parameters"))) TS_DelayedPaymentOutputDescriptor_get_channel_transaction_parameters(uint64_t this_ptr) {
73439         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73440         this_ptr_conv.inner = untag_ptr(this_ptr);
73441         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73443         this_ptr_conv.is_owned = false;
73444         LDKChannelTransactionParameters ret_var = DelayedPaymentOutputDescriptor_get_channel_transaction_parameters(&this_ptr_conv);
73445         uint64_t ret_ref = 0;
73446         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73447         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73448         return ret_ref;
73449 }
73450
73451 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_transaction_parameters"))) TS_DelayedPaymentOutputDescriptor_set_channel_transaction_parameters(uint64_t this_ptr, uint64_t val) {
73452         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73453         this_ptr_conv.inner = untag_ptr(this_ptr);
73454         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73456         this_ptr_conv.is_owned = false;
73457         LDKChannelTransactionParameters val_conv;
73458         val_conv.inner = untag_ptr(val);
73459         val_conv.is_owned = ptr_is_owned(val);
73460         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
73461         val_conv = ChannelTransactionParameters_clone(&val_conv);
73462         DelayedPaymentOutputDescriptor_set_channel_transaction_parameters(&this_ptr_conv, val_conv);
73463 }
73464
73465 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) {
73466         LDKOutPoint outpoint_arg_conv;
73467         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
73468         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
73469         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
73470         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
73471         LDKPublicKey per_commitment_point_arg_ref;
73472         CHECK(per_commitment_point_arg->arr_len == 33);
73473         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
73474         void* output_arg_ptr = untag_ptr(output_arg);
73475         CHECK_ACCESS(output_arg_ptr);
73476         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
73477         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
73478         LDKRevocationKey revocation_pubkey_arg_conv;
73479         revocation_pubkey_arg_conv.inner = untag_ptr(revocation_pubkey_arg);
73480         revocation_pubkey_arg_conv.is_owned = ptr_is_owned(revocation_pubkey_arg);
73481         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_pubkey_arg_conv);
73482         revocation_pubkey_arg_conv = RevocationKey_clone(&revocation_pubkey_arg_conv);
73483         LDKThirtyTwoBytes channel_keys_id_arg_ref;
73484         CHECK(channel_keys_id_arg->arr_len == 32);
73485         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
73486         LDKChannelTransactionParameters channel_transaction_parameters_arg_conv;
73487         channel_transaction_parameters_arg_conv.inner = untag_ptr(channel_transaction_parameters_arg);
73488         channel_transaction_parameters_arg_conv.is_owned = ptr_is_owned(channel_transaction_parameters_arg);
73489         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_transaction_parameters_arg_conv);
73490         channel_transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&channel_transaction_parameters_arg_conv);
73491         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);
73492         uint64_t ret_ref = 0;
73493         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73494         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73495         return ret_ref;
73496 }
73497
73498 static inline uint64_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
73499         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
73500         uint64_t ret_ref = 0;
73501         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73502         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73503         return ret_ref;
73504 }
73505 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone_ptr"))) TS_DelayedPaymentOutputDescriptor_clone_ptr(uint64_t arg) {
73506         LDKDelayedPaymentOutputDescriptor arg_conv;
73507         arg_conv.inner = untag_ptr(arg);
73508         arg_conv.is_owned = ptr_is_owned(arg);
73509         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73510         arg_conv.is_owned = false;
73511         int64_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
73512         return ret_conv;
73513 }
73514
73515 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone"))) TS_DelayedPaymentOutputDescriptor_clone(uint64_t orig) {
73516         LDKDelayedPaymentOutputDescriptor orig_conv;
73517         orig_conv.inner = untag_ptr(orig);
73518         orig_conv.is_owned = ptr_is_owned(orig);
73519         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73520         orig_conv.is_owned = false;
73521         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
73522         uint64_t ret_ref = 0;
73523         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73524         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73525         return ret_ref;
73526 }
73527
73528 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_hash"))) TS_DelayedPaymentOutputDescriptor_hash(uint64_t o) {
73529         LDKDelayedPaymentOutputDescriptor o_conv;
73530         o_conv.inner = untag_ptr(o);
73531         o_conv.is_owned = ptr_is_owned(o);
73532         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
73533         o_conv.is_owned = false;
73534         int64_t ret_conv = DelayedPaymentOutputDescriptor_hash(&o_conv);
73535         return ret_conv;
73536 }
73537
73538 jboolean  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_eq"))) TS_DelayedPaymentOutputDescriptor_eq(uint64_t a, uint64_t b) {
73539         LDKDelayedPaymentOutputDescriptor a_conv;
73540         a_conv.inner = untag_ptr(a);
73541         a_conv.is_owned = ptr_is_owned(a);
73542         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73543         a_conv.is_owned = false;
73544         LDKDelayedPaymentOutputDescriptor b_conv;
73545         b_conv.inner = untag_ptr(b);
73546         b_conv.is_owned = ptr_is_owned(b);
73547         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
73548         b_conv.is_owned = false;
73549         jboolean ret_conv = DelayedPaymentOutputDescriptor_eq(&a_conv, &b_conv);
73550         return ret_conv;
73551 }
73552
73553 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_write"))) TS_DelayedPaymentOutputDescriptor_write(uint64_t obj) {
73554         LDKDelayedPaymentOutputDescriptor obj_conv;
73555         obj_conv.inner = untag_ptr(obj);
73556         obj_conv.is_owned = ptr_is_owned(obj);
73557         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
73558         obj_conv.is_owned = false;
73559         LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
73560         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
73561         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
73562         CVec_u8Z_free(ret_var);
73563         return ret_arr;
73564 }
73565
73566 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_read"))) TS_DelayedPaymentOutputDescriptor_read(int8_tArray ser) {
73567         LDKu8slice ser_ref;
73568         ser_ref.datalen = ser->arr_len;
73569         ser_ref.data = ser->elems;
73570         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
73571         *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
73572         FREE(ser);
73573         return tag_ptr(ret_conv, true);
73574 }
73575
73576 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_free"))) TS_StaticPaymentOutputDescriptor_free(uint64_t this_obj) {
73577         LDKStaticPaymentOutputDescriptor this_obj_conv;
73578         this_obj_conv.inner = untag_ptr(this_obj);
73579         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73581         StaticPaymentOutputDescriptor_free(this_obj_conv);
73582 }
73583
73584 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_outpoint"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint64_t this_ptr) {
73585         LDKStaticPaymentOutputDescriptor this_ptr_conv;
73586         this_ptr_conv.inner = untag_ptr(this_ptr);
73587         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73589         this_ptr_conv.is_owned = false;
73590         LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
73591         uint64_t ret_ref = 0;
73592         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73593         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73594         return ret_ref;
73595 }
73596
73597 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_outpoint"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
73598         LDKStaticPaymentOutputDescriptor this_ptr_conv;
73599         this_ptr_conv.inner = untag_ptr(this_ptr);
73600         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73602         this_ptr_conv.is_owned = false;
73603         LDKOutPoint val_conv;
73604         val_conv.inner = untag_ptr(val);
73605         val_conv.is_owned = ptr_is_owned(val);
73606         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
73607         val_conv = OutPoint_clone(&val_conv);
73608         StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
73609 }
73610
73611 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_output"))) TS_StaticPaymentOutputDescriptor_get_output(uint64_t this_ptr) {
73612         LDKStaticPaymentOutputDescriptor this_ptr_conv;
73613         this_ptr_conv.inner = untag_ptr(this_ptr);
73614         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73616         this_ptr_conv.is_owned = false;
73617         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
73618         *ret_ref = StaticPaymentOutputDescriptor_get_output(&this_ptr_conv);
73619         return tag_ptr(ret_ref, true);
73620 }
73621
73622 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_output"))) TS_StaticPaymentOutputDescriptor_set_output(uint64_t this_ptr, uint64_t val) {
73623         LDKStaticPaymentOutputDescriptor this_ptr_conv;
73624         this_ptr_conv.inner = untag_ptr(this_ptr);
73625         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73627         this_ptr_conv.is_owned = false;
73628         void* val_ptr = untag_ptr(val);
73629         CHECK_ACCESS(val_ptr);
73630         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
73631         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
73632         StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
73633 }
73634
73635 int8_tArray  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint64_t this_ptr) {
73636         LDKStaticPaymentOutputDescriptor this_ptr_conv;
73637         this_ptr_conv.inner = untag_ptr(this_ptr);
73638         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73640         this_ptr_conv.is_owned = false;
73641         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
73642         memcpy(ret_arr->elems, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
73643         return ret_arr;
73644 }
73645
73646 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint64_t this_ptr, int8_tArray val) {
73647         LDKStaticPaymentOutputDescriptor this_ptr_conv;
73648         this_ptr_conv.inner = untag_ptr(this_ptr);
73649         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73651         this_ptr_conv.is_owned = false;
73652         LDKThirtyTwoBytes val_ref;
73653         CHECK(val->arr_len == 32);
73654         memcpy(val_ref.data, val->elems, 32); FREE(val);
73655         StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
73656 }
73657
73658 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint64_t this_ptr) {
73659         LDKStaticPaymentOutputDescriptor this_ptr_conv;
73660         this_ptr_conv.inner = untag_ptr(this_ptr);
73661         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73663         this_ptr_conv.is_owned = false;
73664         int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
73665         return ret_conv;
73666 }
73667
73668 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
73669         LDKStaticPaymentOutputDescriptor this_ptr_conv;
73670         this_ptr_conv.inner = untag_ptr(this_ptr);
73671         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73673         this_ptr_conv.is_owned = false;
73674         StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
73675 }
73676
73677 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_transaction_parameters"))) TS_StaticPaymentOutputDescriptor_get_channel_transaction_parameters(uint64_t this_ptr) {
73678         LDKStaticPaymentOutputDescriptor this_ptr_conv;
73679         this_ptr_conv.inner = untag_ptr(this_ptr);
73680         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73682         this_ptr_conv.is_owned = false;
73683         LDKChannelTransactionParameters ret_var = StaticPaymentOutputDescriptor_get_channel_transaction_parameters(&this_ptr_conv);
73684         uint64_t ret_ref = 0;
73685         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73686         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73687         return ret_ref;
73688 }
73689
73690 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_transaction_parameters"))) TS_StaticPaymentOutputDescriptor_set_channel_transaction_parameters(uint64_t this_ptr, uint64_t val) {
73691         LDKStaticPaymentOutputDescriptor this_ptr_conv;
73692         this_ptr_conv.inner = untag_ptr(this_ptr);
73693         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73695         this_ptr_conv.is_owned = false;
73696         LDKChannelTransactionParameters val_conv;
73697         val_conv.inner = untag_ptr(val);
73698         val_conv.is_owned = ptr_is_owned(val);
73699         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
73700         val_conv = ChannelTransactionParameters_clone(&val_conv);
73701         StaticPaymentOutputDescriptor_set_channel_transaction_parameters(&this_ptr_conv, val_conv);
73702 }
73703
73704 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) {
73705         LDKOutPoint outpoint_arg_conv;
73706         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
73707         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
73708         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
73709         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
73710         void* output_arg_ptr = untag_ptr(output_arg);
73711         CHECK_ACCESS(output_arg_ptr);
73712         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
73713         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
73714         LDKThirtyTwoBytes channel_keys_id_arg_ref;
73715         CHECK(channel_keys_id_arg->arr_len == 32);
73716         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
73717         LDKChannelTransactionParameters channel_transaction_parameters_arg_conv;
73718         channel_transaction_parameters_arg_conv.inner = untag_ptr(channel_transaction_parameters_arg);
73719         channel_transaction_parameters_arg_conv.is_owned = ptr_is_owned(channel_transaction_parameters_arg);
73720         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_transaction_parameters_arg_conv);
73721         channel_transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&channel_transaction_parameters_arg_conv);
73722         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);
73723         uint64_t ret_ref = 0;
73724         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73725         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73726         return ret_ref;
73727 }
73728
73729 static inline uint64_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
73730         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
73731         uint64_t ret_ref = 0;
73732         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73733         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73734         return ret_ref;
73735 }
73736 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone_ptr"))) TS_StaticPaymentOutputDescriptor_clone_ptr(uint64_t arg) {
73737         LDKStaticPaymentOutputDescriptor arg_conv;
73738         arg_conv.inner = untag_ptr(arg);
73739         arg_conv.is_owned = ptr_is_owned(arg);
73740         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73741         arg_conv.is_owned = false;
73742         int64_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
73743         return ret_conv;
73744 }
73745
73746 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone"))) TS_StaticPaymentOutputDescriptor_clone(uint64_t orig) {
73747         LDKStaticPaymentOutputDescriptor orig_conv;
73748         orig_conv.inner = untag_ptr(orig);
73749         orig_conv.is_owned = ptr_is_owned(orig);
73750         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73751         orig_conv.is_owned = false;
73752         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
73753         uint64_t ret_ref = 0;
73754         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73755         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73756         return ret_ref;
73757 }
73758
73759 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_hash"))) TS_StaticPaymentOutputDescriptor_hash(uint64_t o) {
73760         LDKStaticPaymentOutputDescriptor o_conv;
73761         o_conv.inner = untag_ptr(o);
73762         o_conv.is_owned = ptr_is_owned(o);
73763         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
73764         o_conv.is_owned = false;
73765         int64_t ret_conv = StaticPaymentOutputDescriptor_hash(&o_conv);
73766         return ret_conv;
73767 }
73768
73769 jboolean  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_eq"))) TS_StaticPaymentOutputDescriptor_eq(uint64_t a, uint64_t b) {
73770         LDKStaticPaymentOutputDescriptor a_conv;
73771         a_conv.inner = untag_ptr(a);
73772         a_conv.is_owned = ptr_is_owned(a);
73773         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73774         a_conv.is_owned = false;
73775         LDKStaticPaymentOutputDescriptor b_conv;
73776         b_conv.inner = untag_ptr(b);
73777         b_conv.is_owned = ptr_is_owned(b);
73778         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
73779         b_conv.is_owned = false;
73780         jboolean ret_conv = StaticPaymentOutputDescriptor_eq(&a_conv, &b_conv);
73781         return ret_conv;
73782 }
73783
73784 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_witness_script"))) TS_StaticPaymentOutputDescriptor_witness_script(uint64_t this_arg) {
73785         LDKStaticPaymentOutputDescriptor this_arg_conv;
73786         this_arg_conv.inner = untag_ptr(this_arg);
73787         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73789         this_arg_conv.is_owned = false;
73790         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
73791         *ret_copy = StaticPaymentOutputDescriptor_witness_script(&this_arg_conv);
73792         uint64_t ret_ref = tag_ptr(ret_copy, true);
73793         return ret_ref;
73794 }
73795
73796 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_max_witness_length"))) TS_StaticPaymentOutputDescriptor_max_witness_length(uint64_t this_arg) {
73797         LDKStaticPaymentOutputDescriptor this_arg_conv;
73798         this_arg_conv.inner = untag_ptr(this_arg);
73799         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73801         this_arg_conv.is_owned = false;
73802         int64_t ret_conv = StaticPaymentOutputDescriptor_max_witness_length(&this_arg_conv);
73803         return ret_conv;
73804 }
73805
73806 int8_tArray  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_write"))) TS_StaticPaymentOutputDescriptor_write(uint64_t obj) {
73807         LDKStaticPaymentOutputDescriptor obj_conv;
73808         obj_conv.inner = untag_ptr(obj);
73809         obj_conv.is_owned = ptr_is_owned(obj);
73810         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
73811         obj_conv.is_owned = false;
73812         LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
73813         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
73814         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
73815         CVec_u8Z_free(ret_var);
73816         return ret_arr;
73817 }
73818
73819 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_read"))) TS_StaticPaymentOutputDescriptor_read(int8_tArray ser) {
73820         LDKu8slice ser_ref;
73821         ser_ref.datalen = ser->arr_len;
73822         ser_ref.data = ser->elems;
73823         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
73824         *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
73825         FREE(ser);
73826         return tag_ptr(ret_conv, true);
73827 }
73828
73829 void  __attribute__((export_name("TS_SpendableOutputDescriptor_free"))) TS_SpendableOutputDescriptor_free(uint64_t this_ptr) {
73830         if (!ptr_is_owned(this_ptr)) return;
73831         void* this_ptr_ptr = untag_ptr(this_ptr);
73832         CHECK_ACCESS(this_ptr_ptr);
73833         LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
73834         FREE(untag_ptr(this_ptr));
73835         SpendableOutputDescriptor_free(this_ptr_conv);
73836 }
73837
73838 static inline uint64_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
73839         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
73840         *ret_copy = SpendableOutputDescriptor_clone(arg);
73841         uint64_t ret_ref = tag_ptr(ret_copy, true);
73842         return ret_ref;
73843 }
73844 int64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_clone_ptr"))) TS_SpendableOutputDescriptor_clone_ptr(uint64_t arg) {
73845         LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)untag_ptr(arg);
73846         int64_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
73847         return ret_conv;
73848 }
73849
73850 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_clone"))) TS_SpendableOutputDescriptor_clone(uint64_t orig) {
73851         LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)untag_ptr(orig);
73852         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
73853         *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
73854         uint64_t ret_ref = tag_ptr(ret_copy, true);
73855         return ret_ref;
73856 }
73857
73858 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_static_output"))) TS_SpendableOutputDescriptor_static_output(uint64_t outpoint, uint64_t output, int8_tArray channel_keys_id) {
73859         LDKOutPoint outpoint_conv;
73860         outpoint_conv.inner = untag_ptr(outpoint);
73861         outpoint_conv.is_owned = ptr_is_owned(outpoint);
73862         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
73863         outpoint_conv = OutPoint_clone(&outpoint_conv);
73864         void* output_ptr = untag_ptr(output);
73865         CHECK_ACCESS(output_ptr);
73866         LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
73867         output_conv = TxOut_clone((LDKTxOut*)untag_ptr(output));
73868         LDKThirtyTwoBytes channel_keys_id_ref;
73869         CHECK(channel_keys_id->arr_len == 32);
73870         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
73871         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
73872         *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv, channel_keys_id_ref);
73873         uint64_t ret_ref = tag_ptr(ret_copy, true);
73874         return ret_ref;
73875 }
73876
73877 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_delayed_payment_output"))) TS_SpendableOutputDescriptor_delayed_payment_output(uint64_t a) {
73878         LDKDelayedPaymentOutputDescriptor a_conv;
73879         a_conv.inner = untag_ptr(a);
73880         a_conv.is_owned = ptr_is_owned(a);
73881         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73882         a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
73883         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
73884         *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
73885         uint64_t ret_ref = tag_ptr(ret_copy, true);
73886         return ret_ref;
73887 }
73888
73889 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_static_payment_output"))) TS_SpendableOutputDescriptor_static_payment_output(uint64_t a) {
73890         LDKStaticPaymentOutputDescriptor a_conv;
73891         a_conv.inner = untag_ptr(a);
73892         a_conv.is_owned = ptr_is_owned(a);
73893         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73894         a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
73895         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
73896         *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
73897         uint64_t ret_ref = tag_ptr(ret_copy, true);
73898         return ret_ref;
73899 }
73900
73901 int64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_hash"))) TS_SpendableOutputDescriptor_hash(uint64_t o) {
73902         LDKSpendableOutputDescriptor* o_conv = (LDKSpendableOutputDescriptor*)untag_ptr(o);
73903         int64_t ret_conv = SpendableOutputDescriptor_hash(o_conv);
73904         return ret_conv;
73905 }
73906
73907 jboolean  __attribute__((export_name("TS_SpendableOutputDescriptor_eq"))) TS_SpendableOutputDescriptor_eq(uint64_t a, uint64_t b) {
73908         LDKSpendableOutputDescriptor* a_conv = (LDKSpendableOutputDescriptor*)untag_ptr(a);
73909         LDKSpendableOutputDescriptor* b_conv = (LDKSpendableOutputDescriptor*)untag_ptr(b);
73910         jboolean ret_conv = SpendableOutputDescriptor_eq(a_conv, b_conv);
73911         return ret_conv;
73912 }
73913
73914 int8_tArray  __attribute__((export_name("TS_SpendableOutputDescriptor_write"))) TS_SpendableOutputDescriptor_write(uint64_t obj) {
73915         LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)untag_ptr(obj);
73916         LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
73917         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
73918         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
73919         CVec_u8Z_free(ret_var);
73920         return ret_arr;
73921 }
73922
73923 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_read"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
73924         LDKu8slice ser_ref;
73925         ser_ref.datalen = ser->arr_len;
73926         ser_ref.data = ser->elems;
73927         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
73928         *ret_conv = SpendableOutputDescriptor_read(ser_ref);
73929         FREE(ser);
73930         return tag_ptr(ret_conv, true);
73931 }
73932
73933 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) {
73934         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
73935         descriptors_constr.datalen = descriptors->arr_len;
73936         if (descriptors_constr.datalen > 0)
73937                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
73938         else
73939                 descriptors_constr.data = NULL;
73940         uint64_t* descriptors_vals = descriptors->elems;
73941         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
73942                 uint64_t descriptors_conv_27 = descriptors_vals[b];
73943                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
73944                 CHECK_ACCESS(descriptors_conv_27_ptr);
73945                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
73946                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
73947                 descriptors_constr.data[b] = descriptors_conv_27_conv;
73948         }
73949         FREE(descriptors);
73950         LDKCVec_TxOutZ outputs_constr;
73951         outputs_constr.datalen = outputs->arr_len;
73952         if (outputs_constr.datalen > 0)
73953                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
73954         else
73955                 outputs_constr.data = NULL;
73956         uint64_t* outputs_vals = outputs->elems;
73957         for (size_t h = 0; h < outputs_constr.datalen; h++) {
73958                 uint64_t outputs_conv_7 = outputs_vals[h];
73959                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
73960                 CHECK_ACCESS(outputs_conv_7_ptr);
73961                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
73962                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
73963                 outputs_constr.data[h] = outputs_conv_7_conv;
73964         }
73965         FREE(outputs);
73966         LDKCVec_u8Z change_destination_script_ref;
73967         change_destination_script_ref.datalen = change_destination_script->arr_len;
73968         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
73969         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
73970         void* locktime_ptr = untag_ptr(locktime);
73971         CHECK_ACCESS(locktime_ptr);
73972         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
73973         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
73974         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
73975         *ret_conv = SpendableOutputDescriptor_create_spendable_outputs_psbt(descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
73976         return tag_ptr(ret_conv, true);
73977 }
73978
73979 void  __attribute__((export_name("TS_ChannelDerivationParameters_free"))) TS_ChannelDerivationParameters_free(uint64_t this_obj) {
73980         LDKChannelDerivationParameters this_obj_conv;
73981         this_obj_conv.inner = untag_ptr(this_obj);
73982         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73984         ChannelDerivationParameters_free(this_obj_conv);
73985 }
73986
73987 int64_t  __attribute__((export_name("TS_ChannelDerivationParameters_get_value_satoshis"))) TS_ChannelDerivationParameters_get_value_satoshis(uint64_t this_ptr) {
73988         LDKChannelDerivationParameters this_ptr_conv;
73989         this_ptr_conv.inner = untag_ptr(this_ptr);
73990         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73992         this_ptr_conv.is_owned = false;
73993         int64_t ret_conv = ChannelDerivationParameters_get_value_satoshis(&this_ptr_conv);
73994         return ret_conv;
73995 }
73996
73997 void  __attribute__((export_name("TS_ChannelDerivationParameters_set_value_satoshis"))) TS_ChannelDerivationParameters_set_value_satoshis(uint64_t this_ptr, int64_t val) {
73998         LDKChannelDerivationParameters this_ptr_conv;
73999         this_ptr_conv.inner = untag_ptr(this_ptr);
74000         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74002         this_ptr_conv.is_owned = false;
74003         ChannelDerivationParameters_set_value_satoshis(&this_ptr_conv, val);
74004 }
74005
74006 int8_tArray  __attribute__((export_name("TS_ChannelDerivationParameters_get_keys_id"))) TS_ChannelDerivationParameters_get_keys_id(uint64_t this_ptr) {
74007         LDKChannelDerivationParameters this_ptr_conv;
74008         this_ptr_conv.inner = untag_ptr(this_ptr);
74009         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74011         this_ptr_conv.is_owned = false;
74012         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
74013         memcpy(ret_arr->elems, *ChannelDerivationParameters_get_keys_id(&this_ptr_conv), 32);
74014         return ret_arr;
74015 }
74016
74017 void  __attribute__((export_name("TS_ChannelDerivationParameters_set_keys_id"))) TS_ChannelDerivationParameters_set_keys_id(uint64_t this_ptr, int8_tArray val) {
74018         LDKChannelDerivationParameters this_ptr_conv;
74019         this_ptr_conv.inner = untag_ptr(this_ptr);
74020         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74022         this_ptr_conv.is_owned = false;
74023         LDKThirtyTwoBytes val_ref;
74024         CHECK(val->arr_len == 32);
74025         memcpy(val_ref.data, val->elems, 32); FREE(val);
74026         ChannelDerivationParameters_set_keys_id(&this_ptr_conv, val_ref);
74027 }
74028
74029 uint64_t  __attribute__((export_name("TS_ChannelDerivationParameters_get_transaction_parameters"))) TS_ChannelDerivationParameters_get_transaction_parameters(uint64_t this_ptr) {
74030         LDKChannelDerivationParameters this_ptr_conv;
74031         this_ptr_conv.inner = untag_ptr(this_ptr);
74032         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74034         this_ptr_conv.is_owned = false;
74035         LDKChannelTransactionParameters ret_var = ChannelDerivationParameters_get_transaction_parameters(&this_ptr_conv);
74036         uint64_t ret_ref = 0;
74037         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74038         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74039         return ret_ref;
74040 }
74041
74042 void  __attribute__((export_name("TS_ChannelDerivationParameters_set_transaction_parameters"))) TS_ChannelDerivationParameters_set_transaction_parameters(uint64_t this_ptr, uint64_t val) {
74043         LDKChannelDerivationParameters this_ptr_conv;
74044         this_ptr_conv.inner = untag_ptr(this_ptr);
74045         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74047         this_ptr_conv.is_owned = false;
74048         LDKChannelTransactionParameters val_conv;
74049         val_conv.inner = untag_ptr(val);
74050         val_conv.is_owned = ptr_is_owned(val);
74051         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
74052         val_conv = ChannelTransactionParameters_clone(&val_conv);
74053         ChannelDerivationParameters_set_transaction_parameters(&this_ptr_conv, val_conv);
74054 }
74055
74056 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) {
74057         LDKThirtyTwoBytes keys_id_arg_ref;
74058         CHECK(keys_id_arg->arr_len == 32);
74059         memcpy(keys_id_arg_ref.data, keys_id_arg->elems, 32); FREE(keys_id_arg);
74060         LDKChannelTransactionParameters transaction_parameters_arg_conv;
74061         transaction_parameters_arg_conv.inner = untag_ptr(transaction_parameters_arg);
74062         transaction_parameters_arg_conv.is_owned = ptr_is_owned(transaction_parameters_arg);
74063         CHECK_INNER_FIELD_ACCESS_OR_NULL(transaction_parameters_arg_conv);
74064         transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&transaction_parameters_arg_conv);
74065         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_new(value_satoshis_arg, keys_id_arg_ref, transaction_parameters_arg_conv);
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
74072 static inline uint64_t ChannelDerivationParameters_clone_ptr(LDKChannelDerivationParameters *NONNULL_PTR arg) {
74073         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(arg);
74074         uint64_t ret_ref = 0;
74075         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74076         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74077         return ret_ref;
74078 }
74079 int64_t  __attribute__((export_name("TS_ChannelDerivationParameters_clone_ptr"))) TS_ChannelDerivationParameters_clone_ptr(uint64_t arg) {
74080         LDKChannelDerivationParameters arg_conv;
74081         arg_conv.inner = untag_ptr(arg);
74082         arg_conv.is_owned = ptr_is_owned(arg);
74083         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74084         arg_conv.is_owned = false;
74085         int64_t ret_conv = ChannelDerivationParameters_clone_ptr(&arg_conv);
74086         return ret_conv;
74087 }
74088
74089 uint64_t  __attribute__((export_name("TS_ChannelDerivationParameters_clone"))) TS_ChannelDerivationParameters_clone(uint64_t orig) {
74090         LDKChannelDerivationParameters orig_conv;
74091         orig_conv.inner = untag_ptr(orig);
74092         orig_conv.is_owned = ptr_is_owned(orig);
74093         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74094         orig_conv.is_owned = false;
74095         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(&orig_conv);
74096         uint64_t ret_ref = 0;
74097         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74098         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74099         return ret_ref;
74100 }
74101
74102 jboolean  __attribute__((export_name("TS_ChannelDerivationParameters_eq"))) TS_ChannelDerivationParameters_eq(uint64_t a, uint64_t b) {
74103         LDKChannelDerivationParameters a_conv;
74104         a_conv.inner = untag_ptr(a);
74105         a_conv.is_owned = ptr_is_owned(a);
74106         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74107         a_conv.is_owned = false;
74108         LDKChannelDerivationParameters b_conv;
74109         b_conv.inner = untag_ptr(b);
74110         b_conv.is_owned = ptr_is_owned(b);
74111         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74112         b_conv.is_owned = false;
74113         jboolean ret_conv = ChannelDerivationParameters_eq(&a_conv, &b_conv);
74114         return ret_conv;
74115 }
74116
74117 int8_tArray  __attribute__((export_name("TS_ChannelDerivationParameters_write"))) TS_ChannelDerivationParameters_write(uint64_t obj) {
74118         LDKChannelDerivationParameters obj_conv;
74119         obj_conv.inner = untag_ptr(obj);
74120         obj_conv.is_owned = ptr_is_owned(obj);
74121         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
74122         obj_conv.is_owned = false;
74123         LDKCVec_u8Z ret_var = ChannelDerivationParameters_write(&obj_conv);
74124         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
74125         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
74126         CVec_u8Z_free(ret_var);
74127         return ret_arr;
74128 }
74129
74130 uint64_t  __attribute__((export_name("TS_ChannelDerivationParameters_read"))) TS_ChannelDerivationParameters_read(int8_tArray ser) {
74131         LDKu8slice ser_ref;
74132         ser_ref.datalen = ser->arr_len;
74133         ser_ref.data = ser->elems;
74134         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
74135         *ret_conv = ChannelDerivationParameters_read(ser_ref);
74136         FREE(ser);
74137         return tag_ptr(ret_conv, true);
74138 }
74139
74140 void  __attribute__((export_name("TS_HTLCDescriptor_free"))) TS_HTLCDescriptor_free(uint64_t this_obj) {
74141         LDKHTLCDescriptor this_obj_conv;
74142         this_obj_conv.inner = untag_ptr(this_obj);
74143         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74145         HTLCDescriptor_free(this_obj_conv);
74146 }
74147
74148 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_get_channel_derivation_parameters"))) TS_HTLCDescriptor_get_channel_derivation_parameters(uint64_t this_ptr) {
74149         LDKHTLCDescriptor this_ptr_conv;
74150         this_ptr_conv.inner = untag_ptr(this_ptr);
74151         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74153         this_ptr_conv.is_owned = false;
74154         LDKChannelDerivationParameters ret_var = HTLCDescriptor_get_channel_derivation_parameters(&this_ptr_conv);
74155         uint64_t ret_ref = 0;
74156         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74157         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74158         return ret_ref;
74159 }
74160
74161 void  __attribute__((export_name("TS_HTLCDescriptor_set_channel_derivation_parameters"))) TS_HTLCDescriptor_set_channel_derivation_parameters(uint64_t this_ptr, uint64_t val) {
74162         LDKHTLCDescriptor this_ptr_conv;
74163         this_ptr_conv.inner = untag_ptr(this_ptr);
74164         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74166         this_ptr_conv.is_owned = false;
74167         LDKChannelDerivationParameters val_conv;
74168         val_conv.inner = untag_ptr(val);
74169         val_conv.is_owned = ptr_is_owned(val);
74170         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
74171         val_conv = ChannelDerivationParameters_clone(&val_conv);
74172         HTLCDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv);
74173 }
74174
74175 int8_tArray  __attribute__((export_name("TS_HTLCDescriptor_get_commitment_txid"))) TS_HTLCDescriptor_get_commitment_txid(uint64_t this_ptr) {
74176         LDKHTLCDescriptor this_ptr_conv;
74177         this_ptr_conv.inner = untag_ptr(this_ptr);
74178         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74180         this_ptr_conv.is_owned = false;
74181         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
74182         memcpy(ret_arr->elems, *HTLCDescriptor_get_commitment_txid(&this_ptr_conv), 32);
74183         return ret_arr;
74184 }
74185
74186 void  __attribute__((export_name("TS_HTLCDescriptor_set_commitment_txid"))) TS_HTLCDescriptor_set_commitment_txid(uint64_t this_ptr, int8_tArray val) {
74187         LDKHTLCDescriptor this_ptr_conv;
74188         this_ptr_conv.inner = untag_ptr(this_ptr);
74189         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74191         this_ptr_conv.is_owned = false;
74192         LDKThirtyTwoBytes val_ref;
74193         CHECK(val->arr_len == 32);
74194         memcpy(val_ref.data, val->elems, 32); FREE(val);
74195         HTLCDescriptor_set_commitment_txid(&this_ptr_conv, val_ref);
74196 }
74197
74198 int64_t  __attribute__((export_name("TS_HTLCDescriptor_get_per_commitment_number"))) TS_HTLCDescriptor_get_per_commitment_number(uint64_t this_ptr) {
74199         LDKHTLCDescriptor this_ptr_conv;
74200         this_ptr_conv.inner = untag_ptr(this_ptr);
74201         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74203         this_ptr_conv.is_owned = false;
74204         int64_t ret_conv = HTLCDescriptor_get_per_commitment_number(&this_ptr_conv);
74205         return ret_conv;
74206 }
74207
74208 void  __attribute__((export_name("TS_HTLCDescriptor_set_per_commitment_number"))) TS_HTLCDescriptor_set_per_commitment_number(uint64_t this_ptr, int64_t val) {
74209         LDKHTLCDescriptor this_ptr_conv;
74210         this_ptr_conv.inner = untag_ptr(this_ptr);
74211         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74213         this_ptr_conv.is_owned = false;
74214         HTLCDescriptor_set_per_commitment_number(&this_ptr_conv, val);
74215 }
74216
74217 int8_tArray  __attribute__((export_name("TS_HTLCDescriptor_get_per_commitment_point"))) TS_HTLCDescriptor_get_per_commitment_point(uint64_t this_ptr) {
74218         LDKHTLCDescriptor this_ptr_conv;
74219         this_ptr_conv.inner = untag_ptr(this_ptr);
74220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74222         this_ptr_conv.is_owned = false;
74223         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
74224         memcpy(ret_arr->elems, HTLCDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
74225         return ret_arr;
74226 }
74227
74228 void  __attribute__((export_name("TS_HTLCDescriptor_set_per_commitment_point"))) TS_HTLCDescriptor_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
74229         LDKHTLCDescriptor this_ptr_conv;
74230         this_ptr_conv.inner = untag_ptr(this_ptr);
74231         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74233         this_ptr_conv.is_owned = false;
74234         LDKPublicKey val_ref;
74235         CHECK(val->arr_len == 33);
74236         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
74237         HTLCDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
74238 }
74239
74240 int32_t  __attribute__((export_name("TS_HTLCDescriptor_get_feerate_per_kw"))) TS_HTLCDescriptor_get_feerate_per_kw(uint64_t this_ptr) {
74241         LDKHTLCDescriptor this_ptr_conv;
74242         this_ptr_conv.inner = untag_ptr(this_ptr);
74243         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74245         this_ptr_conv.is_owned = false;
74246         int32_t ret_conv = HTLCDescriptor_get_feerate_per_kw(&this_ptr_conv);
74247         return ret_conv;
74248 }
74249
74250 void  __attribute__((export_name("TS_HTLCDescriptor_set_feerate_per_kw"))) TS_HTLCDescriptor_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
74251         LDKHTLCDescriptor this_ptr_conv;
74252         this_ptr_conv.inner = untag_ptr(this_ptr);
74253         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74255         this_ptr_conv.is_owned = false;
74256         HTLCDescriptor_set_feerate_per_kw(&this_ptr_conv, val);
74257 }
74258
74259 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_get_htlc"))) TS_HTLCDescriptor_get_htlc(uint64_t this_ptr) {
74260         LDKHTLCDescriptor this_ptr_conv;
74261         this_ptr_conv.inner = untag_ptr(this_ptr);
74262         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74264         this_ptr_conv.is_owned = false;
74265         LDKHTLCOutputInCommitment ret_var = HTLCDescriptor_get_htlc(&this_ptr_conv);
74266         uint64_t ret_ref = 0;
74267         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74268         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74269         return ret_ref;
74270 }
74271
74272 void  __attribute__((export_name("TS_HTLCDescriptor_set_htlc"))) TS_HTLCDescriptor_set_htlc(uint64_t this_ptr, uint64_t val) {
74273         LDKHTLCDescriptor this_ptr_conv;
74274         this_ptr_conv.inner = untag_ptr(this_ptr);
74275         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74277         this_ptr_conv.is_owned = false;
74278         LDKHTLCOutputInCommitment val_conv;
74279         val_conv.inner = untag_ptr(val);
74280         val_conv.is_owned = ptr_is_owned(val);
74281         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
74282         val_conv = HTLCOutputInCommitment_clone(&val_conv);
74283         HTLCDescriptor_set_htlc(&this_ptr_conv, val_conv);
74284 }
74285
74286 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_get_preimage"))) TS_HTLCDescriptor_get_preimage(uint64_t this_ptr) {
74287         LDKHTLCDescriptor this_ptr_conv;
74288         this_ptr_conv.inner = untag_ptr(this_ptr);
74289         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74291         this_ptr_conv.is_owned = false;
74292         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
74293         *ret_copy = HTLCDescriptor_get_preimage(&this_ptr_conv);
74294         uint64_t ret_ref = tag_ptr(ret_copy, true);
74295         return ret_ref;
74296 }
74297
74298 void  __attribute__((export_name("TS_HTLCDescriptor_set_preimage"))) TS_HTLCDescriptor_set_preimage(uint64_t this_ptr, uint64_t val) {
74299         LDKHTLCDescriptor this_ptr_conv;
74300         this_ptr_conv.inner = untag_ptr(this_ptr);
74301         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74303         this_ptr_conv.is_owned = false;
74304         void* val_ptr = untag_ptr(val);
74305         CHECK_ACCESS(val_ptr);
74306         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
74307         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
74308         HTLCDescriptor_set_preimage(&this_ptr_conv, val_conv);
74309 }
74310
74311 int8_tArray  __attribute__((export_name("TS_HTLCDescriptor_get_counterparty_sig"))) TS_HTLCDescriptor_get_counterparty_sig(uint64_t this_ptr) {
74312         LDKHTLCDescriptor this_ptr_conv;
74313         this_ptr_conv.inner = untag_ptr(this_ptr);
74314         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74316         this_ptr_conv.is_owned = false;
74317         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
74318         memcpy(ret_arr->elems, HTLCDescriptor_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
74319         return ret_arr;
74320 }
74321
74322 void  __attribute__((export_name("TS_HTLCDescriptor_set_counterparty_sig"))) TS_HTLCDescriptor_set_counterparty_sig(uint64_t this_ptr, int8_tArray val) {
74323         LDKHTLCDescriptor this_ptr_conv;
74324         this_ptr_conv.inner = untag_ptr(this_ptr);
74325         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74327         this_ptr_conv.is_owned = false;
74328         LDKECDSASignature val_ref;
74329         CHECK(val->arr_len == 64);
74330         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
74331         HTLCDescriptor_set_counterparty_sig(&this_ptr_conv, val_ref);
74332 }
74333
74334 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) {
74335         LDKChannelDerivationParameters channel_derivation_parameters_arg_conv;
74336         channel_derivation_parameters_arg_conv.inner = untag_ptr(channel_derivation_parameters_arg);
74337         channel_derivation_parameters_arg_conv.is_owned = ptr_is_owned(channel_derivation_parameters_arg);
74338         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_derivation_parameters_arg_conv);
74339         channel_derivation_parameters_arg_conv = ChannelDerivationParameters_clone(&channel_derivation_parameters_arg_conv);
74340         LDKThirtyTwoBytes commitment_txid_arg_ref;
74341         CHECK(commitment_txid_arg->arr_len == 32);
74342         memcpy(commitment_txid_arg_ref.data, commitment_txid_arg->elems, 32); FREE(commitment_txid_arg);
74343         LDKPublicKey per_commitment_point_arg_ref;
74344         CHECK(per_commitment_point_arg->arr_len == 33);
74345         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
74346         LDKHTLCOutputInCommitment htlc_arg_conv;
74347         htlc_arg_conv.inner = untag_ptr(htlc_arg);
74348         htlc_arg_conv.is_owned = ptr_is_owned(htlc_arg);
74349         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_arg_conv);
74350         htlc_arg_conv = HTLCOutputInCommitment_clone(&htlc_arg_conv);
74351         void* preimage_arg_ptr = untag_ptr(preimage_arg);
74352         CHECK_ACCESS(preimage_arg_ptr);
74353         LDKCOption_ThirtyTwoBytesZ preimage_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(preimage_arg_ptr);
74354         preimage_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(preimage_arg));
74355         LDKECDSASignature counterparty_sig_arg_ref;
74356         CHECK(counterparty_sig_arg->arr_len == 64);
74357         memcpy(counterparty_sig_arg_ref.compact_form, counterparty_sig_arg->elems, 64); FREE(counterparty_sig_arg);
74358         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);
74359         uint64_t ret_ref = 0;
74360         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74361         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74362         return ret_ref;
74363 }
74364
74365 static inline uint64_t HTLCDescriptor_clone_ptr(LDKHTLCDescriptor *NONNULL_PTR arg) {
74366         LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(arg);
74367         uint64_t ret_ref = 0;
74368         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74369         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74370         return ret_ref;
74371 }
74372 int64_t  __attribute__((export_name("TS_HTLCDescriptor_clone_ptr"))) TS_HTLCDescriptor_clone_ptr(uint64_t arg) {
74373         LDKHTLCDescriptor arg_conv;
74374         arg_conv.inner = untag_ptr(arg);
74375         arg_conv.is_owned = ptr_is_owned(arg);
74376         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74377         arg_conv.is_owned = false;
74378         int64_t ret_conv = HTLCDescriptor_clone_ptr(&arg_conv);
74379         return ret_conv;
74380 }
74381
74382 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_clone"))) TS_HTLCDescriptor_clone(uint64_t orig) {
74383         LDKHTLCDescriptor orig_conv;
74384         orig_conv.inner = untag_ptr(orig);
74385         orig_conv.is_owned = ptr_is_owned(orig);
74386         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74387         orig_conv.is_owned = false;
74388         LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(&orig_conv);
74389         uint64_t ret_ref = 0;
74390         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74391         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74392         return ret_ref;
74393 }
74394
74395 jboolean  __attribute__((export_name("TS_HTLCDescriptor_eq"))) TS_HTLCDescriptor_eq(uint64_t a, uint64_t b) {
74396         LDKHTLCDescriptor a_conv;
74397         a_conv.inner = untag_ptr(a);
74398         a_conv.is_owned = ptr_is_owned(a);
74399         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74400         a_conv.is_owned = false;
74401         LDKHTLCDescriptor b_conv;
74402         b_conv.inner = untag_ptr(b);
74403         b_conv.is_owned = ptr_is_owned(b);
74404         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74405         b_conv.is_owned = false;
74406         jboolean ret_conv = HTLCDescriptor_eq(&a_conv, &b_conv);
74407         return ret_conv;
74408 }
74409
74410 int8_tArray  __attribute__((export_name("TS_HTLCDescriptor_write"))) TS_HTLCDescriptor_write(uint64_t obj) {
74411         LDKHTLCDescriptor obj_conv;
74412         obj_conv.inner = untag_ptr(obj);
74413         obj_conv.is_owned = ptr_is_owned(obj);
74414         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
74415         obj_conv.is_owned = false;
74416         LDKCVec_u8Z ret_var = HTLCDescriptor_write(&obj_conv);
74417         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
74418         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
74419         CVec_u8Z_free(ret_var);
74420         return ret_arr;
74421 }
74422
74423 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_read"))) TS_HTLCDescriptor_read(int8_tArray ser) {
74424         LDKu8slice ser_ref;
74425         ser_ref.datalen = ser->arr_len;
74426         ser_ref.data = ser->elems;
74427         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
74428         *ret_conv = HTLCDescriptor_read(ser_ref);
74429         FREE(ser);
74430         return tag_ptr(ret_conv, true);
74431 }
74432
74433 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_outpoint"))) TS_HTLCDescriptor_outpoint(uint64_t this_arg) {
74434         LDKHTLCDescriptor this_arg_conv;
74435         this_arg_conv.inner = untag_ptr(this_arg);
74436         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74438         this_arg_conv.is_owned = false;
74439         LDKOutPoint ret_var = HTLCDescriptor_outpoint(&this_arg_conv);
74440         uint64_t ret_ref = 0;
74441         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74442         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74443         return ret_ref;
74444 }
74445
74446 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_previous_utxo"))) TS_HTLCDescriptor_previous_utxo(uint64_t this_arg) {
74447         LDKHTLCDescriptor this_arg_conv;
74448         this_arg_conv.inner = untag_ptr(this_arg);
74449         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74451         this_arg_conv.is_owned = false;
74452         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
74453         *ret_ref = HTLCDescriptor_previous_utxo(&this_arg_conv);
74454         return tag_ptr(ret_ref, true);
74455 }
74456
74457 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_unsigned_tx_input"))) TS_HTLCDescriptor_unsigned_tx_input(uint64_t this_arg) {
74458         LDKHTLCDescriptor this_arg_conv;
74459         this_arg_conv.inner = untag_ptr(this_arg);
74460         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74462         this_arg_conv.is_owned = false;
74463         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
74464         *ret_ref = HTLCDescriptor_unsigned_tx_input(&this_arg_conv);
74465         return tag_ptr(ret_ref, true);
74466 }
74467
74468 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_tx_output"))) TS_HTLCDescriptor_tx_output(uint64_t this_arg) {
74469         LDKHTLCDescriptor this_arg_conv;
74470         this_arg_conv.inner = untag_ptr(this_arg);
74471         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74473         this_arg_conv.is_owned = false;
74474         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
74475         *ret_ref = HTLCDescriptor_tx_output(&this_arg_conv);
74476         return tag_ptr(ret_ref, true);
74477 }
74478
74479 int8_tArray  __attribute__((export_name("TS_HTLCDescriptor_witness_script"))) TS_HTLCDescriptor_witness_script(uint64_t this_arg) {
74480         LDKHTLCDescriptor this_arg_conv;
74481         this_arg_conv.inner = untag_ptr(this_arg);
74482         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74484         this_arg_conv.is_owned = false;
74485         LDKCVec_u8Z ret_var = HTLCDescriptor_witness_script(&this_arg_conv);
74486         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
74487         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
74488         CVec_u8Z_free(ret_var);
74489         return ret_arr;
74490 }
74491
74492 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) {
74493         LDKHTLCDescriptor 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         LDKECDSASignature signature_ref;
74499         CHECK(signature->arr_len == 64);
74500         memcpy(signature_ref.compact_form, signature->elems, 64); FREE(signature);
74501         LDKu8slice witness_script_ref;
74502         witness_script_ref.datalen = witness_script->arr_len;
74503         witness_script_ref.data = witness_script->elems;
74504         LDKWitness ret_var = HTLCDescriptor_tx_input_witness(&this_arg_conv, signature_ref, witness_script_ref);
74505         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
74506         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
74507         Witness_free(ret_var);
74508         FREE(witness_script);
74509         return ret_arr;
74510 }
74511
74512 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_derive_channel_signer"))) TS_HTLCDescriptor_derive_channel_signer(uint64_t this_arg, uint64_t signer_provider) {
74513         LDKHTLCDescriptor this_arg_conv;
74514         this_arg_conv.inner = untag_ptr(this_arg);
74515         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74517         this_arg_conv.is_owned = false;
74518         void* signer_provider_ptr = untag_ptr(signer_provider);
74519         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
74520         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
74521         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
74522         *ret_ret = HTLCDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv);
74523         return tag_ptr(ret_ret, true);
74524 }
74525
74526 void  __attribute__((export_name("TS_ChannelSigner_free"))) TS_ChannelSigner_free(uint64_t this_ptr) {
74527         if (!ptr_is_owned(this_ptr)) return;
74528         void* this_ptr_ptr = untag_ptr(this_ptr);
74529         CHECK_ACCESS(this_ptr_ptr);
74530         LDKChannelSigner this_ptr_conv = *(LDKChannelSigner*)(this_ptr_ptr);
74531         FREE(untag_ptr(this_ptr));
74532         ChannelSigner_free(this_ptr_conv);
74533 }
74534
74535 uint32_t  __attribute__((export_name("TS_Recipient_clone"))) TS_Recipient_clone(uint64_t orig) {
74536         LDKRecipient* orig_conv = (LDKRecipient*)untag_ptr(orig);
74537         uint32_t ret_conv = LDKRecipient_to_js(Recipient_clone(orig_conv));
74538         return ret_conv;
74539 }
74540
74541 uint32_t  __attribute__((export_name("TS_Recipient_node"))) TS_Recipient_node() {
74542         uint32_t ret_conv = LDKRecipient_to_js(Recipient_node());
74543         return ret_conv;
74544 }
74545
74546 uint32_t  __attribute__((export_name("TS_Recipient_phantom_node"))) TS_Recipient_phantom_node() {
74547         uint32_t ret_conv = LDKRecipient_to_js(Recipient_phantom_node());
74548         return ret_conv;
74549 }
74550
74551 void  __attribute__((export_name("TS_EntropySource_free"))) TS_EntropySource_free(uint64_t this_ptr) {
74552         if (!ptr_is_owned(this_ptr)) return;
74553         void* this_ptr_ptr = untag_ptr(this_ptr);
74554         CHECK_ACCESS(this_ptr_ptr);
74555         LDKEntropySource this_ptr_conv = *(LDKEntropySource*)(this_ptr_ptr);
74556         FREE(untag_ptr(this_ptr));
74557         EntropySource_free(this_ptr_conv);
74558 }
74559
74560 void  __attribute__((export_name("TS_NodeSigner_free"))) TS_NodeSigner_free(uint64_t this_ptr) {
74561         if (!ptr_is_owned(this_ptr)) return;
74562         void* this_ptr_ptr = untag_ptr(this_ptr);
74563         CHECK_ACCESS(this_ptr_ptr);
74564         LDKNodeSigner this_ptr_conv = *(LDKNodeSigner*)(this_ptr_ptr);
74565         FREE(untag_ptr(this_ptr));
74566         NodeSigner_free(this_ptr_conv);
74567 }
74568
74569 void  __attribute__((export_name("TS_OutputSpender_free"))) TS_OutputSpender_free(uint64_t this_ptr) {
74570         if (!ptr_is_owned(this_ptr)) return;
74571         void* this_ptr_ptr = untag_ptr(this_ptr);
74572         CHECK_ACCESS(this_ptr_ptr);
74573         LDKOutputSpender this_ptr_conv = *(LDKOutputSpender*)(this_ptr_ptr);
74574         FREE(untag_ptr(this_ptr));
74575         OutputSpender_free(this_ptr_conv);
74576 }
74577
74578 void  __attribute__((export_name("TS_SignerProvider_free"))) TS_SignerProvider_free(uint64_t this_ptr) {
74579         if (!ptr_is_owned(this_ptr)) return;
74580         void* this_ptr_ptr = untag_ptr(this_ptr);
74581         CHECK_ACCESS(this_ptr_ptr);
74582         LDKSignerProvider this_ptr_conv = *(LDKSignerProvider*)(this_ptr_ptr);
74583         FREE(untag_ptr(this_ptr));
74584         SignerProvider_free(this_ptr_conv);
74585 }
74586
74587 void  __attribute__((export_name("TS_ChangeDestinationSource_free"))) TS_ChangeDestinationSource_free(uint64_t this_ptr) {
74588         if (!ptr_is_owned(this_ptr)) return;
74589         void* this_ptr_ptr = untag_ptr(this_ptr);
74590         CHECK_ACCESS(this_ptr_ptr);
74591         LDKChangeDestinationSource this_ptr_conv = *(LDKChangeDestinationSource*)(this_ptr_ptr);
74592         FREE(untag_ptr(this_ptr));
74593         ChangeDestinationSource_free(this_ptr_conv);
74594 }
74595
74596 void  __attribute__((export_name("TS_InMemorySigner_free"))) TS_InMemorySigner_free(uint64_t this_obj) {
74597         LDKInMemorySigner this_obj_conv;
74598         this_obj_conv.inner = untag_ptr(this_obj);
74599         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74601         InMemorySigner_free(this_obj_conv);
74602 }
74603
74604 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_funding_key"))) TS_InMemorySigner_get_funding_key(uint64_t this_ptr) {
74605         LDKInMemorySigner this_ptr_conv;
74606         this_ptr_conv.inner = untag_ptr(this_ptr);
74607         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74609         this_ptr_conv.is_owned = false;
74610         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
74611         memcpy(ret_arr->elems, *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
74612         return ret_arr;
74613 }
74614
74615 void  __attribute__((export_name("TS_InMemorySigner_set_funding_key"))) TS_InMemorySigner_set_funding_key(uint64_t this_ptr, int8_tArray val) {
74616         LDKInMemorySigner this_ptr_conv;
74617         this_ptr_conv.inner = untag_ptr(this_ptr);
74618         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74620         this_ptr_conv.is_owned = false;
74621         LDKSecretKey val_ref;
74622         CHECK(val->arr_len == 32);
74623         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
74624         InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
74625 }
74626
74627 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_revocation_base_key"))) TS_InMemorySigner_get_revocation_base_key(uint64_t this_ptr) {
74628         LDKInMemorySigner this_ptr_conv;
74629         this_ptr_conv.inner = untag_ptr(this_ptr);
74630         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74632         this_ptr_conv.is_owned = false;
74633         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
74634         memcpy(ret_arr->elems, *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
74635         return ret_arr;
74636 }
74637
74638 void  __attribute__((export_name("TS_InMemorySigner_set_revocation_base_key"))) TS_InMemorySigner_set_revocation_base_key(uint64_t this_ptr, int8_tArray val) {
74639         LDKInMemorySigner this_ptr_conv;
74640         this_ptr_conv.inner = untag_ptr(this_ptr);
74641         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74643         this_ptr_conv.is_owned = false;
74644         LDKSecretKey val_ref;
74645         CHECK(val->arr_len == 32);
74646         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
74647         InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
74648 }
74649
74650 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_payment_key"))) TS_InMemorySigner_get_payment_key(uint64_t this_ptr) {
74651         LDKInMemorySigner this_ptr_conv;
74652         this_ptr_conv.inner = untag_ptr(this_ptr);
74653         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74655         this_ptr_conv.is_owned = false;
74656         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
74657         memcpy(ret_arr->elems, *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
74658         return ret_arr;
74659 }
74660
74661 void  __attribute__((export_name("TS_InMemorySigner_set_payment_key"))) TS_InMemorySigner_set_payment_key(uint64_t this_ptr, int8_tArray val) {
74662         LDKInMemorySigner this_ptr_conv;
74663         this_ptr_conv.inner = untag_ptr(this_ptr);
74664         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74666         this_ptr_conv.is_owned = false;
74667         LDKSecretKey val_ref;
74668         CHECK(val->arr_len == 32);
74669         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
74670         InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
74671 }
74672
74673 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_delayed_payment_base_key"))) TS_InMemorySigner_get_delayed_payment_base_key(uint64_t this_ptr) {
74674         LDKInMemorySigner this_ptr_conv;
74675         this_ptr_conv.inner = untag_ptr(this_ptr);
74676         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74678         this_ptr_conv.is_owned = false;
74679         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
74680         memcpy(ret_arr->elems, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
74681         return ret_arr;
74682 }
74683
74684 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) {
74685         LDKInMemorySigner this_ptr_conv;
74686         this_ptr_conv.inner = untag_ptr(this_ptr);
74687         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74689         this_ptr_conv.is_owned = false;
74690         LDKSecretKey val_ref;
74691         CHECK(val->arr_len == 32);
74692         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
74693         InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
74694 }
74695
74696 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_htlc_base_key"))) TS_InMemorySigner_get_htlc_base_key(uint64_t this_ptr) {
74697         LDKInMemorySigner this_ptr_conv;
74698         this_ptr_conv.inner = untag_ptr(this_ptr);
74699         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74701         this_ptr_conv.is_owned = false;
74702         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
74703         memcpy(ret_arr->elems, *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
74704         return ret_arr;
74705 }
74706
74707 void  __attribute__((export_name("TS_InMemorySigner_set_htlc_base_key"))) TS_InMemorySigner_set_htlc_base_key(uint64_t this_ptr, int8_tArray val) {
74708         LDKInMemorySigner this_ptr_conv;
74709         this_ptr_conv.inner = untag_ptr(this_ptr);
74710         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74712         this_ptr_conv.is_owned = false;
74713         LDKSecretKey val_ref;
74714         CHECK(val->arr_len == 32);
74715         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
74716         InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
74717 }
74718
74719 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_commitment_seed"))) TS_InMemorySigner_get_commitment_seed(uint64_t this_ptr) {
74720         LDKInMemorySigner this_ptr_conv;
74721         this_ptr_conv.inner = untag_ptr(this_ptr);
74722         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74724         this_ptr_conv.is_owned = false;
74725         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
74726         memcpy(ret_arr->elems, *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
74727         return ret_arr;
74728 }
74729
74730 void  __attribute__((export_name("TS_InMemorySigner_set_commitment_seed"))) TS_InMemorySigner_set_commitment_seed(uint64_t this_ptr, int8_tArray val) {
74731         LDKInMemorySigner this_ptr_conv;
74732         this_ptr_conv.inner = untag_ptr(this_ptr);
74733         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74735         this_ptr_conv.is_owned = false;
74736         LDKThirtyTwoBytes val_ref;
74737         CHECK(val->arr_len == 32);
74738         memcpy(val_ref.data, val->elems, 32); FREE(val);
74739         InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
74740 }
74741
74742 static inline uint64_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
74743         LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
74744         uint64_t ret_ref = 0;
74745         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74746         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74747         return ret_ref;
74748 }
74749 int64_t  __attribute__((export_name("TS_InMemorySigner_clone_ptr"))) TS_InMemorySigner_clone_ptr(uint64_t arg) {
74750         LDKInMemorySigner arg_conv;
74751         arg_conv.inner = untag_ptr(arg);
74752         arg_conv.is_owned = ptr_is_owned(arg);
74753         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74754         arg_conv.is_owned = false;
74755         int64_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
74756         return ret_conv;
74757 }
74758
74759 uint64_t  __attribute__((export_name("TS_InMemorySigner_clone"))) TS_InMemorySigner_clone(uint64_t orig) {
74760         LDKInMemorySigner orig_conv;
74761         orig_conv.inner = untag_ptr(orig);
74762         orig_conv.is_owned = ptr_is_owned(orig);
74763         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74764         orig_conv.is_owned = false;
74765         LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
74766         uint64_t ret_ref = 0;
74767         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74768         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74769         return ret_ref;
74770 }
74771
74772 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) {
74773         LDKSecretKey funding_key_ref;
74774         CHECK(funding_key->arr_len == 32);
74775         memcpy(funding_key_ref.bytes, funding_key->elems, 32); FREE(funding_key);
74776         LDKSecretKey revocation_base_key_ref;
74777         CHECK(revocation_base_key->arr_len == 32);
74778         memcpy(revocation_base_key_ref.bytes, revocation_base_key->elems, 32); FREE(revocation_base_key);
74779         LDKSecretKey payment_key_ref;
74780         CHECK(payment_key->arr_len == 32);
74781         memcpy(payment_key_ref.bytes, payment_key->elems, 32); FREE(payment_key);
74782         LDKSecretKey delayed_payment_base_key_ref;
74783         CHECK(delayed_payment_base_key->arr_len == 32);
74784         memcpy(delayed_payment_base_key_ref.bytes, delayed_payment_base_key->elems, 32); FREE(delayed_payment_base_key);
74785         LDKSecretKey htlc_base_key_ref;
74786         CHECK(htlc_base_key->arr_len == 32);
74787         memcpy(htlc_base_key_ref.bytes, htlc_base_key->elems, 32); FREE(htlc_base_key);
74788         LDKThirtyTwoBytes commitment_seed_ref;
74789         CHECK(commitment_seed->arr_len == 32);
74790         memcpy(commitment_seed_ref.data, commitment_seed->elems, 32); FREE(commitment_seed);
74791         LDKThirtyTwoBytes channel_keys_id_ref;
74792         CHECK(channel_keys_id->arr_len == 32);
74793         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
74794         LDKThirtyTwoBytes rand_bytes_unique_start_ref;
74795         CHECK(rand_bytes_unique_start->arr_len == 32);
74796         memcpy(rand_bytes_unique_start_ref.data, rand_bytes_unique_start->elems, 32); FREE(rand_bytes_unique_start);
74797         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);
74798         uint64_t ret_ref = 0;
74799         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74800         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74801         return ret_ref;
74802 }
74803
74804 uint64_t  __attribute__((export_name("TS_InMemorySigner_counterparty_pubkeys"))) TS_InMemorySigner_counterparty_pubkeys(uint64_t this_arg) {
74805         LDKInMemorySigner this_arg_conv;
74806         this_arg_conv.inner = untag_ptr(this_arg);
74807         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74809         this_arg_conv.is_owned = false;
74810         LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
74811         uint64_t ret_ref = 0;
74812         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74813         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74814         return ret_ref;
74815 }
74816
74817 uint64_t  __attribute__((export_name("TS_InMemorySigner_counterparty_selected_contest_delay"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint64_t this_arg) {
74818         LDKInMemorySigner this_arg_conv;
74819         this_arg_conv.inner = untag_ptr(this_arg);
74820         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74822         this_arg_conv.is_owned = false;
74823         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
74824         *ret_copy = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
74825         uint64_t ret_ref = tag_ptr(ret_copy, true);
74826         return ret_ref;
74827 }
74828
74829 uint64_t  __attribute__((export_name("TS_InMemorySigner_holder_selected_contest_delay"))) TS_InMemorySigner_holder_selected_contest_delay(uint64_t this_arg) {
74830         LDKInMemorySigner this_arg_conv;
74831         this_arg_conv.inner = untag_ptr(this_arg);
74832         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74834         this_arg_conv.is_owned = false;
74835         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
74836         *ret_copy = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
74837         uint64_t ret_ref = tag_ptr(ret_copy, true);
74838         return ret_ref;
74839 }
74840
74841 uint64_t  __attribute__((export_name("TS_InMemorySigner_is_outbound"))) TS_InMemorySigner_is_outbound(uint64_t this_arg) {
74842         LDKInMemorySigner this_arg_conv;
74843         this_arg_conv.inner = untag_ptr(this_arg);
74844         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74846         this_arg_conv.is_owned = false;
74847         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
74848         *ret_copy = InMemorySigner_is_outbound(&this_arg_conv);
74849         uint64_t ret_ref = tag_ptr(ret_copy, true);
74850         return ret_ref;
74851 }
74852
74853 uint64_t  __attribute__((export_name("TS_InMemorySigner_funding_outpoint"))) TS_InMemorySigner_funding_outpoint(uint64_t this_arg) {
74854         LDKInMemorySigner this_arg_conv;
74855         this_arg_conv.inner = untag_ptr(this_arg);
74856         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74858         this_arg_conv.is_owned = false;
74859         LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
74860         uint64_t ret_ref = 0;
74861         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74862         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74863         return ret_ref;
74864 }
74865
74866 uint64_t  __attribute__((export_name("TS_InMemorySigner_get_channel_parameters"))) TS_InMemorySigner_get_channel_parameters(uint64_t this_arg) {
74867         LDKInMemorySigner this_arg_conv;
74868         this_arg_conv.inner = untag_ptr(this_arg);
74869         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74871         this_arg_conv.is_owned = false;
74872         LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
74873         uint64_t ret_ref = 0;
74874         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74875         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74876         return ret_ref;
74877 }
74878
74879 uint64_t  __attribute__((export_name("TS_InMemorySigner_channel_type_features"))) TS_InMemorySigner_channel_type_features(uint64_t this_arg) {
74880         LDKInMemorySigner this_arg_conv;
74881         this_arg_conv.inner = untag_ptr(this_arg);
74882         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74884         this_arg_conv.is_owned = false;
74885         LDKChannelTypeFeatures ret_var = InMemorySigner_channel_type_features(&this_arg_conv);
74886         uint64_t ret_ref = 0;
74887         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74888         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74889         return ret_ref;
74890 }
74891
74892 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) {
74893         LDKInMemorySigner this_arg_conv;
74894         this_arg_conv.inner = untag_ptr(this_arg);
74895         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74897         this_arg_conv.is_owned = false;
74898         LDKTransaction spend_tx_ref;
74899         spend_tx_ref.datalen = spend_tx->arr_len;
74900         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
74901         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
74902         spend_tx_ref.data_is_owned = true;
74903         LDKStaticPaymentOutputDescriptor descriptor_conv;
74904         descriptor_conv.inner = untag_ptr(descriptor);
74905         descriptor_conv.is_owned = ptr_is_owned(descriptor);
74906         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
74907         descriptor_conv.is_owned = false;
74908         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
74909         *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
74910         return tag_ptr(ret_conv, true);
74911 }
74912
74913 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) {
74914         LDKInMemorySigner this_arg_conv;
74915         this_arg_conv.inner = untag_ptr(this_arg);
74916         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74918         this_arg_conv.is_owned = false;
74919         LDKTransaction spend_tx_ref;
74920         spend_tx_ref.datalen = spend_tx->arr_len;
74921         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
74922         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
74923         spend_tx_ref.data_is_owned = true;
74924         LDKDelayedPaymentOutputDescriptor descriptor_conv;
74925         descriptor_conv.inner = untag_ptr(descriptor);
74926         descriptor_conv.is_owned = ptr_is_owned(descriptor);
74927         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
74928         descriptor_conv.is_owned = false;
74929         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
74930         *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
74931         return tag_ptr(ret_conv, true);
74932 }
74933
74934 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_EntropySource"))) TS_InMemorySigner_as_EntropySource(uint64_t this_arg) {
74935         LDKInMemorySigner this_arg_conv;
74936         this_arg_conv.inner = untag_ptr(this_arg);
74937         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74939         this_arg_conv.is_owned = false;
74940         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
74941         *ret_ret = InMemorySigner_as_EntropySource(&this_arg_conv);
74942         return tag_ptr(ret_ret, true);
74943 }
74944
74945 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_ChannelSigner"))) TS_InMemorySigner_as_ChannelSigner(uint64_t this_arg) {
74946         LDKInMemorySigner this_arg_conv;
74947         this_arg_conv.inner = untag_ptr(this_arg);
74948         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74950         this_arg_conv.is_owned = false;
74951         LDKChannelSigner* ret_ret = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
74952         *ret_ret = InMemorySigner_as_ChannelSigner(&this_arg_conv);
74953         return tag_ptr(ret_ret, true);
74954 }
74955
74956 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_EcdsaChannelSigner"))) TS_InMemorySigner_as_EcdsaChannelSigner(uint64_t this_arg) {
74957         LDKInMemorySigner this_arg_conv;
74958         this_arg_conv.inner = untag_ptr(this_arg);
74959         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74961         this_arg_conv.is_owned = false;
74962         LDKEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
74963         *ret_ret = InMemorySigner_as_EcdsaChannelSigner(&this_arg_conv);
74964         return tag_ptr(ret_ret, true);
74965 }
74966
74967 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_WriteableEcdsaChannelSigner"))) TS_InMemorySigner_as_WriteableEcdsaChannelSigner(uint64_t this_arg) {
74968         LDKInMemorySigner this_arg_conv;
74969         this_arg_conv.inner = untag_ptr(this_arg);
74970         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74972         this_arg_conv.is_owned = false;
74973         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
74974         *ret_ret = InMemorySigner_as_WriteableEcdsaChannelSigner(&this_arg_conv);
74975         return tag_ptr(ret_ret, true);
74976 }
74977
74978 int8_tArray  __attribute__((export_name("TS_InMemorySigner_write"))) TS_InMemorySigner_write(uint64_t obj) {
74979         LDKInMemorySigner obj_conv;
74980         obj_conv.inner = untag_ptr(obj);
74981         obj_conv.is_owned = ptr_is_owned(obj);
74982         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
74983         obj_conv.is_owned = false;
74984         LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
74985         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
74986         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
74987         CVec_u8Z_free(ret_var);
74988         return ret_arr;
74989 }
74990
74991 uint64_t  __attribute__((export_name("TS_InMemorySigner_read"))) TS_InMemorySigner_read(int8_tArray ser, uint64_t arg) {
74992         LDKu8slice ser_ref;
74993         ser_ref.datalen = ser->arr_len;
74994         ser_ref.data = ser->elems;
74995         void* arg_ptr = untag_ptr(arg);
74996         CHECK_ACCESS(arg_ptr);
74997         LDKEntropySource arg_conv = *(LDKEntropySource*)(arg_ptr);
74998         if (arg_conv.free == LDKEntropySource_JCalls_free) {
74999                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75000                 LDKEntropySource_JCalls_cloned(&arg_conv);
75001         }
75002         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
75003         *ret_conv = InMemorySigner_read(ser_ref, arg_conv);
75004         FREE(ser);
75005         return tag_ptr(ret_conv, true);
75006 }
75007
75008 void  __attribute__((export_name("TS_KeysManager_free"))) TS_KeysManager_free(uint64_t this_obj) {
75009         LDKKeysManager this_obj_conv;
75010         this_obj_conv.inner = untag_ptr(this_obj);
75011         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75013         KeysManager_free(this_obj_conv);
75014 }
75015
75016 uint64_t  __attribute__((export_name("TS_KeysManager_new"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
75017         uint8_t seed_arr[32];
75018         CHECK(seed->arr_len == 32);
75019         memcpy(seed_arr, seed->elems, 32); FREE(seed);
75020         uint8_t (*seed_ref)[32] = &seed_arr;
75021         LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
75022         uint64_t ret_ref = 0;
75023         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75024         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75025         return ret_ref;
75026 }
75027
75028 int8_tArray  __attribute__((export_name("TS_KeysManager_get_node_secret_key"))) TS_KeysManager_get_node_secret_key(uint64_t this_arg) {
75029         LDKKeysManager this_arg_conv;
75030         this_arg_conv.inner = untag_ptr(this_arg);
75031         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75033         this_arg_conv.is_owned = false;
75034         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
75035         memcpy(ret_arr->elems, KeysManager_get_node_secret_key(&this_arg_conv).bytes, 32);
75036         return ret_arr;
75037 }
75038
75039 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) {
75040         LDKKeysManager this_arg_conv;
75041         this_arg_conv.inner = untag_ptr(this_arg);
75042         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75044         this_arg_conv.is_owned = false;
75045         uint8_t params_arr[32];
75046         CHECK(params->arr_len == 32);
75047         memcpy(params_arr, params->elems, 32); FREE(params);
75048         uint8_t (*params_ref)[32] = &params_arr;
75049         LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
75050         uint64_t ret_ref = 0;
75051         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75052         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75053         return ret_ref;
75054 }
75055
75056 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) {
75057         LDKKeysManager this_arg_conv;
75058         this_arg_conv.inner = untag_ptr(this_arg);
75059         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75061         this_arg_conv.is_owned = false;
75062         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
75063         descriptors_constr.datalen = descriptors->arr_len;
75064         if (descriptors_constr.datalen > 0)
75065                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
75066         else
75067                 descriptors_constr.data = NULL;
75068         uint64_t* descriptors_vals = descriptors->elems;
75069         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
75070                 uint64_t descriptors_conv_27 = descriptors_vals[b];
75071                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
75072                 CHECK_ACCESS(descriptors_conv_27_ptr);
75073                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
75074                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
75075                 descriptors_constr.data[b] = descriptors_conv_27_conv;
75076         }
75077         FREE(descriptors);
75078         LDKCVec_u8Z psbt_ref;
75079         psbt_ref.datalen = psbt->arr_len;
75080         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
75081         memcpy(psbt_ref.data, psbt->elems, psbt_ref.datalen); FREE(psbt);
75082         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
75083         *ret_conv = KeysManager_sign_spendable_outputs_psbt(&this_arg_conv, descriptors_constr, psbt_ref);
75084         return tag_ptr(ret_conv, true);
75085 }
75086
75087 uint64_t  __attribute__((export_name("TS_KeysManager_as_EntropySource"))) TS_KeysManager_as_EntropySource(uint64_t this_arg) {
75088         LDKKeysManager this_arg_conv;
75089         this_arg_conv.inner = untag_ptr(this_arg);
75090         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75092         this_arg_conv.is_owned = false;
75093         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
75094         *ret_ret = KeysManager_as_EntropySource(&this_arg_conv);
75095         return tag_ptr(ret_ret, true);
75096 }
75097
75098 uint64_t  __attribute__((export_name("TS_KeysManager_as_NodeSigner"))) TS_KeysManager_as_NodeSigner(uint64_t this_arg) {
75099         LDKKeysManager this_arg_conv;
75100         this_arg_conv.inner = untag_ptr(this_arg);
75101         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75103         this_arg_conv.is_owned = false;
75104         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
75105         *ret_ret = KeysManager_as_NodeSigner(&this_arg_conv);
75106         return tag_ptr(ret_ret, true);
75107 }
75108
75109 uint64_t  __attribute__((export_name("TS_KeysManager_as_OutputSpender"))) TS_KeysManager_as_OutputSpender(uint64_t this_arg) {
75110         LDKKeysManager this_arg_conv;
75111         this_arg_conv.inner = untag_ptr(this_arg);
75112         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75114         this_arg_conv.is_owned = false;
75115         LDKOutputSpender* ret_ret = MALLOC(sizeof(LDKOutputSpender), "LDKOutputSpender");
75116         *ret_ret = KeysManager_as_OutputSpender(&this_arg_conv);
75117         return tag_ptr(ret_ret, true);
75118 }
75119
75120 uint64_t  __attribute__((export_name("TS_KeysManager_as_SignerProvider"))) TS_KeysManager_as_SignerProvider(uint64_t this_arg) {
75121         LDKKeysManager this_arg_conv;
75122         this_arg_conv.inner = untag_ptr(this_arg);
75123         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75125         this_arg_conv.is_owned = false;
75126         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
75127         *ret_ret = KeysManager_as_SignerProvider(&this_arg_conv);
75128         return tag_ptr(ret_ret, true);
75129 }
75130
75131 void  __attribute__((export_name("TS_PhantomKeysManager_free"))) TS_PhantomKeysManager_free(uint64_t this_obj) {
75132         LDKPhantomKeysManager this_obj_conv;
75133         this_obj_conv.inner = untag_ptr(this_obj);
75134         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75136         PhantomKeysManager_free(this_obj_conv);
75137 }
75138
75139 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_EntropySource"))) TS_PhantomKeysManager_as_EntropySource(uint64_t this_arg) {
75140         LDKPhantomKeysManager this_arg_conv;
75141         this_arg_conv.inner = untag_ptr(this_arg);
75142         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75144         this_arg_conv.is_owned = false;
75145         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
75146         *ret_ret = PhantomKeysManager_as_EntropySource(&this_arg_conv);
75147         return tag_ptr(ret_ret, true);
75148 }
75149
75150 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_NodeSigner"))) TS_PhantomKeysManager_as_NodeSigner(uint64_t this_arg) {
75151         LDKPhantomKeysManager this_arg_conv;
75152         this_arg_conv.inner = untag_ptr(this_arg);
75153         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75155         this_arg_conv.is_owned = false;
75156         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
75157         *ret_ret = PhantomKeysManager_as_NodeSigner(&this_arg_conv);
75158         return tag_ptr(ret_ret, true);
75159 }
75160
75161 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_OutputSpender"))) TS_PhantomKeysManager_as_OutputSpender(uint64_t this_arg) {
75162         LDKPhantomKeysManager this_arg_conv;
75163         this_arg_conv.inner = untag_ptr(this_arg);
75164         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75166         this_arg_conv.is_owned = false;
75167         LDKOutputSpender* ret_ret = MALLOC(sizeof(LDKOutputSpender), "LDKOutputSpender");
75168         *ret_ret = PhantomKeysManager_as_OutputSpender(&this_arg_conv);
75169         return tag_ptr(ret_ret, true);
75170 }
75171
75172 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_SignerProvider"))) TS_PhantomKeysManager_as_SignerProvider(uint64_t this_arg) {
75173         LDKPhantomKeysManager this_arg_conv;
75174         this_arg_conv.inner = untag_ptr(this_arg);
75175         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75177         this_arg_conv.is_owned = false;
75178         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
75179         *ret_ret = PhantomKeysManager_as_SignerProvider(&this_arg_conv);
75180         return tag_ptr(ret_ret, true);
75181 }
75182
75183 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) {
75184         uint8_t seed_arr[32];
75185         CHECK(seed->arr_len == 32);
75186         memcpy(seed_arr, seed->elems, 32); FREE(seed);
75187         uint8_t (*seed_ref)[32] = &seed_arr;
75188         uint8_t cross_node_seed_arr[32];
75189         CHECK(cross_node_seed->arr_len == 32);
75190         memcpy(cross_node_seed_arr, cross_node_seed->elems, 32); FREE(cross_node_seed);
75191         uint8_t (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
75192         LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
75193         uint64_t ret_ref = 0;
75194         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75195         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75196         return ret_ref;
75197 }
75198
75199 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) {
75200         LDKPhantomKeysManager this_arg_conv;
75201         this_arg_conv.inner = untag_ptr(this_arg);
75202         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75204         this_arg_conv.is_owned = false;
75205         uint8_t params_arr[32];
75206         CHECK(params->arr_len == 32);
75207         memcpy(params_arr, params->elems, 32); FREE(params);
75208         uint8_t (*params_ref)[32] = &params_arr;
75209         LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
75210         uint64_t ret_ref = 0;
75211         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75212         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75213         return ret_ref;
75214 }
75215
75216 int8_tArray  __attribute__((export_name("TS_PhantomKeysManager_get_node_secret_key"))) TS_PhantomKeysManager_get_node_secret_key(uint64_t this_arg) {
75217         LDKPhantomKeysManager this_arg_conv;
75218         this_arg_conv.inner = untag_ptr(this_arg);
75219         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75221         this_arg_conv.is_owned = false;
75222         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
75223         memcpy(ret_arr->elems, PhantomKeysManager_get_node_secret_key(&this_arg_conv).bytes, 32);
75224         return ret_arr;
75225 }
75226
75227 int8_tArray  __attribute__((export_name("TS_PhantomKeysManager_get_phantom_node_secret_key"))) TS_PhantomKeysManager_get_phantom_node_secret_key(uint64_t this_arg) {
75228         LDKPhantomKeysManager this_arg_conv;
75229         this_arg_conv.inner = untag_ptr(this_arg);
75230         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75232         this_arg_conv.is_owned = false;
75233         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
75234         memcpy(ret_arr->elems, PhantomKeysManager_get_phantom_node_secret_key(&this_arg_conv).bytes, 32);
75235         return ret_arr;
75236 }
75237
75238 void  __attribute__((export_name("TS_RandomBytes_free"))) TS_RandomBytes_free(uint64_t this_obj) {
75239         LDKRandomBytes this_obj_conv;
75240         this_obj_conv.inner = untag_ptr(this_obj);
75241         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75243         RandomBytes_free(this_obj_conv);
75244 }
75245
75246 uint64_t  __attribute__((export_name("TS_RandomBytes_new"))) TS_RandomBytes_new(int8_tArray seed) {
75247         LDKThirtyTwoBytes seed_ref;
75248         CHECK(seed->arr_len == 32);
75249         memcpy(seed_ref.data, seed->elems, 32); FREE(seed);
75250         LDKRandomBytes ret_var = RandomBytes_new(seed_ref);
75251         uint64_t ret_ref = 0;
75252         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75253         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75254         return ret_ref;
75255 }
75256
75257 uint64_t  __attribute__((export_name("TS_RandomBytes_as_EntropySource"))) TS_RandomBytes_as_EntropySource(uint64_t this_arg) {
75258         LDKRandomBytes this_arg_conv;
75259         this_arg_conv.inner = untag_ptr(this_arg);
75260         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75262         this_arg_conv.is_owned = false;
75263         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
75264         *ret_ret = RandomBytes_as_EntropySource(&this_arg_conv);
75265         return tag_ptr(ret_ret, true);
75266 }
75267
75268 void  __attribute__((export_name("TS_EcdsaChannelSigner_free"))) TS_EcdsaChannelSigner_free(uint64_t this_ptr) {
75269         if (!ptr_is_owned(this_ptr)) return;
75270         void* this_ptr_ptr = untag_ptr(this_ptr);
75271         CHECK_ACCESS(this_ptr_ptr);
75272         LDKEcdsaChannelSigner this_ptr_conv = *(LDKEcdsaChannelSigner*)(this_ptr_ptr);
75273         FREE(untag_ptr(this_ptr));
75274         EcdsaChannelSigner_free(this_ptr_conv);
75275 }
75276
75277 static inline uint64_t WriteableEcdsaChannelSigner_clone_ptr(LDKWriteableEcdsaChannelSigner *NONNULL_PTR arg) {
75278         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
75279         *ret_ret = WriteableEcdsaChannelSigner_clone(arg);
75280         return tag_ptr(ret_ret, true);
75281 }
75282 int64_t  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_clone_ptr"))) TS_WriteableEcdsaChannelSigner_clone_ptr(uint64_t arg) {
75283         void* arg_ptr = untag_ptr(arg);
75284         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
75285         LDKWriteableEcdsaChannelSigner* arg_conv = (LDKWriteableEcdsaChannelSigner*)arg_ptr;
75286         int64_t ret_conv = WriteableEcdsaChannelSigner_clone_ptr(arg_conv);
75287         return ret_conv;
75288 }
75289
75290 uint64_t  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_clone"))) TS_WriteableEcdsaChannelSigner_clone(uint64_t orig) {
75291         void* orig_ptr = untag_ptr(orig);
75292         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
75293         LDKWriteableEcdsaChannelSigner* orig_conv = (LDKWriteableEcdsaChannelSigner*)orig_ptr;
75294         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
75295         *ret_ret = WriteableEcdsaChannelSigner_clone(orig_conv);
75296         return tag_ptr(ret_ret, true);
75297 }
75298
75299 void  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_free"))) TS_WriteableEcdsaChannelSigner_free(uint64_t this_ptr) {
75300         if (!ptr_is_owned(this_ptr)) return;
75301         void* this_ptr_ptr = untag_ptr(this_ptr);
75302         CHECK_ACCESS(this_ptr_ptr);
75303         LDKWriteableEcdsaChannelSigner this_ptr_conv = *(LDKWriteableEcdsaChannelSigner*)(this_ptr_ptr);
75304         FREE(untag_ptr(this_ptr));
75305         WriteableEcdsaChannelSigner_free(this_ptr_conv);
75306 }
75307
75308 void  __attribute__((export_name("TS_OnionMessenger_free"))) TS_OnionMessenger_free(uint64_t this_obj) {
75309         LDKOnionMessenger this_obj_conv;
75310         this_obj_conv.inner = untag_ptr(this_obj);
75311         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75313         OnionMessenger_free(this_obj_conv);
75314 }
75315
75316 void  __attribute__((export_name("TS_MessageRouter_free"))) TS_MessageRouter_free(uint64_t this_ptr) {
75317         if (!ptr_is_owned(this_ptr)) return;
75318         void* this_ptr_ptr = untag_ptr(this_ptr);
75319         CHECK_ACCESS(this_ptr_ptr);
75320         LDKMessageRouter this_ptr_conv = *(LDKMessageRouter*)(this_ptr_ptr);
75321         FREE(untag_ptr(this_ptr));
75322         MessageRouter_free(this_ptr_conv);
75323 }
75324
75325 void  __attribute__((export_name("TS_DefaultMessageRouter_free"))) TS_DefaultMessageRouter_free(uint64_t this_obj) {
75326         LDKDefaultMessageRouter this_obj_conv;
75327         this_obj_conv.inner = untag_ptr(this_obj);
75328         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75330         DefaultMessageRouter_free(this_obj_conv);
75331 }
75332
75333 uint64_t  __attribute__((export_name("TS_DefaultMessageRouter_new"))) TS_DefaultMessageRouter_new(uint64_t network_graph, uint64_t entropy_source) {
75334         LDKNetworkGraph network_graph_conv;
75335         network_graph_conv.inner = untag_ptr(network_graph);
75336         network_graph_conv.is_owned = ptr_is_owned(network_graph);
75337         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
75338         network_graph_conv.is_owned = false;
75339         void* entropy_source_ptr = untag_ptr(entropy_source);
75340         CHECK_ACCESS(entropy_source_ptr);
75341         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
75342         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
75343                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75344                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
75345         }
75346         LDKDefaultMessageRouter ret_var = DefaultMessageRouter_new(&network_graph_conv, entropy_source_conv);
75347         uint64_t ret_ref = 0;
75348         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75349         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75350         return ret_ref;
75351 }
75352
75353 uint64_t  __attribute__((export_name("TS_DefaultMessageRouter_as_MessageRouter"))) TS_DefaultMessageRouter_as_MessageRouter(uint64_t this_arg) {
75354         LDKDefaultMessageRouter this_arg_conv;
75355         this_arg_conv.inner = untag_ptr(this_arg);
75356         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75358         this_arg_conv.is_owned = false;
75359         LDKMessageRouter* ret_ret = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
75360         *ret_ret = DefaultMessageRouter_as_MessageRouter(&this_arg_conv);
75361         return tag_ptr(ret_ret, true);
75362 }
75363
75364 void  __attribute__((export_name("TS_OnionMessagePath_free"))) TS_OnionMessagePath_free(uint64_t this_obj) {
75365         LDKOnionMessagePath this_obj_conv;
75366         this_obj_conv.inner = untag_ptr(this_obj);
75367         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75369         OnionMessagePath_free(this_obj_conv);
75370 }
75371
75372 ptrArray  __attribute__((export_name("TS_OnionMessagePath_get_intermediate_nodes"))) TS_OnionMessagePath_get_intermediate_nodes(uint64_t this_ptr) {
75373         LDKOnionMessagePath this_ptr_conv;
75374         this_ptr_conv.inner = untag_ptr(this_ptr);
75375         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75377         this_ptr_conv.is_owned = false;
75378         LDKCVec_PublicKeyZ ret_var = OnionMessagePath_get_intermediate_nodes(&this_ptr_conv);
75379         ptrArray ret_arr = NULL;
75380         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
75381         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
75382         for (size_t m = 0; m < ret_var.datalen; m++) {
75383                 int8_tArray ret_conv_12_arr = init_int8_tArray(33, __LINE__);
75384                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compressed_form, 33);
75385                 ret_arr_ptr[m] = ret_conv_12_arr;
75386         }
75387         
75388         FREE(ret_var.data);
75389         return ret_arr;
75390 }
75391
75392 void  __attribute__((export_name("TS_OnionMessagePath_set_intermediate_nodes"))) TS_OnionMessagePath_set_intermediate_nodes(uint64_t this_ptr, ptrArray val) {
75393         LDKOnionMessagePath this_ptr_conv;
75394         this_ptr_conv.inner = untag_ptr(this_ptr);
75395         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75397         this_ptr_conv.is_owned = false;
75398         LDKCVec_PublicKeyZ val_constr;
75399         val_constr.datalen = val->arr_len;
75400         if (val_constr.datalen > 0)
75401                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
75402         else
75403                 val_constr.data = NULL;
75404         int8_tArray* val_vals = (void*) val->elems;
75405         for (size_t m = 0; m < val_constr.datalen; m++) {
75406                 int8_tArray val_conv_12 = val_vals[m];
75407                 LDKPublicKey val_conv_12_ref;
75408                 CHECK(val_conv_12->arr_len == 33);
75409                 memcpy(val_conv_12_ref.compressed_form, val_conv_12->elems, 33); FREE(val_conv_12);
75410                 val_constr.data[m] = val_conv_12_ref;
75411         }
75412         FREE(val);
75413         OnionMessagePath_set_intermediate_nodes(&this_ptr_conv, val_constr);
75414 }
75415
75416 uint64_t  __attribute__((export_name("TS_OnionMessagePath_get_destination"))) TS_OnionMessagePath_get_destination(uint64_t this_ptr) {
75417         LDKOnionMessagePath this_ptr_conv;
75418         this_ptr_conv.inner = untag_ptr(this_ptr);
75419         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75421         this_ptr_conv.is_owned = false;
75422         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
75423         *ret_copy = OnionMessagePath_get_destination(&this_ptr_conv);
75424         uint64_t ret_ref = tag_ptr(ret_copy, true);
75425         return ret_ref;
75426 }
75427
75428 void  __attribute__((export_name("TS_OnionMessagePath_set_destination"))) TS_OnionMessagePath_set_destination(uint64_t this_ptr, uint64_t val) {
75429         LDKOnionMessagePath this_ptr_conv;
75430         this_ptr_conv.inner = untag_ptr(this_ptr);
75431         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75433         this_ptr_conv.is_owned = false;
75434         void* val_ptr = untag_ptr(val);
75435         CHECK_ACCESS(val_ptr);
75436         LDKDestination val_conv = *(LDKDestination*)(val_ptr);
75437         val_conv = Destination_clone((LDKDestination*)untag_ptr(val));
75438         OnionMessagePath_set_destination(&this_ptr_conv, val_conv);
75439 }
75440
75441 uint64_t  __attribute__((export_name("TS_OnionMessagePath_get_first_node_addresses"))) TS_OnionMessagePath_get_first_node_addresses(uint64_t this_ptr) {
75442         LDKOnionMessagePath this_ptr_conv;
75443         this_ptr_conv.inner = untag_ptr(this_ptr);
75444         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75446         this_ptr_conv.is_owned = false;
75447         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
75448         *ret_copy = OnionMessagePath_get_first_node_addresses(&this_ptr_conv);
75449         uint64_t ret_ref = tag_ptr(ret_copy, true);
75450         return ret_ref;
75451 }
75452
75453 void  __attribute__((export_name("TS_OnionMessagePath_set_first_node_addresses"))) TS_OnionMessagePath_set_first_node_addresses(uint64_t this_ptr, uint64_t val) {
75454         LDKOnionMessagePath this_ptr_conv;
75455         this_ptr_conv.inner = untag_ptr(this_ptr);
75456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75458         this_ptr_conv.is_owned = false;
75459         void* val_ptr = untag_ptr(val);
75460         CHECK_ACCESS(val_ptr);
75461         LDKCOption_CVec_SocketAddressZZ val_conv = *(LDKCOption_CVec_SocketAddressZZ*)(val_ptr);
75462         val_conv = COption_CVec_SocketAddressZZ_clone((LDKCOption_CVec_SocketAddressZZ*)untag_ptr(val));
75463         OnionMessagePath_set_first_node_addresses(&this_ptr_conv, val_conv);
75464 }
75465
75466 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) {
75467         LDKCVec_PublicKeyZ intermediate_nodes_arg_constr;
75468         intermediate_nodes_arg_constr.datalen = intermediate_nodes_arg->arr_len;
75469         if (intermediate_nodes_arg_constr.datalen > 0)
75470                 intermediate_nodes_arg_constr.data = MALLOC(intermediate_nodes_arg_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
75471         else
75472                 intermediate_nodes_arg_constr.data = NULL;
75473         int8_tArray* intermediate_nodes_arg_vals = (void*) intermediate_nodes_arg->elems;
75474         for (size_t m = 0; m < intermediate_nodes_arg_constr.datalen; m++) {
75475                 int8_tArray intermediate_nodes_arg_conv_12 = intermediate_nodes_arg_vals[m];
75476                 LDKPublicKey intermediate_nodes_arg_conv_12_ref;
75477                 CHECK(intermediate_nodes_arg_conv_12->arr_len == 33);
75478                 memcpy(intermediate_nodes_arg_conv_12_ref.compressed_form, intermediate_nodes_arg_conv_12->elems, 33); FREE(intermediate_nodes_arg_conv_12);
75479                 intermediate_nodes_arg_constr.data[m] = intermediate_nodes_arg_conv_12_ref;
75480         }
75481         FREE(intermediate_nodes_arg);
75482         void* destination_arg_ptr = untag_ptr(destination_arg);
75483         CHECK_ACCESS(destination_arg_ptr);
75484         LDKDestination destination_arg_conv = *(LDKDestination*)(destination_arg_ptr);
75485         destination_arg_conv = Destination_clone((LDKDestination*)untag_ptr(destination_arg));
75486         void* first_node_addresses_arg_ptr = untag_ptr(first_node_addresses_arg);
75487         CHECK_ACCESS(first_node_addresses_arg_ptr);
75488         LDKCOption_CVec_SocketAddressZZ first_node_addresses_arg_conv = *(LDKCOption_CVec_SocketAddressZZ*)(first_node_addresses_arg_ptr);
75489         LDKOnionMessagePath ret_var = OnionMessagePath_new(intermediate_nodes_arg_constr, destination_arg_conv, first_node_addresses_arg_conv);
75490         uint64_t ret_ref = 0;
75491         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75492         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75493         return ret_ref;
75494 }
75495
75496 static inline uint64_t OnionMessagePath_clone_ptr(LDKOnionMessagePath *NONNULL_PTR arg) {
75497         LDKOnionMessagePath ret_var = OnionMessagePath_clone(arg);
75498         uint64_t ret_ref = 0;
75499         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75500         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75501         return ret_ref;
75502 }
75503 int64_t  __attribute__((export_name("TS_OnionMessagePath_clone_ptr"))) TS_OnionMessagePath_clone_ptr(uint64_t arg) {
75504         LDKOnionMessagePath arg_conv;
75505         arg_conv.inner = untag_ptr(arg);
75506         arg_conv.is_owned = ptr_is_owned(arg);
75507         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75508         arg_conv.is_owned = false;
75509         int64_t ret_conv = OnionMessagePath_clone_ptr(&arg_conv);
75510         return ret_conv;
75511 }
75512
75513 uint64_t  __attribute__((export_name("TS_OnionMessagePath_clone"))) TS_OnionMessagePath_clone(uint64_t orig) {
75514         LDKOnionMessagePath orig_conv;
75515         orig_conv.inner = untag_ptr(orig);
75516         orig_conv.is_owned = ptr_is_owned(orig);
75517         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75518         orig_conv.is_owned = false;
75519         LDKOnionMessagePath ret_var = OnionMessagePath_clone(&orig_conv);
75520         uint64_t ret_ref = 0;
75521         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75522         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75523         return ret_ref;
75524 }
75525
75526 int8_tArray  __attribute__((export_name("TS_OnionMessagePath_first_node"))) TS_OnionMessagePath_first_node(uint64_t this_arg) {
75527         LDKOnionMessagePath this_arg_conv;
75528         this_arg_conv.inner = untag_ptr(this_arg);
75529         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75531         this_arg_conv.is_owned = false;
75532         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
75533         memcpy(ret_arr->elems, OnionMessagePath_first_node(&this_arg_conv).compressed_form, 33);
75534         return ret_arr;
75535 }
75536
75537 void  __attribute__((export_name("TS_Destination_free"))) TS_Destination_free(uint64_t this_ptr) {
75538         if (!ptr_is_owned(this_ptr)) return;
75539         void* this_ptr_ptr = untag_ptr(this_ptr);
75540         CHECK_ACCESS(this_ptr_ptr);
75541         LDKDestination this_ptr_conv = *(LDKDestination*)(this_ptr_ptr);
75542         FREE(untag_ptr(this_ptr));
75543         Destination_free(this_ptr_conv);
75544 }
75545
75546 static inline uint64_t Destination_clone_ptr(LDKDestination *NONNULL_PTR arg) {
75547         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
75548         *ret_copy = Destination_clone(arg);
75549         uint64_t ret_ref = tag_ptr(ret_copy, true);
75550         return ret_ref;
75551 }
75552 int64_t  __attribute__((export_name("TS_Destination_clone_ptr"))) TS_Destination_clone_ptr(uint64_t arg) {
75553         LDKDestination* arg_conv = (LDKDestination*)untag_ptr(arg);
75554         int64_t ret_conv = Destination_clone_ptr(arg_conv);
75555         return ret_conv;
75556 }
75557
75558 uint64_t  __attribute__((export_name("TS_Destination_clone"))) TS_Destination_clone(uint64_t orig) {
75559         LDKDestination* orig_conv = (LDKDestination*)untag_ptr(orig);
75560         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
75561         *ret_copy = Destination_clone(orig_conv);
75562         uint64_t ret_ref = tag_ptr(ret_copy, true);
75563         return ret_ref;
75564 }
75565
75566 uint64_t  __attribute__((export_name("TS_Destination_node"))) TS_Destination_node(int8_tArray a) {
75567         LDKPublicKey a_ref;
75568         CHECK(a->arr_len == 33);
75569         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
75570         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
75571         *ret_copy = Destination_node(a_ref);
75572         uint64_t ret_ref = tag_ptr(ret_copy, true);
75573         return ret_ref;
75574 }
75575
75576 uint64_t  __attribute__((export_name("TS_Destination_blinded_path"))) TS_Destination_blinded_path(uint64_t a) {
75577         LDKBlindedPath a_conv;
75578         a_conv.inner = untag_ptr(a);
75579         a_conv.is_owned = ptr_is_owned(a);
75580         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75581         a_conv = BlindedPath_clone(&a_conv);
75582         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
75583         *ret_copy = Destination_blinded_path(a_conv);
75584         uint64_t ret_ref = tag_ptr(ret_copy, true);
75585         return ret_ref;
75586 }
75587
75588 int64_t  __attribute__((export_name("TS_Destination_hash"))) TS_Destination_hash(uint64_t o) {
75589         LDKDestination* o_conv = (LDKDestination*)untag_ptr(o);
75590         int64_t ret_conv = Destination_hash(o_conv);
75591         return ret_conv;
75592 }
75593
75594 jboolean  __attribute__((export_name("TS_Destination_eq"))) TS_Destination_eq(uint64_t a, uint64_t b) {
75595         LDKDestination* a_conv = (LDKDestination*)untag_ptr(a);
75596         LDKDestination* b_conv = (LDKDestination*)untag_ptr(b);
75597         jboolean ret_conv = Destination_eq(a_conv, b_conv);
75598         return ret_conv;
75599 }
75600
75601 void  __attribute__((export_name("TS_Destination_resolve"))) TS_Destination_resolve(uint64_t this_arg, uint64_t network_graph) {
75602         LDKDestination* this_arg_conv = (LDKDestination*)untag_ptr(this_arg);
75603         LDKReadOnlyNetworkGraph network_graph_conv;
75604         network_graph_conv.inner = untag_ptr(network_graph);
75605         network_graph_conv.is_owned = ptr_is_owned(network_graph);
75606         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
75607         network_graph_conv.is_owned = false;
75608         Destination_resolve(this_arg_conv, &network_graph_conv);
75609 }
75610
75611 void  __attribute__((export_name("TS_SendSuccess_free"))) TS_SendSuccess_free(uint64_t this_ptr) {
75612         if (!ptr_is_owned(this_ptr)) return;
75613         void* this_ptr_ptr = untag_ptr(this_ptr);
75614         CHECK_ACCESS(this_ptr_ptr);
75615         LDKSendSuccess this_ptr_conv = *(LDKSendSuccess*)(this_ptr_ptr);
75616         FREE(untag_ptr(this_ptr));
75617         SendSuccess_free(this_ptr_conv);
75618 }
75619
75620 static inline uint64_t SendSuccess_clone_ptr(LDKSendSuccess *NONNULL_PTR arg) {
75621         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
75622         *ret_copy = SendSuccess_clone(arg);
75623         uint64_t ret_ref = tag_ptr(ret_copy, true);
75624         return ret_ref;
75625 }
75626 int64_t  __attribute__((export_name("TS_SendSuccess_clone_ptr"))) TS_SendSuccess_clone_ptr(uint64_t arg) {
75627         LDKSendSuccess* arg_conv = (LDKSendSuccess*)untag_ptr(arg);
75628         int64_t ret_conv = SendSuccess_clone_ptr(arg_conv);
75629         return ret_conv;
75630 }
75631
75632 uint64_t  __attribute__((export_name("TS_SendSuccess_clone"))) TS_SendSuccess_clone(uint64_t orig) {
75633         LDKSendSuccess* orig_conv = (LDKSendSuccess*)untag_ptr(orig);
75634         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
75635         *ret_copy = SendSuccess_clone(orig_conv);
75636         uint64_t ret_ref = tag_ptr(ret_copy, true);
75637         return ret_ref;
75638 }
75639
75640 uint64_t  __attribute__((export_name("TS_SendSuccess_buffered"))) TS_SendSuccess_buffered() {
75641         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
75642         *ret_copy = SendSuccess_buffered();
75643         uint64_t ret_ref = tag_ptr(ret_copy, true);
75644         return ret_ref;
75645 }
75646
75647 uint64_t  __attribute__((export_name("TS_SendSuccess_buffered_awaiting_connection"))) TS_SendSuccess_buffered_awaiting_connection(int8_tArray a) {
75648         LDKPublicKey a_ref;
75649         CHECK(a->arr_len == 33);
75650         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
75651         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
75652         *ret_copy = SendSuccess_buffered_awaiting_connection(a_ref);
75653         uint64_t ret_ref = tag_ptr(ret_copy, true);
75654         return ret_ref;
75655 }
75656
75657 int64_t  __attribute__((export_name("TS_SendSuccess_hash"))) TS_SendSuccess_hash(uint64_t o) {
75658         LDKSendSuccess* o_conv = (LDKSendSuccess*)untag_ptr(o);
75659         int64_t ret_conv = SendSuccess_hash(o_conv);
75660         return ret_conv;
75661 }
75662
75663 jboolean  __attribute__((export_name("TS_SendSuccess_eq"))) TS_SendSuccess_eq(uint64_t a, uint64_t b) {
75664         LDKSendSuccess* a_conv = (LDKSendSuccess*)untag_ptr(a);
75665         LDKSendSuccess* b_conv = (LDKSendSuccess*)untag_ptr(b);
75666         jboolean ret_conv = SendSuccess_eq(a_conv, b_conv);
75667         return ret_conv;
75668 }
75669
75670 void  __attribute__((export_name("TS_SendError_free"))) TS_SendError_free(uint64_t this_ptr) {
75671         if (!ptr_is_owned(this_ptr)) return;
75672         void* this_ptr_ptr = untag_ptr(this_ptr);
75673         CHECK_ACCESS(this_ptr_ptr);
75674         LDKSendError this_ptr_conv = *(LDKSendError*)(this_ptr_ptr);
75675         FREE(untag_ptr(this_ptr));
75676         SendError_free(this_ptr_conv);
75677 }
75678
75679 static inline uint64_t SendError_clone_ptr(LDKSendError *NONNULL_PTR arg) {
75680         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
75681         *ret_copy = SendError_clone(arg);
75682         uint64_t ret_ref = tag_ptr(ret_copy, true);
75683         return ret_ref;
75684 }
75685 int64_t  __attribute__((export_name("TS_SendError_clone_ptr"))) TS_SendError_clone_ptr(uint64_t arg) {
75686         LDKSendError* arg_conv = (LDKSendError*)untag_ptr(arg);
75687         int64_t ret_conv = SendError_clone_ptr(arg_conv);
75688         return ret_conv;
75689 }
75690
75691 uint64_t  __attribute__((export_name("TS_SendError_clone"))) TS_SendError_clone(uint64_t orig) {
75692         LDKSendError* orig_conv = (LDKSendError*)untag_ptr(orig);
75693         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
75694         *ret_copy = SendError_clone(orig_conv);
75695         uint64_t ret_ref = tag_ptr(ret_copy, true);
75696         return ret_ref;
75697 }
75698
75699 uint64_t  __attribute__((export_name("TS_SendError_secp256k1"))) TS_SendError_secp256k1(uint32_t a) {
75700         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
75701         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
75702         *ret_copy = SendError_secp256k1(a_conv);
75703         uint64_t ret_ref = tag_ptr(ret_copy, true);
75704         return ret_ref;
75705 }
75706
75707 uint64_t  __attribute__((export_name("TS_SendError_too_big_packet"))) TS_SendError_too_big_packet() {
75708         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
75709         *ret_copy = SendError_too_big_packet();
75710         uint64_t ret_ref = tag_ptr(ret_copy, true);
75711         return ret_ref;
75712 }
75713
75714 uint64_t  __attribute__((export_name("TS_SendError_too_few_blinded_hops"))) TS_SendError_too_few_blinded_hops() {
75715         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
75716         *ret_copy = SendError_too_few_blinded_hops();
75717         uint64_t ret_ref = tag_ptr(ret_copy, true);
75718         return ret_ref;
75719 }
75720
75721 uint64_t  __attribute__((export_name("TS_SendError_invalid_first_hop"))) TS_SendError_invalid_first_hop(int8_tArray a) {
75722         LDKPublicKey a_ref;
75723         CHECK(a->arr_len == 33);
75724         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
75725         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
75726         *ret_copy = SendError_invalid_first_hop(a_ref);
75727         uint64_t ret_ref = tag_ptr(ret_copy, true);
75728         return ret_ref;
75729 }
75730
75731 uint64_t  __attribute__((export_name("TS_SendError_path_not_found"))) TS_SendError_path_not_found() {
75732         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
75733         *ret_copy = SendError_path_not_found();
75734         uint64_t ret_ref = tag_ptr(ret_copy, true);
75735         return ret_ref;
75736 }
75737
75738 uint64_t  __attribute__((export_name("TS_SendError_invalid_message"))) TS_SendError_invalid_message() {
75739         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
75740         *ret_copy = SendError_invalid_message();
75741         uint64_t ret_ref = tag_ptr(ret_copy, true);
75742         return ret_ref;
75743 }
75744
75745 uint64_t  __attribute__((export_name("TS_SendError_buffer_full"))) TS_SendError_buffer_full() {
75746         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
75747         *ret_copy = SendError_buffer_full();
75748         uint64_t ret_ref = tag_ptr(ret_copy, true);
75749         return ret_ref;
75750 }
75751
75752 uint64_t  __attribute__((export_name("TS_SendError_get_node_id_failed"))) TS_SendError_get_node_id_failed() {
75753         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
75754         *ret_copy = SendError_get_node_id_failed();
75755         uint64_t ret_ref = tag_ptr(ret_copy, true);
75756         return ret_ref;
75757 }
75758
75759 uint64_t  __attribute__((export_name("TS_SendError_unresolved_introduction_node"))) TS_SendError_unresolved_introduction_node() {
75760         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
75761         *ret_copy = SendError_unresolved_introduction_node();
75762         uint64_t ret_ref = tag_ptr(ret_copy, true);
75763         return ret_ref;
75764 }
75765
75766 uint64_t  __attribute__((export_name("TS_SendError_blinded_path_advance_failed"))) TS_SendError_blinded_path_advance_failed() {
75767         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
75768         *ret_copy = SendError_blinded_path_advance_failed();
75769         uint64_t ret_ref = tag_ptr(ret_copy, true);
75770         return ret_ref;
75771 }
75772
75773 int64_t  __attribute__((export_name("TS_SendError_hash"))) TS_SendError_hash(uint64_t o) {
75774         LDKSendError* o_conv = (LDKSendError*)untag_ptr(o);
75775         int64_t ret_conv = SendError_hash(o_conv);
75776         return ret_conv;
75777 }
75778
75779 jboolean  __attribute__((export_name("TS_SendError_eq"))) TS_SendError_eq(uint64_t a, uint64_t b) {
75780         LDKSendError* a_conv = (LDKSendError*)untag_ptr(a);
75781         LDKSendError* b_conv = (LDKSendError*)untag_ptr(b);
75782         jboolean ret_conv = SendError_eq(a_conv, b_conv);
75783         return ret_conv;
75784 }
75785
75786 void  __attribute__((export_name("TS_CustomOnionMessageHandler_free"))) TS_CustomOnionMessageHandler_free(uint64_t this_ptr) {
75787         if (!ptr_is_owned(this_ptr)) return;
75788         void* this_ptr_ptr = untag_ptr(this_ptr);
75789         CHECK_ACCESS(this_ptr_ptr);
75790         LDKCustomOnionMessageHandler this_ptr_conv = *(LDKCustomOnionMessageHandler*)(this_ptr_ptr);
75791         FREE(untag_ptr(this_ptr));
75792         CustomOnionMessageHandler_free(this_ptr_conv);
75793 }
75794
75795 void  __attribute__((export_name("TS_PeeledOnion_free"))) TS_PeeledOnion_free(uint64_t this_ptr) {
75796         if (!ptr_is_owned(this_ptr)) return;
75797         void* this_ptr_ptr = untag_ptr(this_ptr);
75798         CHECK_ACCESS(this_ptr_ptr);
75799         LDKPeeledOnion this_ptr_conv = *(LDKPeeledOnion*)(this_ptr_ptr);
75800         FREE(untag_ptr(this_ptr));
75801         PeeledOnion_free(this_ptr_conv);
75802 }
75803
75804 static inline uint64_t PeeledOnion_clone_ptr(LDKPeeledOnion *NONNULL_PTR arg) {
75805         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
75806         *ret_copy = PeeledOnion_clone(arg);
75807         uint64_t ret_ref = tag_ptr(ret_copy, true);
75808         return ret_ref;
75809 }
75810 int64_t  __attribute__((export_name("TS_PeeledOnion_clone_ptr"))) TS_PeeledOnion_clone_ptr(uint64_t arg) {
75811         LDKPeeledOnion* arg_conv = (LDKPeeledOnion*)untag_ptr(arg);
75812         int64_t ret_conv = PeeledOnion_clone_ptr(arg_conv);
75813         return ret_conv;
75814 }
75815
75816 uint64_t  __attribute__((export_name("TS_PeeledOnion_clone"))) TS_PeeledOnion_clone(uint64_t orig) {
75817         LDKPeeledOnion* orig_conv = (LDKPeeledOnion*)untag_ptr(orig);
75818         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
75819         *ret_copy = PeeledOnion_clone(orig_conv);
75820         uint64_t ret_ref = tag_ptr(ret_copy, true);
75821         return ret_ref;
75822 }
75823
75824 uint64_t  __attribute__((export_name("TS_PeeledOnion_forward"))) TS_PeeledOnion_forward(uint64_t a, uint64_t b) {
75825         void* a_ptr = untag_ptr(a);
75826         CHECK_ACCESS(a_ptr);
75827         LDKNextMessageHop a_conv = *(LDKNextMessageHop*)(a_ptr);
75828         a_conv = NextMessageHop_clone((LDKNextMessageHop*)untag_ptr(a));
75829         LDKOnionMessage b_conv;
75830         b_conv.inner = untag_ptr(b);
75831         b_conv.is_owned = ptr_is_owned(b);
75832         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75833         b_conv = OnionMessage_clone(&b_conv);
75834         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
75835         *ret_copy = PeeledOnion_forward(a_conv, b_conv);
75836         uint64_t ret_ref = tag_ptr(ret_copy, true);
75837         return ret_ref;
75838 }
75839
75840 uint64_t  __attribute__((export_name("TS_PeeledOnion_receive"))) TS_PeeledOnion_receive(uint64_t a, int8_tArray b, uint64_t c) {
75841         void* a_ptr = untag_ptr(a);
75842         CHECK_ACCESS(a_ptr);
75843         LDKParsedOnionMessageContents a_conv = *(LDKParsedOnionMessageContents*)(a_ptr);
75844         a_conv = ParsedOnionMessageContents_clone((LDKParsedOnionMessageContents*)untag_ptr(a));
75845         LDKThirtyTwoBytes b_ref;
75846         CHECK(b->arr_len == 32);
75847         memcpy(b_ref.data, b->elems, 32); FREE(b);
75848         LDKBlindedPath c_conv;
75849         c_conv.inner = untag_ptr(c);
75850         c_conv.is_owned = ptr_is_owned(c);
75851         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
75852         c_conv = BlindedPath_clone(&c_conv);
75853         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
75854         *ret_copy = PeeledOnion_receive(a_conv, b_ref, c_conv);
75855         uint64_t ret_ref = tag_ptr(ret_copy, true);
75856         return ret_ref;
75857 }
75858
75859 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) {
75860         void* entropy_source_ptr = untag_ptr(entropy_source);
75861         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
75862         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
75863         void* node_signer_ptr = untag_ptr(node_signer);
75864         if (ptr_is_owned(node_signer)) { CHECK_ACCESS(node_signer_ptr); }
75865         LDKNodeSigner* node_signer_conv = (LDKNodeSigner*)node_signer_ptr;
75866         void* node_id_lookup_ptr = untag_ptr(node_id_lookup);
75867         if (ptr_is_owned(node_id_lookup)) { CHECK_ACCESS(node_id_lookup_ptr); }
75868         LDKNodeIdLookUp* node_id_lookup_conv = (LDKNodeIdLookUp*)node_id_lookup_ptr;
75869         LDKReadOnlyNetworkGraph network_graph_conv;
75870         network_graph_conv.inner = untag_ptr(network_graph);
75871         network_graph_conv.is_owned = ptr_is_owned(network_graph);
75872         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
75873         network_graph_conv.is_owned = false;
75874         LDKOnionMessagePath path_conv;
75875         path_conv.inner = untag_ptr(path);
75876         path_conv.is_owned = ptr_is_owned(path);
75877         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
75878         path_conv = OnionMessagePath_clone(&path_conv);
75879         void* contents_ptr = untag_ptr(contents);
75880         CHECK_ACCESS(contents_ptr);
75881         LDKOnionMessageContents contents_conv = *(LDKOnionMessageContents*)(contents_ptr);
75882         if (contents_conv.free == LDKOnionMessageContents_JCalls_free) {
75883                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75884                 LDKOnionMessageContents_JCalls_cloned(&contents_conv);
75885         }
75886         LDKBlindedPath reply_path_conv;
75887         reply_path_conv.inner = untag_ptr(reply_path);
75888         reply_path_conv.is_owned = ptr_is_owned(reply_path);
75889         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
75890         reply_path_conv = BlindedPath_clone(&reply_path_conv);
75891         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
75892         *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);
75893         return tag_ptr(ret_conv, true);
75894 }
75895
75896 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) {
75897         void* entropy_source_ptr = untag_ptr(entropy_source);
75898         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
75899         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
75900         void* node_signer_ptr = untag_ptr(node_signer);
75901         if (ptr_is_owned(node_signer)) { CHECK_ACCESS(node_signer_ptr); }
75902         LDKNodeSigner* node_signer_conv = (LDKNodeSigner*)node_signer_ptr;
75903         void* node_id_lookup_ptr = untag_ptr(node_id_lookup);
75904         if (ptr_is_owned(node_id_lookup)) { CHECK_ACCESS(node_id_lookup_ptr); }
75905         LDKNodeIdLookUp* node_id_lookup_conv = (LDKNodeIdLookUp*)node_id_lookup_ptr;
75906         LDKOnionMessagePath path_conv;
75907         path_conv.inner = untag_ptr(path);
75908         path_conv.is_owned = ptr_is_owned(path);
75909         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
75910         path_conv = OnionMessagePath_clone(&path_conv);
75911         void* contents_ptr = untag_ptr(contents);
75912         CHECK_ACCESS(contents_ptr);
75913         LDKOnionMessageContents contents_conv = *(LDKOnionMessageContents*)(contents_ptr);
75914         if (contents_conv.free == LDKOnionMessageContents_JCalls_free) {
75915                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75916                 LDKOnionMessageContents_JCalls_cloned(&contents_conv);
75917         }
75918         LDKBlindedPath reply_path_conv;
75919         reply_path_conv.inner = untag_ptr(reply_path);
75920         reply_path_conv.is_owned = ptr_is_owned(reply_path);
75921         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
75922         reply_path_conv = BlindedPath_clone(&reply_path_conv);
75923         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
75924         *ret_conv = create_onion_message(entropy_source_conv, node_signer_conv, node_id_lookup_conv, path_conv, contents_conv, reply_path_conv);
75925         return tag_ptr(ret_conv, true);
75926 }
75927
75928 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) {
75929         LDKOnionMessage msg_conv;
75930         msg_conv.inner = untag_ptr(msg);
75931         msg_conv.is_owned = ptr_is_owned(msg);
75932         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
75933         msg_conv.is_owned = false;
75934         void* node_signer_ptr = untag_ptr(node_signer);
75935         CHECK_ACCESS(node_signer_ptr);
75936         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
75937         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
75938                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75939                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
75940         }
75941         void* logger_ptr = untag_ptr(logger);
75942         CHECK_ACCESS(logger_ptr);
75943         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
75944         if (logger_conv.free == LDKLogger_JCalls_free) {
75945                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75946                 LDKLogger_JCalls_cloned(&logger_conv);
75947         }
75948         void* custom_handler_ptr = untag_ptr(custom_handler);
75949         CHECK_ACCESS(custom_handler_ptr);
75950         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
75951         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
75952                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75953                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
75954         }
75955         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
75956         *ret_conv = peel_onion_message(&msg_conv, node_signer_conv, logger_conv, custom_handler_conv);
75957         return tag_ptr(ret_conv, true);
75958 }
75959
75960 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) {
75961         void* entropy_source_ptr = untag_ptr(entropy_source);
75962         CHECK_ACCESS(entropy_source_ptr);
75963         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
75964         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
75965                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75966                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
75967         }
75968         void* node_signer_ptr = untag_ptr(node_signer);
75969         CHECK_ACCESS(node_signer_ptr);
75970         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
75971         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
75972                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75973                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
75974         }
75975         void* logger_ptr = untag_ptr(logger);
75976         CHECK_ACCESS(logger_ptr);
75977         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
75978         if (logger_conv.free == LDKLogger_JCalls_free) {
75979                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75980                 LDKLogger_JCalls_cloned(&logger_conv);
75981         }
75982         void* node_id_lookup_ptr = untag_ptr(node_id_lookup);
75983         CHECK_ACCESS(node_id_lookup_ptr);
75984         LDKNodeIdLookUp node_id_lookup_conv = *(LDKNodeIdLookUp*)(node_id_lookup_ptr);
75985         if (node_id_lookup_conv.free == LDKNodeIdLookUp_JCalls_free) {
75986                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75987                 LDKNodeIdLookUp_JCalls_cloned(&node_id_lookup_conv);
75988         }
75989         void* message_router_ptr = untag_ptr(message_router);
75990         CHECK_ACCESS(message_router_ptr);
75991         LDKMessageRouter message_router_conv = *(LDKMessageRouter*)(message_router_ptr);
75992         if (message_router_conv.free == LDKMessageRouter_JCalls_free) {
75993                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75994                 LDKMessageRouter_JCalls_cloned(&message_router_conv);
75995         }
75996         void* offers_handler_ptr = untag_ptr(offers_handler);
75997         CHECK_ACCESS(offers_handler_ptr);
75998         LDKOffersMessageHandler offers_handler_conv = *(LDKOffersMessageHandler*)(offers_handler_ptr);
75999         if (offers_handler_conv.free == LDKOffersMessageHandler_JCalls_free) {
76000                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76001                 LDKOffersMessageHandler_JCalls_cloned(&offers_handler_conv);
76002         }
76003         void* custom_handler_ptr = untag_ptr(custom_handler);
76004         CHECK_ACCESS(custom_handler_ptr);
76005         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
76006         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
76007                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76008                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
76009         }
76010         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);
76011         uint64_t ret_ref = 0;
76012         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76013         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76014         return ret_ref;
76015 }
76016
76017 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) {
76018         LDKOnionMessenger this_arg_conv;
76019         this_arg_conv.inner = untag_ptr(this_arg);
76020         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76022         this_arg_conv.is_owned = false;
76023         void* contents_ptr = untag_ptr(contents);
76024         CHECK_ACCESS(contents_ptr);
76025         LDKOnionMessageContents contents_conv = *(LDKOnionMessageContents*)(contents_ptr);
76026         if (contents_conv.free == LDKOnionMessageContents_JCalls_free) {
76027                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76028                 LDKOnionMessageContents_JCalls_cloned(&contents_conv);
76029         }
76030         void* destination_ptr = untag_ptr(destination);
76031         CHECK_ACCESS(destination_ptr);
76032         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
76033         destination_conv = Destination_clone((LDKDestination*)untag_ptr(destination));
76034         LDKBlindedPath reply_path_conv;
76035         reply_path_conv.inner = untag_ptr(reply_path);
76036         reply_path_conv.is_owned = ptr_is_owned(reply_path);
76037         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
76038         reply_path_conv = BlindedPath_clone(&reply_path_conv);
76039         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
76040         *ret_conv = OnionMessenger_send_onion_message(&this_arg_conv, contents_conv, destination_conv, reply_path_conv);
76041         return tag_ptr(ret_conv, true);
76042 }
76043
76044 uint64_t  __attribute__((export_name("TS_OnionMessenger_as_OnionMessageHandler"))) TS_OnionMessenger_as_OnionMessageHandler(uint64_t this_arg) {
76045         LDKOnionMessenger this_arg_conv;
76046         this_arg_conv.inner = untag_ptr(this_arg);
76047         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76049         this_arg_conv.is_owned = false;
76050         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
76051         *ret_ret = OnionMessenger_as_OnionMessageHandler(&this_arg_conv);
76052         return tag_ptr(ret_ret, true);
76053 }
76054
76055 void  __attribute__((export_name("TS_OffersMessageHandler_free"))) TS_OffersMessageHandler_free(uint64_t this_ptr) {
76056         if (!ptr_is_owned(this_ptr)) return;
76057         void* this_ptr_ptr = untag_ptr(this_ptr);
76058         CHECK_ACCESS(this_ptr_ptr);
76059         LDKOffersMessageHandler this_ptr_conv = *(LDKOffersMessageHandler*)(this_ptr_ptr);
76060         FREE(untag_ptr(this_ptr));
76061         OffersMessageHandler_free(this_ptr_conv);
76062 }
76063
76064 void  __attribute__((export_name("TS_OffersMessage_free"))) TS_OffersMessage_free(uint64_t this_ptr) {
76065         if (!ptr_is_owned(this_ptr)) return;
76066         void* this_ptr_ptr = untag_ptr(this_ptr);
76067         CHECK_ACCESS(this_ptr_ptr);
76068         LDKOffersMessage this_ptr_conv = *(LDKOffersMessage*)(this_ptr_ptr);
76069         FREE(untag_ptr(this_ptr));
76070         OffersMessage_free(this_ptr_conv);
76071 }
76072
76073 static inline uint64_t OffersMessage_clone_ptr(LDKOffersMessage *NONNULL_PTR arg) {
76074         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
76075         *ret_copy = OffersMessage_clone(arg);
76076         uint64_t ret_ref = tag_ptr(ret_copy, true);
76077         return ret_ref;
76078 }
76079 int64_t  __attribute__((export_name("TS_OffersMessage_clone_ptr"))) TS_OffersMessage_clone_ptr(uint64_t arg) {
76080         LDKOffersMessage* arg_conv = (LDKOffersMessage*)untag_ptr(arg);
76081         int64_t ret_conv = OffersMessage_clone_ptr(arg_conv);
76082         return ret_conv;
76083 }
76084
76085 uint64_t  __attribute__((export_name("TS_OffersMessage_clone"))) TS_OffersMessage_clone(uint64_t orig) {
76086         LDKOffersMessage* orig_conv = (LDKOffersMessage*)untag_ptr(orig);
76087         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
76088         *ret_copy = OffersMessage_clone(orig_conv);
76089         uint64_t ret_ref = tag_ptr(ret_copy, true);
76090         return ret_ref;
76091 }
76092
76093 uint64_t  __attribute__((export_name("TS_OffersMessage_invoice_request"))) TS_OffersMessage_invoice_request(uint64_t a) {
76094         LDKInvoiceRequest a_conv;
76095         a_conv.inner = untag_ptr(a);
76096         a_conv.is_owned = ptr_is_owned(a);
76097         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
76098         a_conv = InvoiceRequest_clone(&a_conv);
76099         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
76100         *ret_copy = OffersMessage_invoice_request(a_conv);
76101         uint64_t ret_ref = tag_ptr(ret_copy, true);
76102         return ret_ref;
76103 }
76104
76105 uint64_t  __attribute__((export_name("TS_OffersMessage_invoice"))) TS_OffersMessage_invoice(uint64_t a) {
76106         LDKBolt12Invoice a_conv;
76107         a_conv.inner = untag_ptr(a);
76108         a_conv.is_owned = ptr_is_owned(a);
76109         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
76110         a_conv = Bolt12Invoice_clone(&a_conv);
76111         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
76112         *ret_copy = OffersMessage_invoice(a_conv);
76113         uint64_t ret_ref = tag_ptr(ret_copy, true);
76114         return ret_ref;
76115 }
76116
76117 uint64_t  __attribute__((export_name("TS_OffersMessage_invoice_error"))) TS_OffersMessage_invoice_error(uint64_t a) {
76118         LDKInvoiceError a_conv;
76119         a_conv.inner = untag_ptr(a);
76120         a_conv.is_owned = ptr_is_owned(a);
76121         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
76122         a_conv = InvoiceError_clone(&a_conv);
76123         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
76124         *ret_copy = OffersMessage_invoice_error(a_conv);
76125         uint64_t ret_ref = tag_ptr(ret_copy, true);
76126         return ret_ref;
76127 }
76128
76129 jboolean  __attribute__((export_name("TS_OffersMessage_is_known_type"))) TS_OffersMessage_is_known_type(int64_t tlv_type) {
76130         jboolean ret_conv = OffersMessage_is_known_type(tlv_type);
76131         return ret_conv;
76132 }
76133
76134 uint64_t  __attribute__((export_name("TS_OffersMessage_as_OnionMessageContents"))) TS_OffersMessage_as_OnionMessageContents(uint64_t this_arg) {
76135         LDKOffersMessage* this_arg_conv = (LDKOffersMessage*)untag_ptr(this_arg);
76136         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
76137         *ret_ret = OffersMessage_as_OnionMessageContents(this_arg_conv);
76138         return tag_ptr(ret_ret, true);
76139 }
76140
76141 int8_tArray  __attribute__((export_name("TS_OffersMessage_write"))) TS_OffersMessage_write(uint64_t obj) {
76142         LDKOffersMessage* obj_conv = (LDKOffersMessage*)untag_ptr(obj);
76143         LDKCVec_u8Z ret_var = OffersMessage_write(obj_conv);
76144         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
76145         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
76146         CVec_u8Z_free(ret_var);
76147         return ret_arr;
76148 }
76149
76150 uint64_t  __attribute__((export_name("TS_OffersMessage_read"))) TS_OffersMessage_read(int8_tArray ser, int64_t arg_a, uint64_t arg_b) {
76151         LDKu8slice ser_ref;
76152         ser_ref.datalen = ser->arr_len;
76153         ser_ref.data = ser->elems;
76154         void* arg_b_ptr = untag_ptr(arg_b);
76155         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
76156         LDKLogger* arg_b_conv = (LDKLogger*)arg_b_ptr;
76157         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
76158         *ret_conv = OffersMessage_read(ser_ref, arg_a, arg_b_conv);
76159         FREE(ser);
76160         return tag_ptr(ret_conv, true);
76161 }
76162
76163 void  __attribute__((export_name("TS_Packet_free"))) TS_Packet_free(uint64_t this_obj) {
76164         LDKPacket this_obj_conv;
76165         this_obj_conv.inner = untag_ptr(this_obj);
76166         this_obj_conv.is_owned = ptr_is_owned(this_obj);
76167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
76168         Packet_free(this_obj_conv);
76169 }
76170
76171 int8_t  __attribute__((export_name("TS_Packet_get_version"))) TS_Packet_get_version(uint64_t this_ptr) {
76172         LDKPacket this_ptr_conv;
76173         this_ptr_conv.inner = untag_ptr(this_ptr);
76174         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76176         this_ptr_conv.is_owned = false;
76177         int8_t ret_conv = Packet_get_version(&this_ptr_conv);
76178         return ret_conv;
76179 }
76180
76181 void  __attribute__((export_name("TS_Packet_set_version"))) TS_Packet_set_version(uint64_t this_ptr, int8_t val) {
76182         LDKPacket this_ptr_conv;
76183         this_ptr_conv.inner = untag_ptr(this_ptr);
76184         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76186         this_ptr_conv.is_owned = false;
76187         Packet_set_version(&this_ptr_conv, val);
76188 }
76189
76190 int8_tArray  __attribute__((export_name("TS_Packet_get_public_key"))) TS_Packet_get_public_key(uint64_t this_ptr) {
76191         LDKPacket this_ptr_conv;
76192         this_ptr_conv.inner = untag_ptr(this_ptr);
76193         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76195         this_ptr_conv.is_owned = false;
76196         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
76197         memcpy(ret_arr->elems, Packet_get_public_key(&this_ptr_conv).compressed_form, 33);
76198         return ret_arr;
76199 }
76200
76201 void  __attribute__((export_name("TS_Packet_set_public_key"))) TS_Packet_set_public_key(uint64_t this_ptr, int8_tArray val) {
76202         LDKPacket this_ptr_conv;
76203         this_ptr_conv.inner = untag_ptr(this_ptr);
76204         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76206         this_ptr_conv.is_owned = false;
76207         LDKPublicKey val_ref;
76208         CHECK(val->arr_len == 33);
76209         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
76210         Packet_set_public_key(&this_ptr_conv, val_ref);
76211 }
76212
76213 int8_tArray  __attribute__((export_name("TS_Packet_get_hop_data"))) TS_Packet_get_hop_data(uint64_t this_ptr) {
76214         LDKPacket this_ptr_conv;
76215         this_ptr_conv.inner = untag_ptr(this_ptr);
76216         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76218         this_ptr_conv.is_owned = false;
76219         LDKCVec_u8Z ret_var = Packet_get_hop_data(&this_ptr_conv);
76220         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
76221         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
76222         CVec_u8Z_free(ret_var);
76223         return ret_arr;
76224 }
76225
76226 void  __attribute__((export_name("TS_Packet_set_hop_data"))) TS_Packet_set_hop_data(uint64_t this_ptr, int8_tArray val) {
76227         LDKPacket this_ptr_conv;
76228         this_ptr_conv.inner = untag_ptr(this_ptr);
76229         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76231         this_ptr_conv.is_owned = false;
76232         LDKCVec_u8Z val_ref;
76233         val_ref.datalen = val->arr_len;
76234         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
76235         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
76236         Packet_set_hop_data(&this_ptr_conv, val_ref);
76237 }
76238
76239 int8_tArray  __attribute__((export_name("TS_Packet_get_hmac"))) TS_Packet_get_hmac(uint64_t this_ptr) {
76240         LDKPacket this_ptr_conv;
76241         this_ptr_conv.inner = untag_ptr(this_ptr);
76242         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76244         this_ptr_conv.is_owned = false;
76245         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
76246         memcpy(ret_arr->elems, *Packet_get_hmac(&this_ptr_conv), 32);
76247         return ret_arr;
76248 }
76249
76250 void  __attribute__((export_name("TS_Packet_set_hmac"))) TS_Packet_set_hmac(uint64_t this_ptr, int8_tArray val) {
76251         LDKPacket this_ptr_conv;
76252         this_ptr_conv.inner = untag_ptr(this_ptr);
76253         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76255         this_ptr_conv.is_owned = false;
76256         LDKThirtyTwoBytes val_ref;
76257         CHECK(val->arr_len == 32);
76258         memcpy(val_ref.data, val->elems, 32); FREE(val);
76259         Packet_set_hmac(&this_ptr_conv, val_ref);
76260 }
76261
76262 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) {
76263         LDKPublicKey public_key_arg_ref;
76264         CHECK(public_key_arg->arr_len == 33);
76265         memcpy(public_key_arg_ref.compressed_form, public_key_arg->elems, 33); FREE(public_key_arg);
76266         LDKCVec_u8Z hop_data_arg_ref;
76267         hop_data_arg_ref.datalen = hop_data_arg->arr_len;
76268         hop_data_arg_ref.data = MALLOC(hop_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
76269         memcpy(hop_data_arg_ref.data, hop_data_arg->elems, hop_data_arg_ref.datalen); FREE(hop_data_arg);
76270         LDKThirtyTwoBytes hmac_arg_ref;
76271         CHECK(hmac_arg->arr_len == 32);
76272         memcpy(hmac_arg_ref.data, hmac_arg->elems, 32); FREE(hmac_arg);
76273         LDKPacket ret_var = Packet_new(version_arg, public_key_arg_ref, hop_data_arg_ref, hmac_arg_ref);
76274         uint64_t ret_ref = 0;
76275         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76276         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76277         return ret_ref;
76278 }
76279
76280 static inline uint64_t Packet_clone_ptr(LDKPacket *NONNULL_PTR arg) {
76281         LDKPacket ret_var = Packet_clone(arg);
76282         uint64_t ret_ref = 0;
76283         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76284         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76285         return ret_ref;
76286 }
76287 int64_t  __attribute__((export_name("TS_Packet_clone_ptr"))) TS_Packet_clone_ptr(uint64_t arg) {
76288         LDKPacket arg_conv;
76289         arg_conv.inner = untag_ptr(arg);
76290         arg_conv.is_owned = ptr_is_owned(arg);
76291         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
76292         arg_conv.is_owned = false;
76293         int64_t ret_conv = Packet_clone_ptr(&arg_conv);
76294         return ret_conv;
76295 }
76296
76297 uint64_t  __attribute__((export_name("TS_Packet_clone"))) TS_Packet_clone(uint64_t orig) {
76298         LDKPacket orig_conv;
76299         orig_conv.inner = untag_ptr(orig);
76300         orig_conv.is_owned = ptr_is_owned(orig);
76301         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
76302         orig_conv.is_owned = false;
76303         LDKPacket ret_var = Packet_clone(&orig_conv);
76304         uint64_t ret_ref = 0;
76305         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76306         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76307         return ret_ref;
76308 }
76309
76310 int64_t  __attribute__((export_name("TS_Packet_hash"))) TS_Packet_hash(uint64_t o) {
76311         LDKPacket o_conv;
76312         o_conv.inner = untag_ptr(o);
76313         o_conv.is_owned = ptr_is_owned(o);
76314         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
76315         o_conv.is_owned = false;
76316         int64_t ret_conv = Packet_hash(&o_conv);
76317         return ret_conv;
76318 }
76319
76320 jboolean  __attribute__((export_name("TS_Packet_eq"))) TS_Packet_eq(uint64_t a, uint64_t b) {
76321         LDKPacket a_conv;
76322         a_conv.inner = untag_ptr(a);
76323         a_conv.is_owned = ptr_is_owned(a);
76324         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
76325         a_conv.is_owned = false;
76326         LDKPacket b_conv;
76327         b_conv.inner = untag_ptr(b);
76328         b_conv.is_owned = ptr_is_owned(b);
76329         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
76330         b_conv.is_owned = false;
76331         jboolean ret_conv = Packet_eq(&a_conv, &b_conv);
76332         return ret_conv;
76333 }
76334
76335 int8_tArray  __attribute__((export_name("TS_Packet_write"))) TS_Packet_write(uint64_t obj) {
76336         LDKPacket obj_conv;
76337         obj_conv.inner = untag_ptr(obj);
76338         obj_conv.is_owned = ptr_is_owned(obj);
76339         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
76340         obj_conv.is_owned = false;
76341         LDKCVec_u8Z ret_var = Packet_write(&obj_conv);
76342         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
76343         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
76344         CVec_u8Z_free(ret_var);
76345         return ret_arr;
76346 }
76347
76348 void  __attribute__((export_name("TS_ParsedOnionMessageContents_free"))) TS_ParsedOnionMessageContents_free(uint64_t this_ptr) {
76349         if (!ptr_is_owned(this_ptr)) return;
76350         void* this_ptr_ptr = untag_ptr(this_ptr);
76351         CHECK_ACCESS(this_ptr_ptr);
76352         LDKParsedOnionMessageContents this_ptr_conv = *(LDKParsedOnionMessageContents*)(this_ptr_ptr);
76353         FREE(untag_ptr(this_ptr));
76354         ParsedOnionMessageContents_free(this_ptr_conv);
76355 }
76356
76357 static inline uint64_t ParsedOnionMessageContents_clone_ptr(LDKParsedOnionMessageContents *NONNULL_PTR arg) {
76358         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
76359         *ret_copy = ParsedOnionMessageContents_clone(arg);
76360         uint64_t ret_ref = tag_ptr(ret_copy, true);
76361         return ret_ref;
76362 }
76363 int64_t  __attribute__((export_name("TS_ParsedOnionMessageContents_clone_ptr"))) TS_ParsedOnionMessageContents_clone_ptr(uint64_t arg) {
76364         LDKParsedOnionMessageContents* arg_conv = (LDKParsedOnionMessageContents*)untag_ptr(arg);
76365         int64_t ret_conv = ParsedOnionMessageContents_clone_ptr(arg_conv);
76366         return ret_conv;
76367 }
76368
76369 uint64_t  __attribute__((export_name("TS_ParsedOnionMessageContents_clone"))) TS_ParsedOnionMessageContents_clone(uint64_t orig) {
76370         LDKParsedOnionMessageContents* orig_conv = (LDKParsedOnionMessageContents*)untag_ptr(orig);
76371         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
76372         *ret_copy = ParsedOnionMessageContents_clone(orig_conv);
76373         uint64_t ret_ref = tag_ptr(ret_copy, true);
76374         return ret_ref;
76375 }
76376
76377 uint64_t  __attribute__((export_name("TS_ParsedOnionMessageContents_offers"))) TS_ParsedOnionMessageContents_offers(uint64_t a) {
76378         void* a_ptr = untag_ptr(a);
76379         CHECK_ACCESS(a_ptr);
76380         LDKOffersMessage a_conv = *(LDKOffersMessage*)(a_ptr);
76381         a_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(a));
76382         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
76383         *ret_copy = ParsedOnionMessageContents_offers(a_conv);
76384         uint64_t ret_ref = tag_ptr(ret_copy, true);
76385         return ret_ref;
76386 }
76387
76388 uint64_t  __attribute__((export_name("TS_ParsedOnionMessageContents_custom"))) TS_ParsedOnionMessageContents_custom(uint64_t a) {
76389         void* a_ptr = untag_ptr(a);
76390         CHECK_ACCESS(a_ptr);
76391         LDKOnionMessageContents a_conv = *(LDKOnionMessageContents*)(a_ptr);
76392         if (a_conv.free == LDKOnionMessageContents_JCalls_free) {
76393                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76394                 LDKOnionMessageContents_JCalls_cloned(&a_conv);
76395         }
76396         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
76397         *ret_copy = ParsedOnionMessageContents_custom(a_conv);
76398         uint64_t ret_ref = tag_ptr(ret_copy, true);
76399         return ret_ref;
76400 }
76401
76402 uint64_t  __attribute__((export_name("TS_ParsedOnionMessageContents_as_OnionMessageContents"))) TS_ParsedOnionMessageContents_as_OnionMessageContents(uint64_t this_arg) {
76403         LDKParsedOnionMessageContents* this_arg_conv = (LDKParsedOnionMessageContents*)untag_ptr(this_arg);
76404         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
76405         *ret_ret = ParsedOnionMessageContents_as_OnionMessageContents(this_arg_conv);
76406         return tag_ptr(ret_ret, true);
76407 }
76408
76409 int8_tArray  __attribute__((export_name("TS_ParsedOnionMessageContents_write"))) TS_ParsedOnionMessageContents_write(uint64_t obj) {
76410         LDKParsedOnionMessageContents* obj_conv = (LDKParsedOnionMessageContents*)untag_ptr(obj);
76411         LDKCVec_u8Z ret_var = ParsedOnionMessageContents_write(obj_conv);
76412         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
76413         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
76414         CVec_u8Z_free(ret_var);
76415         return ret_arr;
76416 }
76417
76418 static inline uint64_t OnionMessageContents_clone_ptr(LDKOnionMessageContents *NONNULL_PTR arg) {
76419         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
76420         *ret_ret = OnionMessageContents_clone(arg);
76421         return tag_ptr(ret_ret, true);
76422 }
76423 int64_t  __attribute__((export_name("TS_OnionMessageContents_clone_ptr"))) TS_OnionMessageContents_clone_ptr(uint64_t arg) {
76424         void* arg_ptr = untag_ptr(arg);
76425         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
76426         LDKOnionMessageContents* arg_conv = (LDKOnionMessageContents*)arg_ptr;
76427         int64_t ret_conv = OnionMessageContents_clone_ptr(arg_conv);
76428         return ret_conv;
76429 }
76430
76431 uint64_t  __attribute__((export_name("TS_OnionMessageContents_clone"))) TS_OnionMessageContents_clone(uint64_t orig) {
76432         void* orig_ptr = untag_ptr(orig);
76433         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
76434         LDKOnionMessageContents* orig_conv = (LDKOnionMessageContents*)orig_ptr;
76435         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
76436         *ret_ret = OnionMessageContents_clone(orig_conv);
76437         return tag_ptr(ret_ret, true);
76438 }
76439
76440 void  __attribute__((export_name("TS_OnionMessageContents_free"))) TS_OnionMessageContents_free(uint64_t this_ptr) {
76441         if (!ptr_is_owned(this_ptr)) return;
76442         void* this_ptr_ptr = untag_ptr(this_ptr);
76443         CHECK_ACCESS(this_ptr_ptr);
76444         LDKOnionMessageContents this_ptr_conv = *(LDKOnionMessageContents*)(this_ptr_ptr);
76445         FREE(untag_ptr(this_ptr));
76446         OnionMessageContents_free(this_ptr_conv);
76447 }
76448
76449 void  __attribute__((export_name("TS_NextMessageHop_free"))) TS_NextMessageHop_free(uint64_t this_ptr) {
76450         if (!ptr_is_owned(this_ptr)) return;
76451         void* this_ptr_ptr = untag_ptr(this_ptr);
76452         CHECK_ACCESS(this_ptr_ptr);
76453         LDKNextMessageHop this_ptr_conv = *(LDKNextMessageHop*)(this_ptr_ptr);
76454         FREE(untag_ptr(this_ptr));
76455         NextMessageHop_free(this_ptr_conv);
76456 }
76457
76458 static inline uint64_t NextMessageHop_clone_ptr(LDKNextMessageHop *NONNULL_PTR arg) {
76459         LDKNextMessageHop *ret_copy = MALLOC(sizeof(LDKNextMessageHop), "LDKNextMessageHop");
76460         *ret_copy = NextMessageHop_clone(arg);
76461         uint64_t ret_ref = tag_ptr(ret_copy, true);
76462         return ret_ref;
76463 }
76464 int64_t  __attribute__((export_name("TS_NextMessageHop_clone_ptr"))) TS_NextMessageHop_clone_ptr(uint64_t arg) {
76465         LDKNextMessageHop* arg_conv = (LDKNextMessageHop*)untag_ptr(arg);
76466         int64_t ret_conv = NextMessageHop_clone_ptr(arg_conv);
76467         return ret_conv;
76468 }
76469
76470 uint64_t  __attribute__((export_name("TS_NextMessageHop_clone"))) TS_NextMessageHop_clone(uint64_t orig) {
76471         LDKNextMessageHop* orig_conv = (LDKNextMessageHop*)untag_ptr(orig);
76472         LDKNextMessageHop *ret_copy = MALLOC(sizeof(LDKNextMessageHop), "LDKNextMessageHop");
76473         *ret_copy = NextMessageHop_clone(orig_conv);
76474         uint64_t ret_ref = tag_ptr(ret_copy, true);
76475         return ret_ref;
76476 }
76477
76478 uint64_t  __attribute__((export_name("TS_NextMessageHop_node_id"))) TS_NextMessageHop_node_id(int8_tArray a) {
76479         LDKPublicKey a_ref;
76480         CHECK(a->arr_len == 33);
76481         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
76482         LDKNextMessageHop *ret_copy = MALLOC(sizeof(LDKNextMessageHop), "LDKNextMessageHop");
76483         *ret_copy = NextMessageHop_node_id(a_ref);
76484         uint64_t ret_ref = tag_ptr(ret_copy, true);
76485         return ret_ref;
76486 }
76487
76488 uint64_t  __attribute__((export_name("TS_NextMessageHop_short_channel_id"))) TS_NextMessageHop_short_channel_id(int64_t a) {
76489         LDKNextMessageHop *ret_copy = MALLOC(sizeof(LDKNextMessageHop), "LDKNextMessageHop");
76490         *ret_copy = NextMessageHop_short_channel_id(a);
76491         uint64_t ret_ref = tag_ptr(ret_copy, true);
76492         return ret_ref;
76493 }
76494
76495 int64_t  __attribute__((export_name("TS_NextMessageHop_hash"))) TS_NextMessageHop_hash(uint64_t o) {
76496         LDKNextMessageHop* o_conv = (LDKNextMessageHop*)untag_ptr(o);
76497         int64_t ret_conv = NextMessageHop_hash(o_conv);
76498         return ret_conv;
76499 }
76500
76501 jboolean  __attribute__((export_name("TS_NextMessageHop_eq"))) TS_NextMessageHop_eq(uint64_t a, uint64_t b) {
76502         LDKNextMessageHop* a_conv = (LDKNextMessageHop*)untag_ptr(a);
76503         LDKNextMessageHop* b_conv = (LDKNextMessageHop*)untag_ptr(b);
76504         jboolean ret_conv = NextMessageHop_eq(a_conv, b_conv);
76505         return ret_conv;
76506 }
76507
76508 void  __attribute__((export_name("TS_BlindedPath_free"))) TS_BlindedPath_free(uint64_t this_obj) {
76509         LDKBlindedPath this_obj_conv;
76510         this_obj_conv.inner = untag_ptr(this_obj);
76511         this_obj_conv.is_owned = ptr_is_owned(this_obj);
76512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
76513         BlindedPath_free(this_obj_conv);
76514 }
76515
76516 uint64_t  __attribute__((export_name("TS_BlindedPath_get_introduction_node"))) TS_BlindedPath_get_introduction_node(uint64_t this_ptr) {
76517         LDKBlindedPath this_ptr_conv;
76518         this_ptr_conv.inner = untag_ptr(this_ptr);
76519         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76521         this_ptr_conv.is_owned = false;
76522         LDKIntroductionNode *ret_copy = MALLOC(sizeof(LDKIntroductionNode), "LDKIntroductionNode");
76523         *ret_copy = BlindedPath_get_introduction_node(&this_ptr_conv);
76524         uint64_t ret_ref = tag_ptr(ret_copy, true);
76525         return ret_ref;
76526 }
76527
76528 void  __attribute__((export_name("TS_BlindedPath_set_introduction_node"))) TS_BlindedPath_set_introduction_node(uint64_t this_ptr, uint64_t val) {
76529         LDKBlindedPath this_ptr_conv;
76530         this_ptr_conv.inner = untag_ptr(this_ptr);
76531         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76533         this_ptr_conv.is_owned = false;
76534         void* val_ptr = untag_ptr(val);
76535         CHECK_ACCESS(val_ptr);
76536         LDKIntroductionNode val_conv = *(LDKIntroductionNode*)(val_ptr);
76537         val_conv = IntroductionNode_clone((LDKIntroductionNode*)untag_ptr(val));
76538         BlindedPath_set_introduction_node(&this_ptr_conv, val_conv);
76539 }
76540
76541 int8_tArray  __attribute__((export_name("TS_BlindedPath_get_blinding_point"))) TS_BlindedPath_get_blinding_point(uint64_t this_ptr) {
76542         LDKBlindedPath this_ptr_conv;
76543         this_ptr_conv.inner = untag_ptr(this_ptr);
76544         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76546         this_ptr_conv.is_owned = false;
76547         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
76548         memcpy(ret_arr->elems, BlindedPath_get_blinding_point(&this_ptr_conv).compressed_form, 33);
76549         return ret_arr;
76550 }
76551
76552 void  __attribute__((export_name("TS_BlindedPath_set_blinding_point"))) TS_BlindedPath_set_blinding_point(uint64_t this_ptr, int8_tArray val) {
76553         LDKBlindedPath this_ptr_conv;
76554         this_ptr_conv.inner = untag_ptr(this_ptr);
76555         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76557         this_ptr_conv.is_owned = false;
76558         LDKPublicKey val_ref;
76559         CHECK(val->arr_len == 33);
76560         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
76561         BlindedPath_set_blinding_point(&this_ptr_conv, val_ref);
76562 }
76563
76564 uint64_tArray  __attribute__((export_name("TS_BlindedPath_get_blinded_hops"))) TS_BlindedPath_get_blinded_hops(uint64_t this_ptr) {
76565         LDKBlindedPath this_ptr_conv;
76566         this_ptr_conv.inner = untag_ptr(this_ptr);
76567         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76569         this_ptr_conv.is_owned = false;
76570         LDKCVec_BlindedHopZ ret_var = BlindedPath_get_blinded_hops(&this_ptr_conv);
76571         uint64_tArray ret_arr = NULL;
76572         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
76573         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
76574         for (size_t m = 0; m < ret_var.datalen; m++) {
76575                 LDKBlindedHop ret_conv_12_var = ret_var.data[m];
76576                 uint64_t ret_conv_12_ref = 0;
76577                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_var);
76578                 ret_conv_12_ref = tag_ptr(ret_conv_12_var.inner, ret_conv_12_var.is_owned);
76579                 ret_arr_ptr[m] = ret_conv_12_ref;
76580         }
76581         
76582         FREE(ret_var.data);
76583         return ret_arr;
76584 }
76585
76586 void  __attribute__((export_name("TS_BlindedPath_set_blinded_hops"))) TS_BlindedPath_set_blinded_hops(uint64_t this_ptr, uint64_tArray val) {
76587         LDKBlindedPath this_ptr_conv;
76588         this_ptr_conv.inner = untag_ptr(this_ptr);
76589         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76591         this_ptr_conv.is_owned = false;
76592         LDKCVec_BlindedHopZ val_constr;
76593         val_constr.datalen = val->arr_len;
76594         if (val_constr.datalen > 0)
76595                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
76596         else
76597                 val_constr.data = NULL;
76598         uint64_t* val_vals = val->elems;
76599         for (size_t m = 0; m < val_constr.datalen; m++) {
76600                 uint64_t val_conv_12 = val_vals[m];
76601                 LDKBlindedHop val_conv_12_conv;
76602                 val_conv_12_conv.inner = untag_ptr(val_conv_12);
76603                 val_conv_12_conv.is_owned = ptr_is_owned(val_conv_12);
76604                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv);
76605                 val_conv_12_conv = BlindedHop_clone(&val_conv_12_conv);
76606                 val_constr.data[m] = val_conv_12_conv;
76607         }
76608         FREE(val);
76609         BlindedPath_set_blinded_hops(&this_ptr_conv, val_constr);
76610 }
76611
76612 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) {
76613         void* introduction_node_arg_ptr = untag_ptr(introduction_node_arg);
76614         CHECK_ACCESS(introduction_node_arg_ptr);
76615         LDKIntroductionNode introduction_node_arg_conv = *(LDKIntroductionNode*)(introduction_node_arg_ptr);
76616         introduction_node_arg_conv = IntroductionNode_clone((LDKIntroductionNode*)untag_ptr(introduction_node_arg));
76617         LDKPublicKey blinding_point_arg_ref;
76618         CHECK(blinding_point_arg->arr_len == 33);
76619         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
76620         LDKCVec_BlindedHopZ blinded_hops_arg_constr;
76621         blinded_hops_arg_constr.datalen = blinded_hops_arg->arr_len;
76622         if (blinded_hops_arg_constr.datalen > 0)
76623                 blinded_hops_arg_constr.data = MALLOC(blinded_hops_arg_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
76624         else
76625                 blinded_hops_arg_constr.data = NULL;
76626         uint64_t* blinded_hops_arg_vals = blinded_hops_arg->elems;
76627         for (size_t m = 0; m < blinded_hops_arg_constr.datalen; m++) {
76628                 uint64_t blinded_hops_arg_conv_12 = blinded_hops_arg_vals[m];
76629                 LDKBlindedHop blinded_hops_arg_conv_12_conv;
76630                 blinded_hops_arg_conv_12_conv.inner = untag_ptr(blinded_hops_arg_conv_12);
76631                 blinded_hops_arg_conv_12_conv.is_owned = ptr_is_owned(blinded_hops_arg_conv_12);
76632                 CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_hops_arg_conv_12_conv);
76633                 blinded_hops_arg_conv_12_conv = BlindedHop_clone(&blinded_hops_arg_conv_12_conv);
76634                 blinded_hops_arg_constr.data[m] = blinded_hops_arg_conv_12_conv;
76635         }
76636         FREE(blinded_hops_arg);
76637         LDKBlindedPath ret_var = BlindedPath_new(introduction_node_arg_conv, blinding_point_arg_ref, blinded_hops_arg_constr);
76638         uint64_t ret_ref = 0;
76639         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76640         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76641         return ret_ref;
76642 }
76643
76644 static inline uint64_t BlindedPath_clone_ptr(LDKBlindedPath *NONNULL_PTR arg) {
76645         LDKBlindedPath ret_var = BlindedPath_clone(arg);
76646         uint64_t ret_ref = 0;
76647         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76648         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76649         return ret_ref;
76650 }
76651 int64_t  __attribute__((export_name("TS_BlindedPath_clone_ptr"))) TS_BlindedPath_clone_ptr(uint64_t arg) {
76652         LDKBlindedPath arg_conv;
76653         arg_conv.inner = untag_ptr(arg);
76654         arg_conv.is_owned = ptr_is_owned(arg);
76655         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
76656         arg_conv.is_owned = false;
76657         int64_t ret_conv = BlindedPath_clone_ptr(&arg_conv);
76658         return ret_conv;
76659 }
76660
76661 uint64_t  __attribute__((export_name("TS_BlindedPath_clone"))) TS_BlindedPath_clone(uint64_t orig) {
76662         LDKBlindedPath orig_conv;
76663         orig_conv.inner = untag_ptr(orig);
76664         orig_conv.is_owned = ptr_is_owned(orig);
76665         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
76666         orig_conv.is_owned = false;
76667         LDKBlindedPath ret_var = BlindedPath_clone(&orig_conv);
76668         uint64_t ret_ref = 0;
76669         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76670         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76671         return ret_ref;
76672 }
76673
76674 int64_t  __attribute__((export_name("TS_BlindedPath_hash"))) TS_BlindedPath_hash(uint64_t o) {
76675         LDKBlindedPath o_conv;
76676         o_conv.inner = untag_ptr(o);
76677         o_conv.is_owned = ptr_is_owned(o);
76678         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
76679         o_conv.is_owned = false;
76680         int64_t ret_conv = BlindedPath_hash(&o_conv);
76681         return ret_conv;
76682 }
76683
76684 jboolean  __attribute__((export_name("TS_BlindedPath_eq"))) TS_BlindedPath_eq(uint64_t a, uint64_t b) {
76685         LDKBlindedPath a_conv;
76686         a_conv.inner = untag_ptr(a);
76687         a_conv.is_owned = ptr_is_owned(a);
76688         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
76689         a_conv.is_owned = false;
76690         LDKBlindedPath b_conv;
76691         b_conv.inner = untag_ptr(b);
76692         b_conv.is_owned = ptr_is_owned(b);
76693         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
76694         b_conv.is_owned = false;
76695         jboolean ret_conv = BlindedPath_eq(&a_conv, &b_conv);
76696         return ret_conv;
76697 }
76698
76699 void  __attribute__((export_name("TS_IntroductionNode_free"))) TS_IntroductionNode_free(uint64_t this_ptr) {
76700         if (!ptr_is_owned(this_ptr)) return;
76701         void* this_ptr_ptr = untag_ptr(this_ptr);
76702         CHECK_ACCESS(this_ptr_ptr);
76703         LDKIntroductionNode this_ptr_conv = *(LDKIntroductionNode*)(this_ptr_ptr);
76704         FREE(untag_ptr(this_ptr));
76705         IntroductionNode_free(this_ptr_conv);
76706 }
76707
76708 static inline uint64_t IntroductionNode_clone_ptr(LDKIntroductionNode *NONNULL_PTR arg) {
76709         LDKIntroductionNode *ret_copy = MALLOC(sizeof(LDKIntroductionNode), "LDKIntroductionNode");
76710         *ret_copy = IntroductionNode_clone(arg);
76711         uint64_t ret_ref = tag_ptr(ret_copy, true);
76712         return ret_ref;
76713 }
76714 int64_t  __attribute__((export_name("TS_IntroductionNode_clone_ptr"))) TS_IntroductionNode_clone_ptr(uint64_t arg) {
76715         LDKIntroductionNode* arg_conv = (LDKIntroductionNode*)untag_ptr(arg);
76716         int64_t ret_conv = IntroductionNode_clone_ptr(arg_conv);
76717         return ret_conv;
76718 }
76719
76720 uint64_t  __attribute__((export_name("TS_IntroductionNode_clone"))) TS_IntroductionNode_clone(uint64_t orig) {
76721         LDKIntroductionNode* orig_conv = (LDKIntroductionNode*)untag_ptr(orig);
76722         LDKIntroductionNode *ret_copy = MALLOC(sizeof(LDKIntroductionNode), "LDKIntroductionNode");
76723         *ret_copy = IntroductionNode_clone(orig_conv);
76724         uint64_t ret_ref = tag_ptr(ret_copy, true);
76725         return ret_ref;
76726 }
76727
76728 uint64_t  __attribute__((export_name("TS_IntroductionNode_node_id"))) TS_IntroductionNode_node_id(int8_tArray a) {
76729         LDKPublicKey a_ref;
76730         CHECK(a->arr_len == 33);
76731         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
76732         LDKIntroductionNode *ret_copy = MALLOC(sizeof(LDKIntroductionNode), "LDKIntroductionNode");
76733         *ret_copy = IntroductionNode_node_id(a_ref);
76734         uint64_t ret_ref = tag_ptr(ret_copy, true);
76735         return ret_ref;
76736 }
76737
76738 uint64_t  __attribute__((export_name("TS_IntroductionNode_directed_short_channel_id"))) TS_IntroductionNode_directed_short_channel_id(uint32_t a, int64_t b) {
76739         LDKDirection a_conv = LDKDirection_from_js(a);
76740         LDKIntroductionNode *ret_copy = MALLOC(sizeof(LDKIntroductionNode), "LDKIntroductionNode");
76741         *ret_copy = IntroductionNode_directed_short_channel_id(a_conv, b);
76742         uint64_t ret_ref = tag_ptr(ret_copy, true);
76743         return ret_ref;
76744 }
76745
76746 int64_t  __attribute__((export_name("TS_IntroductionNode_hash"))) TS_IntroductionNode_hash(uint64_t o) {
76747         LDKIntroductionNode* o_conv = (LDKIntroductionNode*)untag_ptr(o);
76748         int64_t ret_conv = IntroductionNode_hash(o_conv);
76749         return ret_conv;
76750 }
76751
76752 jboolean  __attribute__((export_name("TS_IntroductionNode_eq"))) TS_IntroductionNode_eq(uint64_t a, uint64_t b) {
76753         LDKIntroductionNode* a_conv = (LDKIntroductionNode*)untag_ptr(a);
76754         LDKIntroductionNode* b_conv = (LDKIntroductionNode*)untag_ptr(b);
76755         jboolean ret_conv = IntroductionNode_eq(a_conv, b_conv);
76756         return ret_conv;
76757 }
76758
76759 uint32_t  __attribute__((export_name("TS_Direction_clone"))) TS_Direction_clone(uint64_t orig) {
76760         LDKDirection* orig_conv = (LDKDirection*)untag_ptr(orig);
76761         uint32_t ret_conv = LDKDirection_to_js(Direction_clone(orig_conv));
76762         return ret_conv;
76763 }
76764
76765 uint32_t  __attribute__((export_name("TS_Direction_node_one"))) TS_Direction_node_one() {
76766         uint32_t ret_conv = LDKDirection_to_js(Direction_node_one());
76767         return ret_conv;
76768 }
76769
76770 uint32_t  __attribute__((export_name("TS_Direction_node_two"))) TS_Direction_node_two() {
76771         uint32_t ret_conv = LDKDirection_to_js(Direction_node_two());
76772         return ret_conv;
76773 }
76774
76775 int64_t  __attribute__((export_name("TS_Direction_hash"))) TS_Direction_hash(uint64_t o) {
76776         LDKDirection* o_conv = (LDKDirection*)untag_ptr(o);
76777         int64_t ret_conv = Direction_hash(o_conv);
76778         return ret_conv;
76779 }
76780
76781 jboolean  __attribute__((export_name("TS_Direction_eq"))) TS_Direction_eq(uint64_t a, uint64_t b) {
76782         LDKDirection* a_conv = (LDKDirection*)untag_ptr(a);
76783         LDKDirection* b_conv = (LDKDirection*)untag_ptr(b);
76784         jboolean ret_conv = Direction_eq(a_conv, b_conv);
76785         return ret_conv;
76786 }
76787
76788 void  __attribute__((export_name("TS_NodeIdLookUp_free"))) TS_NodeIdLookUp_free(uint64_t this_ptr) {
76789         if (!ptr_is_owned(this_ptr)) return;
76790         void* this_ptr_ptr = untag_ptr(this_ptr);
76791         CHECK_ACCESS(this_ptr_ptr);
76792         LDKNodeIdLookUp this_ptr_conv = *(LDKNodeIdLookUp*)(this_ptr_ptr);
76793         FREE(untag_ptr(this_ptr));
76794         NodeIdLookUp_free(this_ptr_conv);
76795 }
76796
76797 void  __attribute__((export_name("TS_EmptyNodeIdLookUp_free"))) TS_EmptyNodeIdLookUp_free(uint64_t this_obj) {
76798         LDKEmptyNodeIdLookUp this_obj_conv;
76799         this_obj_conv.inner = untag_ptr(this_obj);
76800         this_obj_conv.is_owned = ptr_is_owned(this_obj);
76801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
76802         EmptyNodeIdLookUp_free(this_obj_conv);
76803 }
76804
76805 uint64_t  __attribute__((export_name("TS_EmptyNodeIdLookUp_new"))) TS_EmptyNodeIdLookUp_new() {
76806         LDKEmptyNodeIdLookUp ret_var = EmptyNodeIdLookUp_new();
76807         uint64_t ret_ref = 0;
76808         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76809         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76810         return ret_ref;
76811 }
76812
76813 uint64_t  __attribute__((export_name("TS_EmptyNodeIdLookUp_as_NodeIdLookUp"))) TS_EmptyNodeIdLookUp_as_NodeIdLookUp(uint64_t this_arg) {
76814         LDKEmptyNodeIdLookUp this_arg_conv;
76815         this_arg_conv.inner = untag_ptr(this_arg);
76816         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76818         this_arg_conv.is_owned = false;
76819         LDKNodeIdLookUp* ret_ret = MALLOC(sizeof(LDKNodeIdLookUp), "LDKNodeIdLookUp");
76820         *ret_ret = EmptyNodeIdLookUp_as_NodeIdLookUp(&this_arg_conv);
76821         return tag_ptr(ret_ret, true);
76822 }
76823
76824 void  __attribute__((export_name("TS_BlindedHop_free"))) TS_BlindedHop_free(uint64_t this_obj) {
76825         LDKBlindedHop this_obj_conv;
76826         this_obj_conv.inner = untag_ptr(this_obj);
76827         this_obj_conv.is_owned = ptr_is_owned(this_obj);
76828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
76829         BlindedHop_free(this_obj_conv);
76830 }
76831
76832 int8_tArray  __attribute__((export_name("TS_BlindedHop_get_blinded_node_id"))) TS_BlindedHop_get_blinded_node_id(uint64_t this_ptr) {
76833         LDKBlindedHop this_ptr_conv;
76834         this_ptr_conv.inner = untag_ptr(this_ptr);
76835         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76837         this_ptr_conv.is_owned = false;
76838         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
76839         memcpy(ret_arr->elems, BlindedHop_get_blinded_node_id(&this_ptr_conv).compressed_form, 33);
76840         return ret_arr;
76841 }
76842
76843 void  __attribute__((export_name("TS_BlindedHop_set_blinded_node_id"))) TS_BlindedHop_set_blinded_node_id(uint64_t this_ptr, int8_tArray val) {
76844         LDKBlindedHop this_ptr_conv;
76845         this_ptr_conv.inner = untag_ptr(this_ptr);
76846         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76848         this_ptr_conv.is_owned = false;
76849         LDKPublicKey val_ref;
76850         CHECK(val->arr_len == 33);
76851         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
76852         BlindedHop_set_blinded_node_id(&this_ptr_conv, val_ref);
76853 }
76854
76855 int8_tArray  __attribute__((export_name("TS_BlindedHop_get_encrypted_payload"))) TS_BlindedHop_get_encrypted_payload(uint64_t this_ptr) {
76856         LDKBlindedHop this_ptr_conv;
76857         this_ptr_conv.inner = untag_ptr(this_ptr);
76858         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76860         this_ptr_conv.is_owned = false;
76861         LDKCVec_u8Z ret_var = BlindedHop_get_encrypted_payload(&this_ptr_conv);
76862         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
76863         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
76864         CVec_u8Z_free(ret_var);
76865         return ret_arr;
76866 }
76867
76868 void  __attribute__((export_name("TS_BlindedHop_set_encrypted_payload"))) TS_BlindedHop_set_encrypted_payload(uint64_t this_ptr, int8_tArray val) {
76869         LDKBlindedHop this_ptr_conv;
76870         this_ptr_conv.inner = untag_ptr(this_ptr);
76871         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76873         this_ptr_conv.is_owned = false;
76874         LDKCVec_u8Z val_ref;
76875         val_ref.datalen = val->arr_len;
76876         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
76877         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
76878         BlindedHop_set_encrypted_payload(&this_ptr_conv, val_ref);
76879 }
76880
76881 uint64_t  __attribute__((export_name("TS_BlindedHop_new"))) TS_BlindedHop_new(int8_tArray blinded_node_id_arg, int8_tArray encrypted_payload_arg) {
76882         LDKPublicKey blinded_node_id_arg_ref;
76883         CHECK(blinded_node_id_arg->arr_len == 33);
76884         memcpy(blinded_node_id_arg_ref.compressed_form, blinded_node_id_arg->elems, 33); FREE(blinded_node_id_arg);
76885         LDKCVec_u8Z encrypted_payload_arg_ref;
76886         encrypted_payload_arg_ref.datalen = encrypted_payload_arg->arr_len;
76887         encrypted_payload_arg_ref.data = MALLOC(encrypted_payload_arg_ref.datalen, "LDKCVec_u8Z Bytes");
76888         memcpy(encrypted_payload_arg_ref.data, encrypted_payload_arg->elems, encrypted_payload_arg_ref.datalen); FREE(encrypted_payload_arg);
76889         LDKBlindedHop ret_var = BlindedHop_new(blinded_node_id_arg_ref, encrypted_payload_arg_ref);
76890         uint64_t ret_ref = 0;
76891         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76892         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76893         return ret_ref;
76894 }
76895
76896 static inline uint64_t BlindedHop_clone_ptr(LDKBlindedHop *NONNULL_PTR arg) {
76897         LDKBlindedHop ret_var = BlindedHop_clone(arg);
76898         uint64_t ret_ref = 0;
76899         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76900         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76901         return ret_ref;
76902 }
76903 int64_t  __attribute__((export_name("TS_BlindedHop_clone_ptr"))) TS_BlindedHop_clone_ptr(uint64_t arg) {
76904         LDKBlindedHop arg_conv;
76905         arg_conv.inner = untag_ptr(arg);
76906         arg_conv.is_owned = ptr_is_owned(arg);
76907         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
76908         arg_conv.is_owned = false;
76909         int64_t ret_conv = BlindedHop_clone_ptr(&arg_conv);
76910         return ret_conv;
76911 }
76912
76913 uint64_t  __attribute__((export_name("TS_BlindedHop_clone"))) TS_BlindedHop_clone(uint64_t orig) {
76914         LDKBlindedHop orig_conv;
76915         orig_conv.inner = untag_ptr(orig);
76916         orig_conv.is_owned = ptr_is_owned(orig);
76917         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
76918         orig_conv.is_owned = false;
76919         LDKBlindedHop ret_var = BlindedHop_clone(&orig_conv);
76920         uint64_t ret_ref = 0;
76921         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76922         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76923         return ret_ref;
76924 }
76925
76926 int64_t  __attribute__((export_name("TS_BlindedHop_hash"))) TS_BlindedHop_hash(uint64_t o) {
76927         LDKBlindedHop o_conv;
76928         o_conv.inner = untag_ptr(o);
76929         o_conv.is_owned = ptr_is_owned(o);
76930         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
76931         o_conv.is_owned = false;
76932         int64_t ret_conv = BlindedHop_hash(&o_conv);
76933         return ret_conv;
76934 }
76935
76936 jboolean  __attribute__((export_name("TS_BlindedHop_eq"))) TS_BlindedHop_eq(uint64_t a, uint64_t b) {
76937         LDKBlindedHop a_conv;
76938         a_conv.inner = untag_ptr(a);
76939         a_conv.is_owned = ptr_is_owned(a);
76940         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
76941         a_conv.is_owned = false;
76942         LDKBlindedHop b_conv;
76943         b_conv.inner = untag_ptr(b);
76944         b_conv.is_owned = ptr_is_owned(b);
76945         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
76946         b_conv.is_owned = false;
76947         jboolean ret_conv = BlindedHop_eq(&a_conv, &b_conv);
76948         return ret_conv;
76949 }
76950
76951 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) {
76952         LDKPublicKey recipient_node_id_ref;
76953         CHECK(recipient_node_id->arr_len == 33);
76954         memcpy(recipient_node_id_ref.compressed_form, recipient_node_id->elems, 33); FREE(recipient_node_id);
76955         void* entropy_source_ptr = untag_ptr(entropy_source);
76956         CHECK_ACCESS(entropy_source_ptr);
76957         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
76958         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
76959                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76960                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
76961         }
76962         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
76963         *ret_conv = BlindedPath_one_hop_for_message(recipient_node_id_ref, entropy_source_conv);
76964         return tag_ptr(ret_conv, true);
76965 }
76966
76967 uint64_t  __attribute__((export_name("TS_BlindedPath_new_for_message"))) TS_BlindedPath_new_for_message(ptrArray node_pks, uint64_t entropy_source) {
76968         LDKCVec_PublicKeyZ node_pks_constr;
76969         node_pks_constr.datalen = node_pks->arr_len;
76970         if (node_pks_constr.datalen > 0)
76971                 node_pks_constr.data = MALLOC(node_pks_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
76972         else
76973                 node_pks_constr.data = NULL;
76974         int8_tArray* node_pks_vals = (void*) node_pks->elems;
76975         for (size_t m = 0; m < node_pks_constr.datalen; m++) {
76976                 int8_tArray node_pks_conv_12 = node_pks_vals[m];
76977                 LDKPublicKey node_pks_conv_12_ref;
76978                 CHECK(node_pks_conv_12->arr_len == 33);
76979                 memcpy(node_pks_conv_12_ref.compressed_form, node_pks_conv_12->elems, 33); FREE(node_pks_conv_12);
76980                 node_pks_constr.data[m] = node_pks_conv_12_ref;
76981         }
76982         FREE(node_pks);
76983         void* entropy_source_ptr = untag_ptr(entropy_source);
76984         CHECK_ACCESS(entropy_source_ptr);
76985         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
76986         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
76987                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76988                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
76989         }
76990         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
76991         *ret_conv = BlindedPath_new_for_message(node_pks_constr, entropy_source_conv);
76992         return tag_ptr(ret_conv, true);
76993 }
76994
76995 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) {
76996         LDKPublicKey payee_node_id_ref;
76997         CHECK(payee_node_id->arr_len == 33);
76998         memcpy(payee_node_id_ref.compressed_form, payee_node_id->elems, 33); FREE(payee_node_id);
76999         LDKReceiveTlvs payee_tlvs_conv;
77000         payee_tlvs_conv.inner = untag_ptr(payee_tlvs);
77001         payee_tlvs_conv.is_owned = ptr_is_owned(payee_tlvs);
77002         CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_tlvs_conv);
77003         payee_tlvs_conv = ReceiveTlvs_clone(&payee_tlvs_conv);
77004         void* entropy_source_ptr = untag_ptr(entropy_source);
77005         CHECK_ACCESS(entropy_source_ptr);
77006         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
77007         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
77008                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77009                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
77010         }
77011         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
77012         *ret_conv = BlindedPath_one_hop_for_payment(payee_node_id_ref, payee_tlvs_conv, min_final_cltv_expiry_delta, entropy_source_conv);
77013         return tag_ptr(ret_conv, true);
77014 }
77015
77016 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) {
77017         LDKCVec_ForwardNodeZ intermediate_nodes_constr;
77018         intermediate_nodes_constr.datalen = intermediate_nodes->arr_len;
77019         if (intermediate_nodes_constr.datalen > 0)
77020                 intermediate_nodes_constr.data = MALLOC(intermediate_nodes_constr.datalen * sizeof(LDKForwardNode), "LDKCVec_ForwardNodeZ Elements");
77021         else
77022                 intermediate_nodes_constr.data = NULL;
77023         uint64_t* intermediate_nodes_vals = intermediate_nodes->elems;
77024         for (size_t n = 0; n < intermediate_nodes_constr.datalen; n++) {
77025                 uint64_t intermediate_nodes_conv_13 = intermediate_nodes_vals[n];
77026                 LDKForwardNode intermediate_nodes_conv_13_conv;
77027                 intermediate_nodes_conv_13_conv.inner = untag_ptr(intermediate_nodes_conv_13);
77028                 intermediate_nodes_conv_13_conv.is_owned = ptr_is_owned(intermediate_nodes_conv_13);
77029                 CHECK_INNER_FIELD_ACCESS_OR_NULL(intermediate_nodes_conv_13_conv);
77030                 intermediate_nodes_conv_13_conv = ForwardNode_clone(&intermediate_nodes_conv_13_conv);
77031                 intermediate_nodes_constr.data[n] = intermediate_nodes_conv_13_conv;
77032         }
77033         FREE(intermediate_nodes);
77034         LDKPublicKey payee_node_id_ref;
77035         CHECK(payee_node_id->arr_len == 33);
77036         memcpy(payee_node_id_ref.compressed_form, payee_node_id->elems, 33); FREE(payee_node_id);
77037         LDKReceiveTlvs payee_tlvs_conv;
77038         payee_tlvs_conv.inner = untag_ptr(payee_tlvs);
77039         payee_tlvs_conv.is_owned = ptr_is_owned(payee_tlvs);
77040         CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_tlvs_conv);
77041         payee_tlvs_conv = ReceiveTlvs_clone(&payee_tlvs_conv);
77042         void* entropy_source_ptr = untag_ptr(entropy_source);
77043         CHECK_ACCESS(entropy_source_ptr);
77044         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
77045         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
77046                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77047                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
77048         }
77049         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
77050         *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);
77051         return tag_ptr(ret_conv, true);
77052 }
77053
77054 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) {
77055         LDKBlindedPath this_arg_conv;
77056         this_arg_conv.inner = untag_ptr(this_arg);
77057         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77059         this_arg_conv.is_owned = false;
77060         LDKReadOnlyNetworkGraph network_graph_conv;
77061         network_graph_conv.inner = untag_ptr(network_graph);
77062         network_graph_conv.is_owned = ptr_is_owned(network_graph);
77063         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
77064         network_graph_conv.is_owned = false;
77065         LDKNodeId ret_var = BlindedPath_public_introduction_node_id(&this_arg_conv, &network_graph_conv);
77066         uint64_t ret_ref = 0;
77067         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77068         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77069         return ret_ref;
77070 }
77071
77072 int8_tArray  __attribute__((export_name("TS_BlindedPath_write"))) TS_BlindedPath_write(uint64_t obj) {
77073         LDKBlindedPath obj_conv;
77074         obj_conv.inner = untag_ptr(obj);
77075         obj_conv.is_owned = ptr_is_owned(obj);
77076         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
77077         obj_conv.is_owned = false;
77078         LDKCVec_u8Z ret_var = BlindedPath_write(&obj_conv);
77079         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
77080         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
77081         CVec_u8Z_free(ret_var);
77082         return ret_arr;
77083 }
77084
77085 uint64_t  __attribute__((export_name("TS_BlindedPath_read"))) TS_BlindedPath_read(int8_tArray ser) {
77086         LDKu8slice ser_ref;
77087         ser_ref.datalen = ser->arr_len;
77088         ser_ref.data = ser->elems;
77089         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
77090         *ret_conv = BlindedPath_read(ser_ref);
77091         FREE(ser);
77092         return tag_ptr(ret_conv, true);
77093 }
77094
77095 int8_tArray  __attribute__((export_name("TS_BlindedHop_write"))) TS_BlindedHop_write(uint64_t obj) {
77096         LDKBlindedHop obj_conv;
77097         obj_conv.inner = untag_ptr(obj);
77098         obj_conv.is_owned = ptr_is_owned(obj);
77099         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
77100         obj_conv.is_owned = false;
77101         LDKCVec_u8Z ret_var = BlindedHop_write(&obj_conv);
77102         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
77103         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
77104         CVec_u8Z_free(ret_var);
77105         return ret_arr;
77106 }
77107
77108 uint64_t  __attribute__((export_name("TS_BlindedHop_read"))) TS_BlindedHop_read(int8_tArray ser) {
77109         LDKu8slice ser_ref;
77110         ser_ref.datalen = ser->arr_len;
77111         ser_ref.data = ser->elems;
77112         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
77113         *ret_conv = BlindedHop_read(ser_ref);
77114         FREE(ser);
77115         return tag_ptr(ret_conv, true);
77116 }
77117
77118 void  __attribute__((export_name("TS_ForwardNode_free"))) TS_ForwardNode_free(uint64_t this_obj) {
77119         LDKForwardNode this_obj_conv;
77120         this_obj_conv.inner = untag_ptr(this_obj);
77121         this_obj_conv.is_owned = ptr_is_owned(this_obj);
77122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
77123         ForwardNode_free(this_obj_conv);
77124 }
77125
77126 uint64_t  __attribute__((export_name("TS_ForwardNode_get_tlvs"))) TS_ForwardNode_get_tlvs(uint64_t this_ptr) {
77127         LDKForwardNode this_ptr_conv;
77128         this_ptr_conv.inner = untag_ptr(this_ptr);
77129         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77131         this_ptr_conv.is_owned = false;
77132         LDKForwardTlvs ret_var = ForwardNode_get_tlvs(&this_ptr_conv);
77133         uint64_t ret_ref = 0;
77134         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77135         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77136         return ret_ref;
77137 }
77138
77139 void  __attribute__((export_name("TS_ForwardNode_set_tlvs"))) TS_ForwardNode_set_tlvs(uint64_t this_ptr, uint64_t val) {
77140         LDKForwardNode this_ptr_conv;
77141         this_ptr_conv.inner = untag_ptr(this_ptr);
77142         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77144         this_ptr_conv.is_owned = false;
77145         LDKForwardTlvs val_conv;
77146         val_conv.inner = untag_ptr(val);
77147         val_conv.is_owned = ptr_is_owned(val);
77148         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
77149         val_conv = ForwardTlvs_clone(&val_conv);
77150         ForwardNode_set_tlvs(&this_ptr_conv, val_conv);
77151 }
77152
77153 int8_tArray  __attribute__((export_name("TS_ForwardNode_get_node_id"))) TS_ForwardNode_get_node_id(uint64_t this_ptr) {
77154         LDKForwardNode this_ptr_conv;
77155         this_ptr_conv.inner = untag_ptr(this_ptr);
77156         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77158         this_ptr_conv.is_owned = false;
77159         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
77160         memcpy(ret_arr->elems, ForwardNode_get_node_id(&this_ptr_conv).compressed_form, 33);
77161         return ret_arr;
77162 }
77163
77164 void  __attribute__((export_name("TS_ForwardNode_set_node_id"))) TS_ForwardNode_set_node_id(uint64_t this_ptr, int8_tArray val) {
77165         LDKForwardNode this_ptr_conv;
77166         this_ptr_conv.inner = untag_ptr(this_ptr);
77167         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77169         this_ptr_conv.is_owned = false;
77170         LDKPublicKey val_ref;
77171         CHECK(val->arr_len == 33);
77172         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
77173         ForwardNode_set_node_id(&this_ptr_conv, val_ref);
77174 }
77175
77176 int64_t  __attribute__((export_name("TS_ForwardNode_get_htlc_maximum_msat"))) TS_ForwardNode_get_htlc_maximum_msat(uint64_t this_ptr) {
77177         LDKForwardNode this_ptr_conv;
77178         this_ptr_conv.inner = untag_ptr(this_ptr);
77179         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77181         this_ptr_conv.is_owned = false;
77182         int64_t ret_conv = ForwardNode_get_htlc_maximum_msat(&this_ptr_conv);
77183         return ret_conv;
77184 }
77185
77186 void  __attribute__((export_name("TS_ForwardNode_set_htlc_maximum_msat"))) TS_ForwardNode_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
77187         LDKForwardNode this_ptr_conv;
77188         this_ptr_conv.inner = untag_ptr(this_ptr);
77189         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77191         this_ptr_conv.is_owned = false;
77192         ForwardNode_set_htlc_maximum_msat(&this_ptr_conv, val);
77193 }
77194
77195 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) {
77196         LDKForwardTlvs tlvs_arg_conv;
77197         tlvs_arg_conv.inner = untag_ptr(tlvs_arg);
77198         tlvs_arg_conv.is_owned = ptr_is_owned(tlvs_arg);
77199         CHECK_INNER_FIELD_ACCESS_OR_NULL(tlvs_arg_conv);
77200         tlvs_arg_conv = ForwardTlvs_clone(&tlvs_arg_conv);
77201         LDKPublicKey node_id_arg_ref;
77202         CHECK(node_id_arg->arr_len == 33);
77203         memcpy(node_id_arg_ref.compressed_form, node_id_arg->elems, 33); FREE(node_id_arg);
77204         LDKForwardNode ret_var = ForwardNode_new(tlvs_arg_conv, node_id_arg_ref, htlc_maximum_msat_arg);
77205         uint64_t ret_ref = 0;
77206         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77207         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77208         return ret_ref;
77209 }
77210
77211 static inline uint64_t ForwardNode_clone_ptr(LDKForwardNode *NONNULL_PTR arg) {
77212         LDKForwardNode ret_var = ForwardNode_clone(arg);
77213         uint64_t ret_ref = 0;
77214         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77215         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77216         return ret_ref;
77217 }
77218 int64_t  __attribute__((export_name("TS_ForwardNode_clone_ptr"))) TS_ForwardNode_clone_ptr(uint64_t arg) {
77219         LDKForwardNode arg_conv;
77220         arg_conv.inner = untag_ptr(arg);
77221         arg_conv.is_owned = ptr_is_owned(arg);
77222         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
77223         arg_conv.is_owned = false;
77224         int64_t ret_conv = ForwardNode_clone_ptr(&arg_conv);
77225         return ret_conv;
77226 }
77227
77228 uint64_t  __attribute__((export_name("TS_ForwardNode_clone"))) TS_ForwardNode_clone(uint64_t orig) {
77229         LDKForwardNode orig_conv;
77230         orig_conv.inner = untag_ptr(orig);
77231         orig_conv.is_owned = ptr_is_owned(orig);
77232         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
77233         orig_conv.is_owned = false;
77234         LDKForwardNode ret_var = ForwardNode_clone(&orig_conv);
77235         uint64_t ret_ref = 0;
77236         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77237         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77238         return ret_ref;
77239 }
77240
77241 void  __attribute__((export_name("TS_ForwardTlvs_free"))) TS_ForwardTlvs_free(uint64_t this_obj) {
77242         LDKForwardTlvs this_obj_conv;
77243         this_obj_conv.inner = untag_ptr(this_obj);
77244         this_obj_conv.is_owned = ptr_is_owned(this_obj);
77245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
77246         ForwardTlvs_free(this_obj_conv);
77247 }
77248
77249 int64_t  __attribute__((export_name("TS_ForwardTlvs_get_short_channel_id"))) TS_ForwardTlvs_get_short_channel_id(uint64_t this_ptr) {
77250         LDKForwardTlvs this_ptr_conv;
77251         this_ptr_conv.inner = untag_ptr(this_ptr);
77252         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77254         this_ptr_conv.is_owned = false;
77255         int64_t ret_conv = ForwardTlvs_get_short_channel_id(&this_ptr_conv);
77256         return ret_conv;
77257 }
77258
77259 void  __attribute__((export_name("TS_ForwardTlvs_set_short_channel_id"))) TS_ForwardTlvs_set_short_channel_id(uint64_t this_ptr, int64_t val) {
77260         LDKForwardTlvs this_ptr_conv;
77261         this_ptr_conv.inner = untag_ptr(this_ptr);
77262         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77264         this_ptr_conv.is_owned = false;
77265         ForwardTlvs_set_short_channel_id(&this_ptr_conv, val);
77266 }
77267
77268 uint64_t  __attribute__((export_name("TS_ForwardTlvs_get_payment_relay"))) TS_ForwardTlvs_get_payment_relay(uint64_t this_ptr) {
77269         LDKForwardTlvs this_ptr_conv;
77270         this_ptr_conv.inner = untag_ptr(this_ptr);
77271         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77273         this_ptr_conv.is_owned = false;
77274         LDKPaymentRelay ret_var = ForwardTlvs_get_payment_relay(&this_ptr_conv);
77275         uint64_t ret_ref = 0;
77276         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77277         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77278         return ret_ref;
77279 }
77280
77281 void  __attribute__((export_name("TS_ForwardTlvs_set_payment_relay"))) TS_ForwardTlvs_set_payment_relay(uint64_t this_ptr, uint64_t val) {
77282         LDKForwardTlvs this_ptr_conv;
77283         this_ptr_conv.inner = untag_ptr(this_ptr);
77284         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77286         this_ptr_conv.is_owned = false;
77287         LDKPaymentRelay val_conv;
77288         val_conv.inner = untag_ptr(val);
77289         val_conv.is_owned = ptr_is_owned(val);
77290         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
77291         val_conv = PaymentRelay_clone(&val_conv);
77292         ForwardTlvs_set_payment_relay(&this_ptr_conv, val_conv);
77293 }
77294
77295 uint64_t  __attribute__((export_name("TS_ForwardTlvs_get_payment_constraints"))) TS_ForwardTlvs_get_payment_constraints(uint64_t this_ptr) {
77296         LDKForwardTlvs this_ptr_conv;
77297         this_ptr_conv.inner = untag_ptr(this_ptr);
77298         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77300         this_ptr_conv.is_owned = false;
77301         LDKPaymentConstraints ret_var = ForwardTlvs_get_payment_constraints(&this_ptr_conv);
77302         uint64_t ret_ref = 0;
77303         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77304         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77305         return ret_ref;
77306 }
77307
77308 void  __attribute__((export_name("TS_ForwardTlvs_set_payment_constraints"))) TS_ForwardTlvs_set_payment_constraints(uint64_t this_ptr, uint64_t val) {
77309         LDKForwardTlvs this_ptr_conv;
77310         this_ptr_conv.inner = untag_ptr(this_ptr);
77311         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77313         this_ptr_conv.is_owned = false;
77314         LDKPaymentConstraints val_conv;
77315         val_conv.inner = untag_ptr(val);
77316         val_conv.is_owned = ptr_is_owned(val);
77317         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
77318         val_conv = PaymentConstraints_clone(&val_conv);
77319         ForwardTlvs_set_payment_constraints(&this_ptr_conv, val_conv);
77320 }
77321
77322 uint64_t  __attribute__((export_name("TS_ForwardTlvs_get_features"))) TS_ForwardTlvs_get_features(uint64_t this_ptr) {
77323         LDKForwardTlvs this_ptr_conv;
77324         this_ptr_conv.inner = untag_ptr(this_ptr);
77325         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77327         this_ptr_conv.is_owned = false;
77328         LDKBlindedHopFeatures ret_var = ForwardTlvs_get_features(&this_ptr_conv);
77329         uint64_t ret_ref = 0;
77330         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77331         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77332         return ret_ref;
77333 }
77334
77335 void  __attribute__((export_name("TS_ForwardTlvs_set_features"))) TS_ForwardTlvs_set_features(uint64_t this_ptr, uint64_t val) {
77336         LDKForwardTlvs this_ptr_conv;
77337         this_ptr_conv.inner = untag_ptr(this_ptr);
77338         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77340         this_ptr_conv.is_owned = false;
77341         LDKBlindedHopFeatures val_conv;
77342         val_conv.inner = untag_ptr(val);
77343         val_conv.is_owned = ptr_is_owned(val);
77344         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
77345         val_conv = BlindedHopFeatures_clone(&val_conv);
77346         ForwardTlvs_set_features(&this_ptr_conv, val_conv);
77347 }
77348
77349 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) {
77350         LDKPaymentRelay payment_relay_arg_conv;
77351         payment_relay_arg_conv.inner = untag_ptr(payment_relay_arg);
77352         payment_relay_arg_conv.is_owned = ptr_is_owned(payment_relay_arg);
77353         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_relay_arg_conv);
77354         payment_relay_arg_conv = PaymentRelay_clone(&payment_relay_arg_conv);
77355         LDKPaymentConstraints payment_constraints_arg_conv;
77356         payment_constraints_arg_conv.inner = untag_ptr(payment_constraints_arg);
77357         payment_constraints_arg_conv.is_owned = ptr_is_owned(payment_constraints_arg);
77358         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_constraints_arg_conv);
77359         payment_constraints_arg_conv = PaymentConstraints_clone(&payment_constraints_arg_conv);
77360         LDKBlindedHopFeatures features_arg_conv;
77361         features_arg_conv.inner = untag_ptr(features_arg);
77362         features_arg_conv.is_owned = ptr_is_owned(features_arg);
77363         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
77364         features_arg_conv = BlindedHopFeatures_clone(&features_arg_conv);
77365         LDKForwardTlvs ret_var = ForwardTlvs_new(short_channel_id_arg, payment_relay_arg_conv, payment_constraints_arg_conv, features_arg_conv);
77366         uint64_t ret_ref = 0;
77367         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77368         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77369         return ret_ref;
77370 }
77371
77372 static inline uint64_t ForwardTlvs_clone_ptr(LDKForwardTlvs *NONNULL_PTR arg) {
77373         LDKForwardTlvs ret_var = ForwardTlvs_clone(arg);
77374         uint64_t ret_ref = 0;
77375         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77376         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77377         return ret_ref;
77378 }
77379 int64_t  __attribute__((export_name("TS_ForwardTlvs_clone_ptr"))) TS_ForwardTlvs_clone_ptr(uint64_t arg) {
77380         LDKForwardTlvs arg_conv;
77381         arg_conv.inner = untag_ptr(arg);
77382         arg_conv.is_owned = ptr_is_owned(arg);
77383         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
77384         arg_conv.is_owned = false;
77385         int64_t ret_conv = ForwardTlvs_clone_ptr(&arg_conv);
77386         return ret_conv;
77387 }
77388
77389 uint64_t  __attribute__((export_name("TS_ForwardTlvs_clone"))) TS_ForwardTlvs_clone(uint64_t orig) {
77390         LDKForwardTlvs orig_conv;
77391         orig_conv.inner = untag_ptr(orig);
77392         orig_conv.is_owned = ptr_is_owned(orig);
77393         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
77394         orig_conv.is_owned = false;
77395         LDKForwardTlvs ret_var = ForwardTlvs_clone(&orig_conv);
77396         uint64_t ret_ref = 0;
77397         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77398         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77399         return ret_ref;
77400 }
77401
77402 void  __attribute__((export_name("TS_ReceiveTlvs_free"))) TS_ReceiveTlvs_free(uint64_t this_obj) {
77403         LDKReceiveTlvs this_obj_conv;
77404         this_obj_conv.inner = untag_ptr(this_obj);
77405         this_obj_conv.is_owned = ptr_is_owned(this_obj);
77406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
77407         ReceiveTlvs_free(this_obj_conv);
77408 }
77409
77410 int8_tArray  __attribute__((export_name("TS_ReceiveTlvs_get_payment_secret"))) TS_ReceiveTlvs_get_payment_secret(uint64_t this_ptr) {
77411         LDKReceiveTlvs this_ptr_conv;
77412         this_ptr_conv.inner = untag_ptr(this_ptr);
77413         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77415         this_ptr_conv.is_owned = false;
77416         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
77417         memcpy(ret_arr->elems, *ReceiveTlvs_get_payment_secret(&this_ptr_conv), 32);
77418         return ret_arr;
77419 }
77420
77421 void  __attribute__((export_name("TS_ReceiveTlvs_set_payment_secret"))) TS_ReceiveTlvs_set_payment_secret(uint64_t this_ptr, int8_tArray val) {
77422         LDKReceiveTlvs this_ptr_conv;
77423         this_ptr_conv.inner = untag_ptr(this_ptr);
77424         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77426         this_ptr_conv.is_owned = false;
77427         LDKThirtyTwoBytes val_ref;
77428         CHECK(val->arr_len == 32);
77429         memcpy(val_ref.data, val->elems, 32); FREE(val);
77430         ReceiveTlvs_set_payment_secret(&this_ptr_conv, val_ref);
77431 }
77432
77433 uint64_t  __attribute__((export_name("TS_ReceiveTlvs_get_payment_constraints"))) TS_ReceiveTlvs_get_payment_constraints(uint64_t this_ptr) {
77434         LDKReceiveTlvs this_ptr_conv;
77435         this_ptr_conv.inner = untag_ptr(this_ptr);
77436         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77438         this_ptr_conv.is_owned = false;
77439         LDKPaymentConstraints ret_var = ReceiveTlvs_get_payment_constraints(&this_ptr_conv);
77440         uint64_t ret_ref = 0;
77441         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77442         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77443         return ret_ref;
77444 }
77445
77446 void  __attribute__((export_name("TS_ReceiveTlvs_set_payment_constraints"))) TS_ReceiveTlvs_set_payment_constraints(uint64_t this_ptr, uint64_t val) {
77447         LDKReceiveTlvs this_ptr_conv;
77448         this_ptr_conv.inner = untag_ptr(this_ptr);
77449         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77451         this_ptr_conv.is_owned = false;
77452         LDKPaymentConstraints val_conv;
77453         val_conv.inner = untag_ptr(val);
77454         val_conv.is_owned = ptr_is_owned(val);
77455         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
77456         val_conv = PaymentConstraints_clone(&val_conv);
77457         ReceiveTlvs_set_payment_constraints(&this_ptr_conv, val_conv);
77458 }
77459
77460 uint64_t  __attribute__((export_name("TS_ReceiveTlvs_get_payment_context"))) TS_ReceiveTlvs_get_payment_context(uint64_t this_ptr) {
77461         LDKReceiveTlvs this_ptr_conv;
77462         this_ptr_conv.inner = untag_ptr(this_ptr);
77463         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77465         this_ptr_conv.is_owned = false;
77466         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
77467         *ret_copy = ReceiveTlvs_get_payment_context(&this_ptr_conv);
77468         uint64_t ret_ref = tag_ptr(ret_copy, true);
77469         return ret_ref;
77470 }
77471
77472 void  __attribute__((export_name("TS_ReceiveTlvs_set_payment_context"))) TS_ReceiveTlvs_set_payment_context(uint64_t this_ptr, uint64_t val) {
77473         LDKReceiveTlvs this_ptr_conv;
77474         this_ptr_conv.inner = untag_ptr(this_ptr);
77475         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77477         this_ptr_conv.is_owned = false;
77478         void* val_ptr = untag_ptr(val);
77479         CHECK_ACCESS(val_ptr);
77480         LDKPaymentContext val_conv = *(LDKPaymentContext*)(val_ptr);
77481         val_conv = PaymentContext_clone((LDKPaymentContext*)untag_ptr(val));
77482         ReceiveTlvs_set_payment_context(&this_ptr_conv, val_conv);
77483 }
77484
77485 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) {
77486         LDKThirtyTwoBytes payment_secret_arg_ref;
77487         CHECK(payment_secret_arg->arr_len == 32);
77488         memcpy(payment_secret_arg_ref.data, payment_secret_arg->elems, 32); FREE(payment_secret_arg);
77489         LDKPaymentConstraints payment_constraints_arg_conv;
77490         payment_constraints_arg_conv.inner = untag_ptr(payment_constraints_arg);
77491         payment_constraints_arg_conv.is_owned = ptr_is_owned(payment_constraints_arg);
77492         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_constraints_arg_conv);
77493         payment_constraints_arg_conv = PaymentConstraints_clone(&payment_constraints_arg_conv);
77494         void* payment_context_arg_ptr = untag_ptr(payment_context_arg);
77495         CHECK_ACCESS(payment_context_arg_ptr);
77496         LDKPaymentContext payment_context_arg_conv = *(LDKPaymentContext*)(payment_context_arg_ptr);
77497         payment_context_arg_conv = PaymentContext_clone((LDKPaymentContext*)untag_ptr(payment_context_arg));
77498         LDKReceiveTlvs ret_var = ReceiveTlvs_new(payment_secret_arg_ref, payment_constraints_arg_conv, payment_context_arg_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 static inline uint64_t ReceiveTlvs_clone_ptr(LDKReceiveTlvs *NONNULL_PTR arg) {
77506         LDKReceiveTlvs ret_var = ReceiveTlvs_clone(arg);
77507         uint64_t ret_ref = 0;
77508         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77509         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77510         return ret_ref;
77511 }
77512 int64_t  __attribute__((export_name("TS_ReceiveTlvs_clone_ptr"))) TS_ReceiveTlvs_clone_ptr(uint64_t arg) {
77513         LDKReceiveTlvs arg_conv;
77514         arg_conv.inner = untag_ptr(arg);
77515         arg_conv.is_owned = ptr_is_owned(arg);
77516         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
77517         arg_conv.is_owned = false;
77518         int64_t ret_conv = ReceiveTlvs_clone_ptr(&arg_conv);
77519         return ret_conv;
77520 }
77521
77522 uint64_t  __attribute__((export_name("TS_ReceiveTlvs_clone"))) TS_ReceiveTlvs_clone(uint64_t orig) {
77523         LDKReceiveTlvs orig_conv;
77524         orig_conv.inner = untag_ptr(orig);
77525         orig_conv.is_owned = ptr_is_owned(orig);
77526         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
77527         orig_conv.is_owned = false;
77528         LDKReceiveTlvs ret_var = ReceiveTlvs_clone(&orig_conv);
77529         uint64_t ret_ref = 0;
77530         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77531         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77532         return ret_ref;
77533 }
77534
77535 void  __attribute__((export_name("TS_PaymentRelay_free"))) TS_PaymentRelay_free(uint64_t this_obj) {
77536         LDKPaymentRelay this_obj_conv;
77537         this_obj_conv.inner = untag_ptr(this_obj);
77538         this_obj_conv.is_owned = ptr_is_owned(this_obj);
77539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
77540         PaymentRelay_free(this_obj_conv);
77541 }
77542
77543 int16_t  __attribute__((export_name("TS_PaymentRelay_get_cltv_expiry_delta"))) TS_PaymentRelay_get_cltv_expiry_delta(uint64_t this_ptr) {
77544         LDKPaymentRelay this_ptr_conv;
77545         this_ptr_conv.inner = untag_ptr(this_ptr);
77546         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77548         this_ptr_conv.is_owned = false;
77549         int16_t ret_conv = PaymentRelay_get_cltv_expiry_delta(&this_ptr_conv);
77550         return ret_conv;
77551 }
77552
77553 void  __attribute__((export_name("TS_PaymentRelay_set_cltv_expiry_delta"))) TS_PaymentRelay_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
77554         LDKPaymentRelay this_ptr_conv;
77555         this_ptr_conv.inner = untag_ptr(this_ptr);
77556         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77558         this_ptr_conv.is_owned = false;
77559         PaymentRelay_set_cltv_expiry_delta(&this_ptr_conv, val);
77560 }
77561
77562 int32_t  __attribute__((export_name("TS_PaymentRelay_get_fee_proportional_millionths"))) TS_PaymentRelay_get_fee_proportional_millionths(uint64_t this_ptr) {
77563         LDKPaymentRelay this_ptr_conv;
77564         this_ptr_conv.inner = untag_ptr(this_ptr);
77565         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77567         this_ptr_conv.is_owned = false;
77568         int32_t ret_conv = PaymentRelay_get_fee_proportional_millionths(&this_ptr_conv);
77569         return ret_conv;
77570 }
77571
77572 void  __attribute__((export_name("TS_PaymentRelay_set_fee_proportional_millionths"))) TS_PaymentRelay_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
77573         LDKPaymentRelay this_ptr_conv;
77574         this_ptr_conv.inner = untag_ptr(this_ptr);
77575         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77577         this_ptr_conv.is_owned = false;
77578         PaymentRelay_set_fee_proportional_millionths(&this_ptr_conv, val);
77579 }
77580
77581 int32_t  __attribute__((export_name("TS_PaymentRelay_get_fee_base_msat"))) TS_PaymentRelay_get_fee_base_msat(uint64_t this_ptr) {
77582         LDKPaymentRelay this_ptr_conv;
77583         this_ptr_conv.inner = untag_ptr(this_ptr);
77584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77586         this_ptr_conv.is_owned = false;
77587         int32_t ret_conv = PaymentRelay_get_fee_base_msat(&this_ptr_conv);
77588         return ret_conv;
77589 }
77590
77591 void  __attribute__((export_name("TS_PaymentRelay_set_fee_base_msat"))) TS_PaymentRelay_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
77592         LDKPaymentRelay this_ptr_conv;
77593         this_ptr_conv.inner = untag_ptr(this_ptr);
77594         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77596         this_ptr_conv.is_owned = false;
77597         PaymentRelay_set_fee_base_msat(&this_ptr_conv, val);
77598 }
77599
77600 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) {
77601         LDKPaymentRelay ret_var = PaymentRelay_new(cltv_expiry_delta_arg, fee_proportional_millionths_arg, fee_base_msat_arg);
77602         uint64_t ret_ref = 0;
77603         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77604         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77605         return ret_ref;
77606 }
77607
77608 static inline uint64_t PaymentRelay_clone_ptr(LDKPaymentRelay *NONNULL_PTR arg) {
77609         LDKPaymentRelay ret_var = PaymentRelay_clone(arg);
77610         uint64_t ret_ref = 0;
77611         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77612         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77613         return ret_ref;
77614 }
77615 int64_t  __attribute__((export_name("TS_PaymentRelay_clone_ptr"))) TS_PaymentRelay_clone_ptr(uint64_t arg) {
77616         LDKPaymentRelay arg_conv;
77617         arg_conv.inner = untag_ptr(arg);
77618         arg_conv.is_owned = ptr_is_owned(arg);
77619         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
77620         arg_conv.is_owned = false;
77621         int64_t ret_conv = PaymentRelay_clone_ptr(&arg_conv);
77622         return ret_conv;
77623 }
77624
77625 uint64_t  __attribute__((export_name("TS_PaymentRelay_clone"))) TS_PaymentRelay_clone(uint64_t orig) {
77626         LDKPaymentRelay orig_conv;
77627         orig_conv.inner = untag_ptr(orig);
77628         orig_conv.is_owned = ptr_is_owned(orig);
77629         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
77630         orig_conv.is_owned = false;
77631         LDKPaymentRelay ret_var = PaymentRelay_clone(&orig_conv);
77632         uint64_t ret_ref = 0;
77633         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77634         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77635         return ret_ref;
77636 }
77637
77638 void  __attribute__((export_name("TS_PaymentConstraints_free"))) TS_PaymentConstraints_free(uint64_t this_obj) {
77639         LDKPaymentConstraints this_obj_conv;
77640         this_obj_conv.inner = untag_ptr(this_obj);
77641         this_obj_conv.is_owned = ptr_is_owned(this_obj);
77642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
77643         PaymentConstraints_free(this_obj_conv);
77644 }
77645
77646 int32_t  __attribute__((export_name("TS_PaymentConstraints_get_max_cltv_expiry"))) TS_PaymentConstraints_get_max_cltv_expiry(uint64_t this_ptr) {
77647         LDKPaymentConstraints this_ptr_conv;
77648         this_ptr_conv.inner = untag_ptr(this_ptr);
77649         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77651         this_ptr_conv.is_owned = false;
77652         int32_t ret_conv = PaymentConstraints_get_max_cltv_expiry(&this_ptr_conv);
77653         return ret_conv;
77654 }
77655
77656 void  __attribute__((export_name("TS_PaymentConstraints_set_max_cltv_expiry"))) TS_PaymentConstraints_set_max_cltv_expiry(uint64_t this_ptr, int32_t val) {
77657         LDKPaymentConstraints this_ptr_conv;
77658         this_ptr_conv.inner = untag_ptr(this_ptr);
77659         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77661         this_ptr_conv.is_owned = false;
77662         PaymentConstraints_set_max_cltv_expiry(&this_ptr_conv, val);
77663 }
77664
77665 int64_t  __attribute__((export_name("TS_PaymentConstraints_get_htlc_minimum_msat"))) TS_PaymentConstraints_get_htlc_minimum_msat(uint64_t this_ptr) {
77666         LDKPaymentConstraints this_ptr_conv;
77667         this_ptr_conv.inner = untag_ptr(this_ptr);
77668         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77670         this_ptr_conv.is_owned = false;
77671         int64_t ret_conv = PaymentConstraints_get_htlc_minimum_msat(&this_ptr_conv);
77672         return ret_conv;
77673 }
77674
77675 void  __attribute__((export_name("TS_PaymentConstraints_set_htlc_minimum_msat"))) TS_PaymentConstraints_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
77676         LDKPaymentConstraints this_ptr_conv;
77677         this_ptr_conv.inner = untag_ptr(this_ptr);
77678         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77680         this_ptr_conv.is_owned = false;
77681         PaymentConstraints_set_htlc_minimum_msat(&this_ptr_conv, val);
77682 }
77683
77684 uint64_t  __attribute__((export_name("TS_PaymentConstraints_new"))) TS_PaymentConstraints_new(int32_t max_cltv_expiry_arg, int64_t htlc_minimum_msat_arg) {
77685         LDKPaymentConstraints ret_var = PaymentConstraints_new(max_cltv_expiry_arg, htlc_minimum_msat_arg);
77686         uint64_t ret_ref = 0;
77687         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77688         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77689         return ret_ref;
77690 }
77691
77692 static inline uint64_t PaymentConstraints_clone_ptr(LDKPaymentConstraints *NONNULL_PTR arg) {
77693         LDKPaymentConstraints ret_var = PaymentConstraints_clone(arg);
77694         uint64_t ret_ref = 0;
77695         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77696         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77697         return ret_ref;
77698 }
77699 int64_t  __attribute__((export_name("TS_PaymentConstraints_clone_ptr"))) TS_PaymentConstraints_clone_ptr(uint64_t arg) {
77700         LDKPaymentConstraints arg_conv;
77701         arg_conv.inner = untag_ptr(arg);
77702         arg_conv.is_owned = ptr_is_owned(arg);
77703         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
77704         arg_conv.is_owned = false;
77705         int64_t ret_conv = PaymentConstraints_clone_ptr(&arg_conv);
77706         return ret_conv;
77707 }
77708
77709 uint64_t  __attribute__((export_name("TS_PaymentConstraints_clone"))) TS_PaymentConstraints_clone(uint64_t orig) {
77710         LDKPaymentConstraints orig_conv;
77711         orig_conv.inner = untag_ptr(orig);
77712         orig_conv.is_owned = ptr_is_owned(orig);
77713         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
77714         orig_conv.is_owned = false;
77715         LDKPaymentConstraints ret_var = PaymentConstraints_clone(&orig_conv);
77716         uint64_t ret_ref = 0;
77717         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77718         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77719         return ret_ref;
77720 }
77721
77722 void  __attribute__((export_name("TS_PaymentContext_free"))) TS_PaymentContext_free(uint64_t this_ptr) {
77723         if (!ptr_is_owned(this_ptr)) return;
77724         void* this_ptr_ptr = untag_ptr(this_ptr);
77725         CHECK_ACCESS(this_ptr_ptr);
77726         LDKPaymentContext this_ptr_conv = *(LDKPaymentContext*)(this_ptr_ptr);
77727         FREE(untag_ptr(this_ptr));
77728         PaymentContext_free(this_ptr_conv);
77729 }
77730
77731 static inline uint64_t PaymentContext_clone_ptr(LDKPaymentContext *NONNULL_PTR arg) {
77732         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
77733         *ret_copy = PaymentContext_clone(arg);
77734         uint64_t ret_ref = tag_ptr(ret_copy, true);
77735         return ret_ref;
77736 }
77737 int64_t  __attribute__((export_name("TS_PaymentContext_clone_ptr"))) TS_PaymentContext_clone_ptr(uint64_t arg) {
77738         LDKPaymentContext* arg_conv = (LDKPaymentContext*)untag_ptr(arg);
77739         int64_t ret_conv = PaymentContext_clone_ptr(arg_conv);
77740         return ret_conv;
77741 }
77742
77743 uint64_t  __attribute__((export_name("TS_PaymentContext_clone"))) TS_PaymentContext_clone(uint64_t orig) {
77744         LDKPaymentContext* orig_conv = (LDKPaymentContext*)untag_ptr(orig);
77745         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
77746         *ret_copy = PaymentContext_clone(orig_conv);
77747         uint64_t ret_ref = tag_ptr(ret_copy, true);
77748         return ret_ref;
77749 }
77750
77751 uint64_t  __attribute__((export_name("TS_PaymentContext_unknown"))) TS_PaymentContext_unknown(uint64_t a) {
77752         LDKUnknownPaymentContext a_conv;
77753         a_conv.inner = untag_ptr(a);
77754         a_conv.is_owned = ptr_is_owned(a);
77755         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
77756         a_conv = UnknownPaymentContext_clone(&a_conv);
77757         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
77758         *ret_copy = PaymentContext_unknown(a_conv);
77759         uint64_t ret_ref = tag_ptr(ret_copy, true);
77760         return ret_ref;
77761 }
77762
77763 uint64_t  __attribute__((export_name("TS_PaymentContext_bolt12_offer"))) TS_PaymentContext_bolt12_offer(uint64_t a) {
77764         LDKBolt12OfferContext a_conv;
77765         a_conv.inner = untag_ptr(a);
77766         a_conv.is_owned = ptr_is_owned(a);
77767         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
77768         a_conv = Bolt12OfferContext_clone(&a_conv);
77769         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
77770         *ret_copy = PaymentContext_bolt12_offer(a_conv);
77771         uint64_t ret_ref = tag_ptr(ret_copy, true);
77772         return ret_ref;
77773 }
77774
77775 uint64_t  __attribute__((export_name("TS_PaymentContext_bolt12_refund"))) TS_PaymentContext_bolt12_refund(uint64_t a) {
77776         LDKBolt12RefundContext a_conv;
77777         a_conv.inner = untag_ptr(a);
77778         a_conv.is_owned = ptr_is_owned(a);
77779         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
77780         a_conv = Bolt12RefundContext_clone(&a_conv);
77781         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
77782         *ret_copy = PaymentContext_bolt12_refund(a_conv);
77783         uint64_t ret_ref = tag_ptr(ret_copy, true);
77784         return ret_ref;
77785 }
77786
77787 jboolean  __attribute__((export_name("TS_PaymentContext_eq"))) TS_PaymentContext_eq(uint64_t a, uint64_t b) {
77788         LDKPaymentContext* a_conv = (LDKPaymentContext*)untag_ptr(a);
77789         LDKPaymentContext* b_conv = (LDKPaymentContext*)untag_ptr(b);
77790         jboolean ret_conv = PaymentContext_eq(a_conv, b_conv);
77791         return ret_conv;
77792 }
77793
77794 void  __attribute__((export_name("TS_UnknownPaymentContext_free"))) TS_UnknownPaymentContext_free(uint64_t this_obj) {
77795         LDKUnknownPaymentContext this_obj_conv;
77796         this_obj_conv.inner = untag_ptr(this_obj);
77797         this_obj_conv.is_owned = ptr_is_owned(this_obj);
77798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
77799         UnknownPaymentContext_free(this_obj_conv);
77800 }
77801
77802 static inline uint64_t UnknownPaymentContext_clone_ptr(LDKUnknownPaymentContext *NONNULL_PTR arg) {
77803         LDKUnknownPaymentContext ret_var = UnknownPaymentContext_clone(arg);
77804         uint64_t ret_ref = 0;
77805         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77806         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77807         return ret_ref;
77808 }
77809 int64_t  __attribute__((export_name("TS_UnknownPaymentContext_clone_ptr"))) TS_UnknownPaymentContext_clone_ptr(uint64_t arg) {
77810         LDKUnknownPaymentContext arg_conv;
77811         arg_conv.inner = untag_ptr(arg);
77812         arg_conv.is_owned = ptr_is_owned(arg);
77813         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
77814         arg_conv.is_owned = false;
77815         int64_t ret_conv = UnknownPaymentContext_clone_ptr(&arg_conv);
77816         return ret_conv;
77817 }
77818
77819 uint64_t  __attribute__((export_name("TS_UnknownPaymentContext_clone"))) TS_UnknownPaymentContext_clone(uint64_t orig) {
77820         LDKUnknownPaymentContext orig_conv;
77821         orig_conv.inner = untag_ptr(orig);
77822         orig_conv.is_owned = ptr_is_owned(orig);
77823         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
77824         orig_conv.is_owned = false;
77825         LDKUnknownPaymentContext ret_var = UnknownPaymentContext_clone(&orig_conv);
77826         uint64_t ret_ref = 0;
77827         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77828         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77829         return ret_ref;
77830 }
77831
77832 jboolean  __attribute__((export_name("TS_UnknownPaymentContext_eq"))) TS_UnknownPaymentContext_eq(uint64_t a, uint64_t b) {
77833         LDKUnknownPaymentContext a_conv;
77834         a_conv.inner = untag_ptr(a);
77835         a_conv.is_owned = ptr_is_owned(a);
77836         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
77837         a_conv.is_owned = false;
77838         LDKUnknownPaymentContext b_conv;
77839         b_conv.inner = untag_ptr(b);
77840         b_conv.is_owned = ptr_is_owned(b);
77841         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
77842         b_conv.is_owned = false;
77843         jboolean ret_conv = UnknownPaymentContext_eq(&a_conv, &b_conv);
77844         return ret_conv;
77845 }
77846
77847 void  __attribute__((export_name("TS_Bolt12OfferContext_free"))) TS_Bolt12OfferContext_free(uint64_t this_obj) {
77848         LDKBolt12OfferContext this_obj_conv;
77849         this_obj_conv.inner = untag_ptr(this_obj);
77850         this_obj_conv.is_owned = ptr_is_owned(this_obj);
77851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
77852         Bolt12OfferContext_free(this_obj_conv);
77853 }
77854
77855 uint64_t  __attribute__((export_name("TS_Bolt12OfferContext_get_offer_id"))) TS_Bolt12OfferContext_get_offer_id(uint64_t this_ptr) {
77856         LDKBolt12OfferContext this_ptr_conv;
77857         this_ptr_conv.inner = untag_ptr(this_ptr);
77858         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77860         this_ptr_conv.is_owned = false;
77861         LDKOfferId ret_var = Bolt12OfferContext_get_offer_id(&this_ptr_conv);
77862         uint64_t ret_ref = 0;
77863         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77864         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77865         return ret_ref;
77866 }
77867
77868 void  __attribute__((export_name("TS_Bolt12OfferContext_set_offer_id"))) TS_Bolt12OfferContext_set_offer_id(uint64_t this_ptr, uint64_t val) {
77869         LDKBolt12OfferContext this_ptr_conv;
77870         this_ptr_conv.inner = untag_ptr(this_ptr);
77871         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77873         this_ptr_conv.is_owned = false;
77874         LDKOfferId val_conv;
77875         val_conv.inner = untag_ptr(val);
77876         val_conv.is_owned = ptr_is_owned(val);
77877         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
77878         val_conv = OfferId_clone(&val_conv);
77879         Bolt12OfferContext_set_offer_id(&this_ptr_conv, val_conv);
77880 }
77881
77882 uint64_t  __attribute__((export_name("TS_Bolt12OfferContext_get_invoice_request"))) TS_Bolt12OfferContext_get_invoice_request(uint64_t this_ptr) {
77883         LDKBolt12OfferContext this_ptr_conv;
77884         this_ptr_conv.inner = untag_ptr(this_ptr);
77885         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77887         this_ptr_conv.is_owned = false;
77888         LDKInvoiceRequestFields ret_var = Bolt12OfferContext_get_invoice_request(&this_ptr_conv);
77889         uint64_t ret_ref = 0;
77890         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77891         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77892         return ret_ref;
77893 }
77894
77895 void  __attribute__((export_name("TS_Bolt12OfferContext_set_invoice_request"))) TS_Bolt12OfferContext_set_invoice_request(uint64_t this_ptr, uint64_t val) {
77896         LDKBolt12OfferContext this_ptr_conv;
77897         this_ptr_conv.inner = untag_ptr(this_ptr);
77898         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77900         this_ptr_conv.is_owned = false;
77901         LDKInvoiceRequestFields val_conv;
77902         val_conv.inner = untag_ptr(val);
77903         val_conv.is_owned = ptr_is_owned(val);
77904         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
77905         val_conv = InvoiceRequestFields_clone(&val_conv);
77906         Bolt12OfferContext_set_invoice_request(&this_ptr_conv, val_conv);
77907 }
77908
77909 uint64_t  __attribute__((export_name("TS_Bolt12OfferContext_new"))) TS_Bolt12OfferContext_new(uint64_t offer_id_arg, uint64_t invoice_request_arg) {
77910         LDKOfferId offer_id_arg_conv;
77911         offer_id_arg_conv.inner = untag_ptr(offer_id_arg);
77912         offer_id_arg_conv.is_owned = ptr_is_owned(offer_id_arg);
77913         CHECK_INNER_FIELD_ACCESS_OR_NULL(offer_id_arg_conv);
77914         offer_id_arg_conv = OfferId_clone(&offer_id_arg_conv);
77915         LDKInvoiceRequestFields invoice_request_arg_conv;
77916         invoice_request_arg_conv.inner = untag_ptr(invoice_request_arg);
77917         invoice_request_arg_conv.is_owned = ptr_is_owned(invoice_request_arg);
77918         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_arg_conv);
77919         invoice_request_arg_conv = InvoiceRequestFields_clone(&invoice_request_arg_conv);
77920         LDKBolt12OfferContext ret_var = Bolt12OfferContext_new(offer_id_arg_conv, invoice_request_arg_conv);
77921         uint64_t ret_ref = 0;
77922         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77923         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77924         return ret_ref;
77925 }
77926
77927 static inline uint64_t Bolt12OfferContext_clone_ptr(LDKBolt12OfferContext *NONNULL_PTR arg) {
77928         LDKBolt12OfferContext ret_var = Bolt12OfferContext_clone(arg);
77929         uint64_t ret_ref = 0;
77930         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77931         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77932         return ret_ref;
77933 }
77934 int64_t  __attribute__((export_name("TS_Bolt12OfferContext_clone_ptr"))) TS_Bolt12OfferContext_clone_ptr(uint64_t arg) {
77935         LDKBolt12OfferContext arg_conv;
77936         arg_conv.inner = untag_ptr(arg);
77937         arg_conv.is_owned = ptr_is_owned(arg);
77938         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
77939         arg_conv.is_owned = false;
77940         int64_t ret_conv = Bolt12OfferContext_clone_ptr(&arg_conv);
77941         return ret_conv;
77942 }
77943
77944 uint64_t  __attribute__((export_name("TS_Bolt12OfferContext_clone"))) TS_Bolt12OfferContext_clone(uint64_t orig) {
77945         LDKBolt12OfferContext orig_conv;
77946         orig_conv.inner = untag_ptr(orig);
77947         orig_conv.is_owned = ptr_is_owned(orig);
77948         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
77949         orig_conv.is_owned = false;
77950         LDKBolt12OfferContext ret_var = Bolt12OfferContext_clone(&orig_conv);
77951         uint64_t ret_ref = 0;
77952         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77953         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77954         return ret_ref;
77955 }
77956
77957 jboolean  __attribute__((export_name("TS_Bolt12OfferContext_eq"))) TS_Bolt12OfferContext_eq(uint64_t a, uint64_t b) {
77958         LDKBolt12OfferContext a_conv;
77959         a_conv.inner = untag_ptr(a);
77960         a_conv.is_owned = ptr_is_owned(a);
77961         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
77962         a_conv.is_owned = false;
77963         LDKBolt12OfferContext b_conv;
77964         b_conv.inner = untag_ptr(b);
77965         b_conv.is_owned = ptr_is_owned(b);
77966         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
77967         b_conv.is_owned = false;
77968         jboolean ret_conv = Bolt12OfferContext_eq(&a_conv, &b_conv);
77969         return ret_conv;
77970 }
77971
77972 void  __attribute__((export_name("TS_Bolt12RefundContext_free"))) TS_Bolt12RefundContext_free(uint64_t this_obj) {
77973         LDKBolt12RefundContext this_obj_conv;
77974         this_obj_conv.inner = untag_ptr(this_obj);
77975         this_obj_conv.is_owned = ptr_is_owned(this_obj);
77976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
77977         Bolt12RefundContext_free(this_obj_conv);
77978 }
77979
77980 uint64_t  __attribute__((export_name("TS_Bolt12RefundContext_new"))) TS_Bolt12RefundContext_new() {
77981         LDKBolt12RefundContext ret_var = Bolt12RefundContext_new();
77982         uint64_t ret_ref = 0;
77983         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77984         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77985         return ret_ref;
77986 }
77987
77988 static inline uint64_t Bolt12RefundContext_clone_ptr(LDKBolt12RefundContext *NONNULL_PTR arg) {
77989         LDKBolt12RefundContext ret_var = Bolt12RefundContext_clone(arg);
77990         uint64_t ret_ref = 0;
77991         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77992         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77993         return ret_ref;
77994 }
77995 int64_t  __attribute__((export_name("TS_Bolt12RefundContext_clone_ptr"))) TS_Bolt12RefundContext_clone_ptr(uint64_t arg) {
77996         LDKBolt12RefundContext arg_conv;
77997         arg_conv.inner = untag_ptr(arg);
77998         arg_conv.is_owned = ptr_is_owned(arg);
77999         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
78000         arg_conv.is_owned = false;
78001         int64_t ret_conv = Bolt12RefundContext_clone_ptr(&arg_conv);
78002         return ret_conv;
78003 }
78004
78005 uint64_t  __attribute__((export_name("TS_Bolt12RefundContext_clone"))) TS_Bolt12RefundContext_clone(uint64_t orig) {
78006         LDKBolt12RefundContext orig_conv;
78007         orig_conv.inner = untag_ptr(orig);
78008         orig_conv.is_owned = ptr_is_owned(orig);
78009         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
78010         orig_conv.is_owned = false;
78011         LDKBolt12RefundContext ret_var = Bolt12RefundContext_clone(&orig_conv);
78012         uint64_t ret_ref = 0;
78013         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78014         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78015         return ret_ref;
78016 }
78017
78018 jboolean  __attribute__((export_name("TS_Bolt12RefundContext_eq"))) TS_Bolt12RefundContext_eq(uint64_t a, uint64_t b) {
78019         LDKBolt12RefundContext a_conv;
78020         a_conv.inner = untag_ptr(a);
78021         a_conv.is_owned = ptr_is_owned(a);
78022         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
78023         a_conv.is_owned = false;
78024         LDKBolt12RefundContext b_conv;
78025         b_conv.inner = untag_ptr(b);
78026         b_conv.is_owned = ptr_is_owned(b);
78027         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
78028         b_conv.is_owned = false;
78029         jboolean ret_conv = Bolt12RefundContext_eq(&a_conv, &b_conv);
78030         return ret_conv;
78031 }
78032
78033 int8_tArray  __attribute__((export_name("TS_ForwardTlvs_write"))) TS_ForwardTlvs_write(uint64_t obj) {
78034         LDKForwardTlvs obj_conv;
78035         obj_conv.inner = untag_ptr(obj);
78036         obj_conv.is_owned = ptr_is_owned(obj);
78037         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
78038         obj_conv.is_owned = false;
78039         LDKCVec_u8Z ret_var = ForwardTlvs_write(&obj_conv);
78040         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
78041         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
78042         CVec_u8Z_free(ret_var);
78043         return ret_arr;
78044 }
78045
78046 int8_tArray  __attribute__((export_name("TS_ReceiveTlvs_write"))) TS_ReceiveTlvs_write(uint64_t obj) {
78047         LDKReceiveTlvs obj_conv;
78048         obj_conv.inner = untag_ptr(obj);
78049         obj_conv.is_owned = ptr_is_owned(obj);
78050         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
78051         obj_conv.is_owned = false;
78052         LDKCVec_u8Z ret_var = ReceiveTlvs_write(&obj_conv);
78053         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
78054         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
78055         CVec_u8Z_free(ret_var);
78056         return ret_arr;
78057 }
78058
78059 int8_tArray  __attribute__((export_name("TS_PaymentRelay_write"))) TS_PaymentRelay_write(uint64_t obj) {
78060         LDKPaymentRelay obj_conv;
78061         obj_conv.inner = untag_ptr(obj);
78062         obj_conv.is_owned = ptr_is_owned(obj);
78063         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
78064         obj_conv.is_owned = false;
78065         LDKCVec_u8Z ret_var = PaymentRelay_write(&obj_conv);
78066         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
78067         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
78068         CVec_u8Z_free(ret_var);
78069         return ret_arr;
78070 }
78071
78072 uint64_t  __attribute__((export_name("TS_PaymentRelay_read"))) TS_PaymentRelay_read(int8_tArray ser) {
78073         LDKu8slice ser_ref;
78074         ser_ref.datalen = ser->arr_len;
78075         ser_ref.data = ser->elems;
78076         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
78077         *ret_conv = PaymentRelay_read(ser_ref);
78078         FREE(ser);
78079         return tag_ptr(ret_conv, true);
78080 }
78081
78082 int8_tArray  __attribute__((export_name("TS_PaymentConstraints_write"))) TS_PaymentConstraints_write(uint64_t obj) {
78083         LDKPaymentConstraints obj_conv;
78084         obj_conv.inner = untag_ptr(obj);
78085         obj_conv.is_owned = ptr_is_owned(obj);
78086         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
78087         obj_conv.is_owned = false;
78088         LDKCVec_u8Z ret_var = PaymentConstraints_write(&obj_conv);
78089         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
78090         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
78091         CVec_u8Z_free(ret_var);
78092         return ret_arr;
78093 }
78094
78095 uint64_t  __attribute__((export_name("TS_PaymentConstraints_read"))) TS_PaymentConstraints_read(int8_tArray ser) {
78096         LDKu8slice ser_ref;
78097         ser_ref.datalen = ser->arr_len;
78098         ser_ref.data = ser->elems;
78099         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
78100         *ret_conv = PaymentConstraints_read(ser_ref);
78101         FREE(ser);
78102         return tag_ptr(ret_conv, true);
78103 }
78104
78105 int8_tArray  __attribute__((export_name("TS_PaymentContext_write"))) TS_PaymentContext_write(uint64_t obj) {
78106         LDKPaymentContext* obj_conv = (LDKPaymentContext*)untag_ptr(obj);
78107         LDKCVec_u8Z ret_var = PaymentContext_write(obj_conv);
78108         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
78109         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
78110         CVec_u8Z_free(ret_var);
78111         return ret_arr;
78112 }
78113
78114 uint64_t  __attribute__((export_name("TS_PaymentContext_read"))) TS_PaymentContext_read(int8_tArray ser) {
78115         LDKu8slice ser_ref;
78116         ser_ref.datalen = ser->arr_len;
78117         ser_ref.data = ser->elems;
78118         LDKCResult_PaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentContextDecodeErrorZ), "LDKCResult_PaymentContextDecodeErrorZ");
78119         *ret_conv = PaymentContext_read(ser_ref);
78120         FREE(ser);
78121         return tag_ptr(ret_conv, true);
78122 }
78123
78124 int8_tArray  __attribute__((export_name("TS_UnknownPaymentContext_write"))) TS_UnknownPaymentContext_write(uint64_t obj) {
78125         LDKUnknownPaymentContext obj_conv;
78126         obj_conv.inner = untag_ptr(obj);
78127         obj_conv.is_owned = ptr_is_owned(obj);
78128         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
78129         obj_conv.is_owned = false;
78130         LDKCVec_u8Z ret_var = UnknownPaymentContext_write(&obj_conv);
78131         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
78132         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
78133         CVec_u8Z_free(ret_var);
78134         return ret_arr;
78135 }
78136
78137 uint64_t  __attribute__((export_name("TS_UnknownPaymentContext_read"))) TS_UnknownPaymentContext_read(int8_tArray ser) {
78138         LDKu8slice ser_ref;
78139         ser_ref.datalen = ser->arr_len;
78140         ser_ref.data = ser->elems;
78141         LDKCResult_UnknownPaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnknownPaymentContextDecodeErrorZ), "LDKCResult_UnknownPaymentContextDecodeErrorZ");
78142         *ret_conv = UnknownPaymentContext_read(ser_ref);
78143         FREE(ser);
78144         return tag_ptr(ret_conv, true);
78145 }
78146
78147 int8_tArray  __attribute__((export_name("TS_Bolt12OfferContext_write"))) TS_Bolt12OfferContext_write(uint64_t obj) {
78148         LDKBolt12OfferContext obj_conv;
78149         obj_conv.inner = untag_ptr(obj);
78150         obj_conv.is_owned = ptr_is_owned(obj);
78151         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
78152         obj_conv.is_owned = false;
78153         LDKCVec_u8Z ret_var = Bolt12OfferContext_write(&obj_conv);
78154         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
78155         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
78156         CVec_u8Z_free(ret_var);
78157         return ret_arr;
78158 }
78159
78160 uint64_t  __attribute__((export_name("TS_Bolt12OfferContext_read"))) TS_Bolt12OfferContext_read(int8_tArray ser) {
78161         LDKu8slice ser_ref;
78162         ser_ref.datalen = ser->arr_len;
78163         ser_ref.data = ser->elems;
78164         LDKCResult_Bolt12OfferContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12OfferContextDecodeErrorZ), "LDKCResult_Bolt12OfferContextDecodeErrorZ");
78165         *ret_conv = Bolt12OfferContext_read(ser_ref);
78166         FREE(ser);
78167         return tag_ptr(ret_conv, true);
78168 }
78169
78170 int8_tArray  __attribute__((export_name("TS_Bolt12RefundContext_write"))) TS_Bolt12RefundContext_write(uint64_t obj) {
78171         LDKBolt12RefundContext obj_conv;
78172         obj_conv.inner = untag_ptr(obj);
78173         obj_conv.is_owned = ptr_is_owned(obj);
78174         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
78175         obj_conv.is_owned = false;
78176         LDKCVec_u8Z ret_var = Bolt12RefundContext_write(&obj_conv);
78177         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
78178         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
78179         CVec_u8Z_free(ret_var);
78180         return ret_arr;
78181 }
78182
78183 uint64_t  __attribute__((export_name("TS_Bolt12RefundContext_read"))) TS_Bolt12RefundContext_read(int8_tArray ser) {
78184         LDKu8slice ser_ref;
78185         ser_ref.datalen = ser->arr_len;
78186         ser_ref.data = ser->elems;
78187         LDKCResult_Bolt12RefundContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12RefundContextDecodeErrorZ), "LDKCResult_Bolt12RefundContextDecodeErrorZ");
78188         *ret_conv = Bolt12RefundContext_read(ser_ref);
78189         FREE(ser);
78190         return tag_ptr(ret_conv, true);
78191 }
78192
78193 void  __attribute__((export_name("TS_PaymentPurpose_free"))) TS_PaymentPurpose_free(uint64_t this_ptr) {
78194         if (!ptr_is_owned(this_ptr)) return;
78195         void* this_ptr_ptr = untag_ptr(this_ptr);
78196         CHECK_ACCESS(this_ptr_ptr);
78197         LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
78198         FREE(untag_ptr(this_ptr));
78199         PaymentPurpose_free(this_ptr_conv);
78200 }
78201
78202 static inline uint64_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
78203         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
78204         *ret_copy = PaymentPurpose_clone(arg);
78205         uint64_t ret_ref = tag_ptr(ret_copy, true);
78206         return ret_ref;
78207 }
78208 int64_t  __attribute__((export_name("TS_PaymentPurpose_clone_ptr"))) TS_PaymentPurpose_clone_ptr(uint64_t arg) {
78209         LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)untag_ptr(arg);
78210         int64_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
78211         return ret_conv;
78212 }
78213
78214 uint64_t  __attribute__((export_name("TS_PaymentPurpose_clone"))) TS_PaymentPurpose_clone(uint64_t orig) {
78215         LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)untag_ptr(orig);
78216         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
78217         *ret_copy = PaymentPurpose_clone(orig_conv);
78218         uint64_t ret_ref = tag_ptr(ret_copy, true);
78219         return ret_ref;
78220 }
78221
78222 uint64_t  __attribute__((export_name("TS_PaymentPurpose_bolt11_invoice_payment"))) TS_PaymentPurpose_bolt11_invoice_payment(uint64_t payment_preimage, int8_tArray payment_secret) {
78223         void* payment_preimage_ptr = untag_ptr(payment_preimage);
78224         CHECK_ACCESS(payment_preimage_ptr);
78225         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
78226         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
78227         LDKThirtyTwoBytes payment_secret_ref;
78228         CHECK(payment_secret->arr_len == 32);
78229         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
78230         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
78231         *ret_copy = PaymentPurpose_bolt11_invoice_payment(payment_preimage_conv, payment_secret_ref);
78232         uint64_t ret_ref = tag_ptr(ret_copy, true);
78233         return ret_ref;
78234 }
78235
78236 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) {
78237         void* payment_preimage_ptr = untag_ptr(payment_preimage);
78238         CHECK_ACCESS(payment_preimage_ptr);
78239         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
78240         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
78241         LDKThirtyTwoBytes payment_secret_ref;
78242         CHECK(payment_secret->arr_len == 32);
78243         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
78244         LDKBolt12OfferContext payment_context_conv;
78245         payment_context_conv.inner = untag_ptr(payment_context);
78246         payment_context_conv.is_owned = ptr_is_owned(payment_context);
78247         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_context_conv);
78248         payment_context_conv = Bolt12OfferContext_clone(&payment_context_conv);
78249         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
78250         *ret_copy = PaymentPurpose_bolt12_offer_payment(payment_preimage_conv, payment_secret_ref, payment_context_conv);
78251         uint64_t ret_ref = tag_ptr(ret_copy, true);
78252         return ret_ref;
78253 }
78254
78255 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) {
78256         void* payment_preimage_ptr = untag_ptr(payment_preimage);
78257         CHECK_ACCESS(payment_preimage_ptr);
78258         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
78259         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
78260         LDKThirtyTwoBytes payment_secret_ref;
78261         CHECK(payment_secret->arr_len == 32);
78262         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
78263         LDKBolt12RefundContext payment_context_conv;
78264         payment_context_conv.inner = untag_ptr(payment_context);
78265         payment_context_conv.is_owned = ptr_is_owned(payment_context);
78266         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_context_conv);
78267         payment_context_conv = Bolt12RefundContext_clone(&payment_context_conv);
78268         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
78269         *ret_copy = PaymentPurpose_bolt12_refund_payment(payment_preimage_conv, payment_secret_ref, payment_context_conv);
78270         uint64_t ret_ref = tag_ptr(ret_copy, true);
78271         return ret_ref;
78272 }
78273
78274 uint64_t  __attribute__((export_name("TS_PaymentPurpose_spontaneous_payment"))) TS_PaymentPurpose_spontaneous_payment(int8_tArray a) {
78275         LDKThirtyTwoBytes a_ref;
78276         CHECK(a->arr_len == 32);
78277         memcpy(a_ref.data, a->elems, 32); FREE(a);
78278         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
78279         *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
78280         uint64_t ret_ref = tag_ptr(ret_copy, true);
78281         return ret_ref;
78282 }
78283
78284 jboolean  __attribute__((export_name("TS_PaymentPurpose_eq"))) TS_PaymentPurpose_eq(uint64_t a, uint64_t b) {
78285         LDKPaymentPurpose* a_conv = (LDKPaymentPurpose*)untag_ptr(a);
78286         LDKPaymentPurpose* b_conv = (LDKPaymentPurpose*)untag_ptr(b);
78287         jboolean ret_conv = PaymentPurpose_eq(a_conv, b_conv);
78288         return ret_conv;
78289 }
78290
78291 uint64_t  __attribute__((export_name("TS_PaymentPurpose_preimage"))) TS_PaymentPurpose_preimage(uint64_t this_arg) {
78292         LDKPaymentPurpose* this_arg_conv = (LDKPaymentPurpose*)untag_ptr(this_arg);
78293         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
78294         *ret_copy = PaymentPurpose_preimage(this_arg_conv);
78295         uint64_t ret_ref = tag_ptr(ret_copy, true);
78296         return ret_ref;
78297 }
78298
78299 int8_tArray  __attribute__((export_name("TS_PaymentPurpose_write"))) TS_PaymentPurpose_write(uint64_t obj) {
78300         LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)untag_ptr(obj);
78301         LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
78302         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
78303         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
78304         CVec_u8Z_free(ret_var);
78305         return ret_arr;
78306 }
78307
78308 uint64_t  __attribute__((export_name("TS_PaymentPurpose_read"))) TS_PaymentPurpose_read(int8_tArray ser) {
78309         LDKu8slice ser_ref;
78310         ser_ref.datalen = ser->arr_len;
78311         ser_ref.data = ser->elems;
78312         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
78313         *ret_conv = PaymentPurpose_read(ser_ref);
78314         FREE(ser);
78315         return tag_ptr(ret_conv, true);
78316 }
78317
78318 void  __attribute__((export_name("TS_ClaimedHTLC_free"))) TS_ClaimedHTLC_free(uint64_t this_obj) {
78319         LDKClaimedHTLC this_obj_conv;
78320         this_obj_conv.inner = untag_ptr(this_obj);
78321         this_obj_conv.is_owned = ptr_is_owned(this_obj);
78322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
78323         ClaimedHTLC_free(this_obj_conv);
78324 }
78325
78326 uint64_t  __attribute__((export_name("TS_ClaimedHTLC_get_channel_id"))) TS_ClaimedHTLC_get_channel_id(uint64_t this_ptr) {
78327         LDKClaimedHTLC this_ptr_conv;
78328         this_ptr_conv.inner = untag_ptr(this_ptr);
78329         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78331         this_ptr_conv.is_owned = false;
78332         LDKChannelId ret_var = ClaimedHTLC_get_channel_id(&this_ptr_conv);
78333         uint64_t ret_ref = 0;
78334         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78335         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78336         return ret_ref;
78337 }
78338
78339 void  __attribute__((export_name("TS_ClaimedHTLC_set_channel_id"))) TS_ClaimedHTLC_set_channel_id(uint64_t this_ptr, uint64_t val) {
78340         LDKClaimedHTLC this_ptr_conv;
78341         this_ptr_conv.inner = untag_ptr(this_ptr);
78342         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78344         this_ptr_conv.is_owned = false;
78345         LDKChannelId val_conv;
78346         val_conv.inner = untag_ptr(val);
78347         val_conv.is_owned = ptr_is_owned(val);
78348         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
78349         val_conv = ChannelId_clone(&val_conv);
78350         ClaimedHTLC_set_channel_id(&this_ptr_conv, val_conv);
78351 }
78352
78353 int8_tArray  __attribute__((export_name("TS_ClaimedHTLC_get_user_channel_id"))) TS_ClaimedHTLC_get_user_channel_id(uint64_t this_ptr) {
78354         LDKClaimedHTLC this_ptr_conv;
78355         this_ptr_conv.inner = untag_ptr(this_ptr);
78356         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78358         this_ptr_conv.is_owned = false;
78359         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
78360         memcpy(ret_arr->elems, ClaimedHTLC_get_user_channel_id(&this_ptr_conv).le_bytes, 16);
78361         return ret_arr;
78362 }
78363
78364 void  __attribute__((export_name("TS_ClaimedHTLC_set_user_channel_id"))) TS_ClaimedHTLC_set_user_channel_id(uint64_t this_ptr, int8_tArray val) {
78365         LDKClaimedHTLC this_ptr_conv;
78366         this_ptr_conv.inner = untag_ptr(this_ptr);
78367         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78369         this_ptr_conv.is_owned = false;
78370         LDKU128 val_ref;
78371         CHECK(val->arr_len == 16);
78372         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
78373         ClaimedHTLC_set_user_channel_id(&this_ptr_conv, val_ref);
78374 }
78375
78376 int32_t  __attribute__((export_name("TS_ClaimedHTLC_get_cltv_expiry"))) TS_ClaimedHTLC_get_cltv_expiry(uint64_t this_ptr) {
78377         LDKClaimedHTLC this_ptr_conv;
78378         this_ptr_conv.inner = untag_ptr(this_ptr);
78379         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78381         this_ptr_conv.is_owned = false;
78382         int32_t ret_conv = ClaimedHTLC_get_cltv_expiry(&this_ptr_conv);
78383         return ret_conv;
78384 }
78385
78386 void  __attribute__((export_name("TS_ClaimedHTLC_set_cltv_expiry"))) TS_ClaimedHTLC_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
78387         LDKClaimedHTLC this_ptr_conv;
78388         this_ptr_conv.inner = untag_ptr(this_ptr);
78389         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78391         this_ptr_conv.is_owned = false;
78392         ClaimedHTLC_set_cltv_expiry(&this_ptr_conv, val);
78393 }
78394
78395 int64_t  __attribute__((export_name("TS_ClaimedHTLC_get_value_msat"))) TS_ClaimedHTLC_get_value_msat(uint64_t this_ptr) {
78396         LDKClaimedHTLC this_ptr_conv;
78397         this_ptr_conv.inner = untag_ptr(this_ptr);
78398         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78400         this_ptr_conv.is_owned = false;
78401         int64_t ret_conv = ClaimedHTLC_get_value_msat(&this_ptr_conv);
78402         return ret_conv;
78403 }
78404
78405 void  __attribute__((export_name("TS_ClaimedHTLC_set_value_msat"))) TS_ClaimedHTLC_set_value_msat(uint64_t this_ptr, int64_t val) {
78406         LDKClaimedHTLC this_ptr_conv;
78407         this_ptr_conv.inner = untag_ptr(this_ptr);
78408         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78410         this_ptr_conv.is_owned = false;
78411         ClaimedHTLC_set_value_msat(&this_ptr_conv, val);
78412 }
78413
78414 int64_t  __attribute__((export_name("TS_ClaimedHTLC_get_counterparty_skimmed_fee_msat"))) TS_ClaimedHTLC_get_counterparty_skimmed_fee_msat(uint64_t this_ptr) {
78415         LDKClaimedHTLC this_ptr_conv;
78416         this_ptr_conv.inner = untag_ptr(this_ptr);
78417         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78419         this_ptr_conv.is_owned = false;
78420         int64_t ret_conv = ClaimedHTLC_get_counterparty_skimmed_fee_msat(&this_ptr_conv);
78421         return ret_conv;
78422 }
78423
78424 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) {
78425         LDKClaimedHTLC this_ptr_conv;
78426         this_ptr_conv.inner = untag_ptr(this_ptr);
78427         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78429         this_ptr_conv.is_owned = false;
78430         ClaimedHTLC_set_counterparty_skimmed_fee_msat(&this_ptr_conv, val);
78431 }
78432
78433 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) {
78434         LDKChannelId channel_id_arg_conv;
78435         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
78436         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
78437         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
78438         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
78439         LDKU128 user_channel_id_arg_ref;
78440         CHECK(user_channel_id_arg->arr_len == 16);
78441         memcpy(user_channel_id_arg_ref.le_bytes, user_channel_id_arg->elems, 16); FREE(user_channel_id_arg);
78442         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);
78443         uint64_t ret_ref = 0;
78444         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78445         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78446         return ret_ref;
78447 }
78448
78449 static inline uint64_t ClaimedHTLC_clone_ptr(LDKClaimedHTLC *NONNULL_PTR arg) {
78450         LDKClaimedHTLC ret_var = ClaimedHTLC_clone(arg);
78451         uint64_t ret_ref = 0;
78452         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78453         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78454         return ret_ref;
78455 }
78456 int64_t  __attribute__((export_name("TS_ClaimedHTLC_clone_ptr"))) TS_ClaimedHTLC_clone_ptr(uint64_t arg) {
78457         LDKClaimedHTLC arg_conv;
78458         arg_conv.inner = untag_ptr(arg);
78459         arg_conv.is_owned = ptr_is_owned(arg);
78460         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
78461         arg_conv.is_owned = false;
78462         int64_t ret_conv = ClaimedHTLC_clone_ptr(&arg_conv);
78463         return ret_conv;
78464 }
78465
78466 uint64_t  __attribute__((export_name("TS_ClaimedHTLC_clone"))) TS_ClaimedHTLC_clone(uint64_t orig) {
78467         LDKClaimedHTLC orig_conv;
78468         orig_conv.inner = untag_ptr(orig);
78469         orig_conv.is_owned = ptr_is_owned(orig);
78470         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
78471         orig_conv.is_owned = false;
78472         LDKClaimedHTLC ret_var = ClaimedHTLC_clone(&orig_conv);
78473         uint64_t ret_ref = 0;
78474         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78475         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78476         return ret_ref;
78477 }
78478
78479 jboolean  __attribute__((export_name("TS_ClaimedHTLC_eq"))) TS_ClaimedHTLC_eq(uint64_t a, uint64_t b) {
78480         LDKClaimedHTLC a_conv;
78481         a_conv.inner = untag_ptr(a);
78482         a_conv.is_owned = ptr_is_owned(a);
78483         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
78484         a_conv.is_owned = false;
78485         LDKClaimedHTLC b_conv;
78486         b_conv.inner = untag_ptr(b);
78487         b_conv.is_owned = ptr_is_owned(b);
78488         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
78489         b_conv.is_owned = false;
78490         jboolean ret_conv = ClaimedHTLC_eq(&a_conv, &b_conv);
78491         return ret_conv;
78492 }
78493
78494 int8_tArray  __attribute__((export_name("TS_ClaimedHTLC_write"))) TS_ClaimedHTLC_write(uint64_t obj) {
78495         LDKClaimedHTLC obj_conv;
78496         obj_conv.inner = untag_ptr(obj);
78497         obj_conv.is_owned = ptr_is_owned(obj);
78498         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
78499         obj_conv.is_owned = false;
78500         LDKCVec_u8Z ret_var = ClaimedHTLC_write(&obj_conv);
78501         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
78502         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
78503         CVec_u8Z_free(ret_var);
78504         return ret_arr;
78505 }
78506
78507 uint64_t  __attribute__((export_name("TS_ClaimedHTLC_read"))) TS_ClaimedHTLC_read(int8_tArray ser) {
78508         LDKu8slice ser_ref;
78509         ser_ref.datalen = ser->arr_len;
78510         ser_ref.data = ser->elems;
78511         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
78512         *ret_conv = ClaimedHTLC_read(ser_ref);
78513         FREE(ser);
78514         return tag_ptr(ret_conv, true);
78515 }
78516
78517 void  __attribute__((export_name("TS_PathFailure_free"))) TS_PathFailure_free(uint64_t this_ptr) {
78518         if (!ptr_is_owned(this_ptr)) return;
78519         void* this_ptr_ptr = untag_ptr(this_ptr);
78520         CHECK_ACCESS(this_ptr_ptr);
78521         LDKPathFailure this_ptr_conv = *(LDKPathFailure*)(this_ptr_ptr);
78522         FREE(untag_ptr(this_ptr));
78523         PathFailure_free(this_ptr_conv);
78524 }
78525
78526 static inline uint64_t PathFailure_clone_ptr(LDKPathFailure *NONNULL_PTR arg) {
78527         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
78528         *ret_copy = PathFailure_clone(arg);
78529         uint64_t ret_ref = tag_ptr(ret_copy, true);
78530         return ret_ref;
78531 }
78532 int64_t  __attribute__((export_name("TS_PathFailure_clone_ptr"))) TS_PathFailure_clone_ptr(uint64_t arg) {
78533         LDKPathFailure* arg_conv = (LDKPathFailure*)untag_ptr(arg);
78534         int64_t ret_conv = PathFailure_clone_ptr(arg_conv);
78535         return ret_conv;
78536 }
78537
78538 uint64_t  __attribute__((export_name("TS_PathFailure_clone"))) TS_PathFailure_clone(uint64_t orig) {
78539         LDKPathFailure* orig_conv = (LDKPathFailure*)untag_ptr(orig);
78540         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
78541         *ret_copy = PathFailure_clone(orig_conv);
78542         uint64_t ret_ref = tag_ptr(ret_copy, true);
78543         return ret_ref;
78544 }
78545
78546 uint64_t  __attribute__((export_name("TS_PathFailure_initial_send"))) TS_PathFailure_initial_send(uint64_t err) {
78547         void* err_ptr = untag_ptr(err);
78548         CHECK_ACCESS(err_ptr);
78549         LDKAPIError err_conv = *(LDKAPIError*)(err_ptr);
78550         err_conv = APIError_clone((LDKAPIError*)untag_ptr(err));
78551         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
78552         *ret_copy = PathFailure_initial_send(err_conv);
78553         uint64_t ret_ref = tag_ptr(ret_copy, true);
78554         return ret_ref;
78555 }
78556
78557 uint64_t  __attribute__((export_name("TS_PathFailure_on_path"))) TS_PathFailure_on_path(uint64_t network_update) {
78558         void* network_update_ptr = untag_ptr(network_update);
78559         CHECK_ACCESS(network_update_ptr);
78560         LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
78561         network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(network_update));
78562         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
78563         *ret_copy = PathFailure_on_path(network_update_conv);
78564         uint64_t ret_ref = tag_ptr(ret_copy, true);
78565         return ret_ref;
78566 }
78567
78568 jboolean  __attribute__((export_name("TS_PathFailure_eq"))) TS_PathFailure_eq(uint64_t a, uint64_t b) {
78569         LDKPathFailure* a_conv = (LDKPathFailure*)untag_ptr(a);
78570         LDKPathFailure* b_conv = (LDKPathFailure*)untag_ptr(b);
78571         jboolean ret_conv = PathFailure_eq(a_conv, b_conv);
78572         return ret_conv;
78573 }
78574
78575 int8_tArray  __attribute__((export_name("TS_PathFailure_write"))) TS_PathFailure_write(uint64_t obj) {
78576         LDKPathFailure* obj_conv = (LDKPathFailure*)untag_ptr(obj);
78577         LDKCVec_u8Z ret_var = PathFailure_write(obj_conv);
78578         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
78579         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
78580         CVec_u8Z_free(ret_var);
78581         return ret_arr;
78582 }
78583
78584 uint64_t  __attribute__((export_name("TS_PathFailure_read"))) TS_PathFailure_read(int8_tArray ser) {
78585         LDKu8slice ser_ref;
78586         ser_ref.datalen = ser->arr_len;
78587         ser_ref.data = ser->elems;
78588         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
78589         *ret_conv = PathFailure_read(ser_ref);
78590         FREE(ser);
78591         return tag_ptr(ret_conv, true);
78592 }
78593
78594 void  __attribute__((export_name("TS_ClosureReason_free"))) TS_ClosureReason_free(uint64_t this_ptr) {
78595         if (!ptr_is_owned(this_ptr)) return;
78596         void* this_ptr_ptr = untag_ptr(this_ptr);
78597         CHECK_ACCESS(this_ptr_ptr);
78598         LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
78599         FREE(untag_ptr(this_ptr));
78600         ClosureReason_free(this_ptr_conv);
78601 }
78602
78603 static inline uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
78604         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
78605         *ret_copy = ClosureReason_clone(arg);
78606         uint64_t ret_ref = tag_ptr(ret_copy, true);
78607         return ret_ref;
78608 }
78609 int64_t  __attribute__((export_name("TS_ClosureReason_clone_ptr"))) TS_ClosureReason_clone_ptr(uint64_t arg) {
78610         LDKClosureReason* arg_conv = (LDKClosureReason*)untag_ptr(arg);
78611         int64_t ret_conv = ClosureReason_clone_ptr(arg_conv);
78612         return ret_conv;
78613 }
78614
78615 uint64_t  __attribute__((export_name("TS_ClosureReason_clone"))) TS_ClosureReason_clone(uint64_t orig) {
78616         LDKClosureReason* orig_conv = (LDKClosureReason*)untag_ptr(orig);
78617         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
78618         *ret_copy = ClosureReason_clone(orig_conv);
78619         uint64_t ret_ref = tag_ptr(ret_copy, true);
78620         return ret_ref;
78621 }
78622
78623 uint64_t  __attribute__((export_name("TS_ClosureReason_counterparty_force_closed"))) TS_ClosureReason_counterparty_force_closed(uint64_t peer_msg) {
78624         LDKUntrustedString peer_msg_conv;
78625         peer_msg_conv.inner = untag_ptr(peer_msg);
78626         peer_msg_conv.is_owned = ptr_is_owned(peer_msg);
78627         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_conv);
78628         peer_msg_conv = UntrustedString_clone(&peer_msg_conv);
78629         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
78630         *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
78631         uint64_t ret_ref = tag_ptr(ret_copy, true);
78632         return ret_ref;
78633 }
78634
78635 uint64_t  __attribute__((export_name("TS_ClosureReason_holder_force_closed"))) TS_ClosureReason_holder_force_closed() {
78636         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
78637         *ret_copy = ClosureReason_holder_force_closed();
78638         uint64_t ret_ref = tag_ptr(ret_copy, true);
78639         return ret_ref;
78640 }
78641
78642 uint64_t  __attribute__((export_name("TS_ClosureReason_legacy_cooperative_closure"))) TS_ClosureReason_legacy_cooperative_closure() {
78643         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
78644         *ret_copy = ClosureReason_legacy_cooperative_closure();
78645         uint64_t ret_ref = tag_ptr(ret_copy, true);
78646         return ret_ref;
78647 }
78648
78649 uint64_t  __attribute__((export_name("TS_ClosureReason_counterparty_initiated_cooperative_closure"))) TS_ClosureReason_counterparty_initiated_cooperative_closure() {
78650         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
78651         *ret_copy = ClosureReason_counterparty_initiated_cooperative_closure();
78652         uint64_t ret_ref = tag_ptr(ret_copy, true);
78653         return ret_ref;
78654 }
78655
78656 uint64_t  __attribute__((export_name("TS_ClosureReason_locally_initiated_cooperative_closure"))) TS_ClosureReason_locally_initiated_cooperative_closure() {
78657         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
78658         *ret_copy = ClosureReason_locally_initiated_cooperative_closure();
78659         uint64_t ret_ref = tag_ptr(ret_copy, true);
78660         return ret_ref;
78661 }
78662
78663 uint64_t  __attribute__((export_name("TS_ClosureReason_commitment_tx_confirmed"))) TS_ClosureReason_commitment_tx_confirmed() {
78664         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
78665         *ret_copy = ClosureReason_commitment_tx_confirmed();
78666         uint64_t ret_ref = tag_ptr(ret_copy, true);
78667         return ret_ref;
78668 }
78669
78670 uint64_t  __attribute__((export_name("TS_ClosureReason_funding_timed_out"))) TS_ClosureReason_funding_timed_out() {
78671         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
78672         *ret_copy = ClosureReason_funding_timed_out();
78673         uint64_t ret_ref = tag_ptr(ret_copy, true);
78674         return ret_ref;
78675 }
78676
78677 uint64_t  __attribute__((export_name("TS_ClosureReason_processing_error"))) TS_ClosureReason_processing_error(jstring err) {
78678         LDKStr err_conv = str_ref_to_owned_c(err);
78679         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
78680         *ret_copy = ClosureReason_processing_error(err_conv);
78681         uint64_t ret_ref = tag_ptr(ret_copy, true);
78682         return ret_ref;
78683 }
78684
78685 uint64_t  __attribute__((export_name("TS_ClosureReason_disconnected_peer"))) TS_ClosureReason_disconnected_peer() {
78686         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
78687         *ret_copy = ClosureReason_disconnected_peer();
78688         uint64_t ret_ref = tag_ptr(ret_copy, true);
78689         return ret_ref;
78690 }
78691
78692 uint64_t  __attribute__((export_name("TS_ClosureReason_outdated_channel_manager"))) TS_ClosureReason_outdated_channel_manager() {
78693         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
78694         *ret_copy = ClosureReason_outdated_channel_manager();
78695         uint64_t ret_ref = tag_ptr(ret_copy, true);
78696         return ret_ref;
78697 }
78698
78699 uint64_t  __attribute__((export_name("TS_ClosureReason_counterparty_coop_closed_unfunded_channel"))) TS_ClosureReason_counterparty_coop_closed_unfunded_channel() {
78700         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
78701         *ret_copy = ClosureReason_counterparty_coop_closed_unfunded_channel();
78702         uint64_t ret_ref = tag_ptr(ret_copy, true);
78703         return ret_ref;
78704 }
78705
78706 uint64_t  __attribute__((export_name("TS_ClosureReason_funding_batch_closure"))) TS_ClosureReason_funding_batch_closure() {
78707         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
78708         *ret_copy = ClosureReason_funding_batch_closure();
78709         uint64_t ret_ref = tag_ptr(ret_copy, true);
78710         return ret_ref;
78711 }
78712
78713 uint64_t  __attribute__((export_name("TS_ClosureReason_htlcs_timed_out"))) TS_ClosureReason_htlcs_timed_out() {
78714         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
78715         *ret_copy = ClosureReason_htlcs_timed_out();
78716         uint64_t ret_ref = tag_ptr(ret_copy, true);
78717         return ret_ref;
78718 }
78719
78720 jboolean  __attribute__((export_name("TS_ClosureReason_eq"))) TS_ClosureReason_eq(uint64_t a, uint64_t b) {
78721         LDKClosureReason* a_conv = (LDKClosureReason*)untag_ptr(a);
78722         LDKClosureReason* b_conv = (LDKClosureReason*)untag_ptr(b);
78723         jboolean ret_conv = ClosureReason_eq(a_conv, b_conv);
78724         return ret_conv;
78725 }
78726
78727 int8_tArray  __attribute__((export_name("TS_ClosureReason_write"))) TS_ClosureReason_write(uint64_t obj) {
78728         LDKClosureReason* obj_conv = (LDKClosureReason*)untag_ptr(obj);
78729         LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
78730         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
78731         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
78732         CVec_u8Z_free(ret_var);
78733         return ret_arr;
78734 }
78735
78736 uint64_t  __attribute__((export_name("TS_ClosureReason_read"))) TS_ClosureReason_read(int8_tArray ser) {
78737         LDKu8slice ser_ref;
78738         ser_ref.datalen = ser->arr_len;
78739         ser_ref.data = ser->elems;
78740         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
78741         *ret_conv = ClosureReason_read(ser_ref);
78742         FREE(ser);
78743         return tag_ptr(ret_conv, true);
78744 }
78745
78746 void  __attribute__((export_name("TS_HTLCDestination_free"))) TS_HTLCDestination_free(uint64_t this_ptr) {
78747         if (!ptr_is_owned(this_ptr)) return;
78748         void* this_ptr_ptr = untag_ptr(this_ptr);
78749         CHECK_ACCESS(this_ptr_ptr);
78750         LDKHTLCDestination this_ptr_conv = *(LDKHTLCDestination*)(this_ptr_ptr);
78751         FREE(untag_ptr(this_ptr));
78752         HTLCDestination_free(this_ptr_conv);
78753 }
78754
78755 static inline uint64_t HTLCDestination_clone_ptr(LDKHTLCDestination *NONNULL_PTR arg) {
78756         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
78757         *ret_copy = HTLCDestination_clone(arg);
78758         uint64_t ret_ref = tag_ptr(ret_copy, true);
78759         return ret_ref;
78760 }
78761 int64_t  __attribute__((export_name("TS_HTLCDestination_clone_ptr"))) TS_HTLCDestination_clone_ptr(uint64_t arg) {
78762         LDKHTLCDestination* arg_conv = (LDKHTLCDestination*)untag_ptr(arg);
78763         int64_t ret_conv = HTLCDestination_clone_ptr(arg_conv);
78764         return ret_conv;
78765 }
78766
78767 uint64_t  __attribute__((export_name("TS_HTLCDestination_clone"))) TS_HTLCDestination_clone(uint64_t orig) {
78768         LDKHTLCDestination* orig_conv = (LDKHTLCDestination*)untag_ptr(orig);
78769         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
78770         *ret_copy = HTLCDestination_clone(orig_conv);
78771         uint64_t ret_ref = tag_ptr(ret_copy, true);
78772         return ret_ref;
78773 }
78774
78775 uint64_t  __attribute__((export_name("TS_HTLCDestination_next_hop_channel"))) TS_HTLCDestination_next_hop_channel(int8_tArray node_id, uint64_t channel_id) {
78776         LDKPublicKey node_id_ref;
78777         CHECK(node_id->arr_len == 33);
78778         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
78779         LDKChannelId channel_id_conv;
78780         channel_id_conv.inner = untag_ptr(channel_id);
78781         channel_id_conv.is_owned = ptr_is_owned(channel_id);
78782         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
78783         channel_id_conv = ChannelId_clone(&channel_id_conv);
78784         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
78785         *ret_copy = HTLCDestination_next_hop_channel(node_id_ref, channel_id_conv);
78786         uint64_t ret_ref = tag_ptr(ret_copy, true);
78787         return ret_ref;
78788 }
78789
78790 uint64_t  __attribute__((export_name("TS_HTLCDestination_unknown_next_hop"))) TS_HTLCDestination_unknown_next_hop(int64_t requested_forward_scid) {
78791         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
78792         *ret_copy = HTLCDestination_unknown_next_hop(requested_forward_scid);
78793         uint64_t ret_ref = tag_ptr(ret_copy, true);
78794         return ret_ref;
78795 }
78796
78797 uint64_t  __attribute__((export_name("TS_HTLCDestination_invalid_forward"))) TS_HTLCDestination_invalid_forward(int64_t requested_forward_scid) {
78798         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
78799         *ret_copy = HTLCDestination_invalid_forward(requested_forward_scid);
78800         uint64_t ret_ref = tag_ptr(ret_copy, true);
78801         return ret_ref;
78802 }
78803
78804 uint64_t  __attribute__((export_name("TS_HTLCDestination_invalid_onion"))) TS_HTLCDestination_invalid_onion() {
78805         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
78806         *ret_copy = HTLCDestination_invalid_onion();
78807         uint64_t ret_ref = tag_ptr(ret_copy, true);
78808         return ret_ref;
78809 }
78810
78811 uint64_t  __attribute__((export_name("TS_HTLCDestination_failed_payment"))) TS_HTLCDestination_failed_payment(int8_tArray payment_hash) {
78812         LDKThirtyTwoBytes payment_hash_ref;
78813         CHECK(payment_hash->arr_len == 32);
78814         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
78815         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
78816         *ret_copy = HTLCDestination_failed_payment(payment_hash_ref);
78817         uint64_t ret_ref = tag_ptr(ret_copy, true);
78818         return ret_ref;
78819 }
78820
78821 jboolean  __attribute__((export_name("TS_HTLCDestination_eq"))) TS_HTLCDestination_eq(uint64_t a, uint64_t b) {
78822         LDKHTLCDestination* a_conv = (LDKHTLCDestination*)untag_ptr(a);
78823         LDKHTLCDestination* b_conv = (LDKHTLCDestination*)untag_ptr(b);
78824         jboolean ret_conv = HTLCDestination_eq(a_conv, b_conv);
78825         return ret_conv;
78826 }
78827
78828 int8_tArray  __attribute__((export_name("TS_HTLCDestination_write"))) TS_HTLCDestination_write(uint64_t obj) {
78829         LDKHTLCDestination* obj_conv = (LDKHTLCDestination*)untag_ptr(obj);
78830         LDKCVec_u8Z ret_var = HTLCDestination_write(obj_conv);
78831         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
78832         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
78833         CVec_u8Z_free(ret_var);
78834         return ret_arr;
78835 }
78836
78837 uint64_t  __attribute__((export_name("TS_HTLCDestination_read"))) TS_HTLCDestination_read(int8_tArray ser) {
78838         LDKu8slice ser_ref;
78839         ser_ref.datalen = ser->arr_len;
78840         ser_ref.data = ser->elems;
78841         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
78842         *ret_conv = HTLCDestination_read(ser_ref);
78843         FREE(ser);
78844         return tag_ptr(ret_conv, true);
78845 }
78846
78847 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_clone"))) TS_PaymentFailureReason_clone(uint64_t orig) {
78848         LDKPaymentFailureReason* orig_conv = (LDKPaymentFailureReason*)untag_ptr(orig);
78849         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_clone(orig_conv));
78850         return ret_conv;
78851 }
78852
78853 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_recipient_rejected"))) TS_PaymentFailureReason_recipient_rejected() {
78854         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_recipient_rejected());
78855         return ret_conv;
78856 }
78857
78858 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_user_abandoned"))) TS_PaymentFailureReason_user_abandoned() {
78859         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_user_abandoned());
78860         return ret_conv;
78861 }
78862
78863 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_retries_exhausted"))) TS_PaymentFailureReason_retries_exhausted() {
78864         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_retries_exhausted());
78865         return ret_conv;
78866 }
78867
78868 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_payment_expired"))) TS_PaymentFailureReason_payment_expired() {
78869         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_payment_expired());
78870         return ret_conv;
78871 }
78872
78873 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_route_not_found"))) TS_PaymentFailureReason_route_not_found() {
78874         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_route_not_found());
78875         return ret_conv;
78876 }
78877
78878 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_unexpected_error"))) TS_PaymentFailureReason_unexpected_error() {
78879         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_unexpected_error());
78880         return ret_conv;
78881 }
78882
78883 jboolean  __attribute__((export_name("TS_PaymentFailureReason_eq"))) TS_PaymentFailureReason_eq(uint64_t a, uint64_t b) {
78884         LDKPaymentFailureReason* a_conv = (LDKPaymentFailureReason*)untag_ptr(a);
78885         LDKPaymentFailureReason* b_conv = (LDKPaymentFailureReason*)untag_ptr(b);
78886         jboolean ret_conv = PaymentFailureReason_eq(a_conv, b_conv);
78887         return ret_conv;
78888 }
78889
78890 int8_tArray  __attribute__((export_name("TS_PaymentFailureReason_write"))) TS_PaymentFailureReason_write(uint64_t obj) {
78891         LDKPaymentFailureReason* obj_conv = (LDKPaymentFailureReason*)untag_ptr(obj);
78892         LDKCVec_u8Z ret_var = PaymentFailureReason_write(obj_conv);
78893         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
78894         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
78895         CVec_u8Z_free(ret_var);
78896         return ret_arr;
78897 }
78898
78899 uint64_t  __attribute__((export_name("TS_PaymentFailureReason_read"))) TS_PaymentFailureReason_read(int8_tArray ser) {
78900         LDKu8slice ser_ref;
78901         ser_ref.datalen = ser->arr_len;
78902         ser_ref.data = ser->elems;
78903         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
78904         *ret_conv = PaymentFailureReason_read(ser_ref);
78905         FREE(ser);
78906         return tag_ptr(ret_conv, true);
78907 }
78908
78909 void  __attribute__((export_name("TS_Event_free"))) TS_Event_free(uint64_t this_ptr) {
78910         if (!ptr_is_owned(this_ptr)) return;
78911         void* this_ptr_ptr = untag_ptr(this_ptr);
78912         CHECK_ACCESS(this_ptr_ptr);
78913         LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
78914         FREE(untag_ptr(this_ptr));
78915         Event_free(this_ptr_conv);
78916 }
78917
78918 static inline uint64_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
78919         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
78920         *ret_copy = Event_clone(arg);
78921         uint64_t ret_ref = tag_ptr(ret_copy, true);
78922         return ret_ref;
78923 }
78924 int64_t  __attribute__((export_name("TS_Event_clone_ptr"))) TS_Event_clone_ptr(uint64_t arg) {
78925         LDKEvent* arg_conv = (LDKEvent*)untag_ptr(arg);
78926         int64_t ret_conv = Event_clone_ptr(arg_conv);
78927         return ret_conv;
78928 }
78929
78930 uint64_t  __attribute__((export_name("TS_Event_clone"))) TS_Event_clone(uint64_t orig) {
78931         LDKEvent* orig_conv = (LDKEvent*)untag_ptr(orig);
78932         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
78933         *ret_copy = Event_clone(orig_conv);
78934         uint64_t ret_ref = tag_ptr(ret_copy, true);
78935         return ret_ref;
78936 }
78937
78938 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) {
78939         LDKChannelId temporary_channel_id_conv;
78940         temporary_channel_id_conv.inner = untag_ptr(temporary_channel_id);
78941         temporary_channel_id_conv.is_owned = ptr_is_owned(temporary_channel_id);
78942         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_conv);
78943         temporary_channel_id_conv = ChannelId_clone(&temporary_channel_id_conv);
78944         LDKPublicKey counterparty_node_id_ref;
78945         CHECK(counterparty_node_id->arr_len == 33);
78946         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
78947         LDKCVec_u8Z output_script_ref;
78948         output_script_ref.datalen = output_script->arr_len;
78949         output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
78950         memcpy(output_script_ref.data, output_script->elems, output_script_ref.datalen); FREE(output_script);
78951         LDKU128 user_channel_id_ref;
78952         CHECK(user_channel_id->arr_len == 16);
78953         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
78954         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
78955         *ret_copy = Event_funding_generation_ready(temporary_channel_id_conv, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id_ref);
78956         uint64_t ret_ref = tag_ptr(ret_copy, true);
78957         return ret_ref;
78958 }
78959
78960 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) {
78961         LDKPublicKey receiver_node_id_ref;
78962         CHECK(receiver_node_id->arr_len == 33);
78963         memcpy(receiver_node_id_ref.compressed_form, receiver_node_id->elems, 33); FREE(receiver_node_id);
78964         LDKThirtyTwoBytes payment_hash_ref;
78965         CHECK(payment_hash->arr_len == 32);
78966         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
78967         LDKRecipientOnionFields onion_fields_conv;
78968         onion_fields_conv.inner = untag_ptr(onion_fields);
78969         onion_fields_conv.is_owned = ptr_is_owned(onion_fields);
78970         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_conv);
78971         onion_fields_conv = RecipientOnionFields_clone(&onion_fields_conv);
78972         void* purpose_ptr = untag_ptr(purpose);
78973         CHECK_ACCESS(purpose_ptr);
78974         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
78975         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
78976         LDKChannelId via_channel_id_conv;
78977         via_channel_id_conv.inner = untag_ptr(via_channel_id);
78978         via_channel_id_conv.is_owned = ptr_is_owned(via_channel_id);
78979         CHECK_INNER_FIELD_ACCESS_OR_NULL(via_channel_id_conv);
78980         via_channel_id_conv = ChannelId_clone(&via_channel_id_conv);
78981         void* via_user_channel_id_ptr = untag_ptr(via_user_channel_id);
78982         CHECK_ACCESS(via_user_channel_id_ptr);
78983         LDKCOption_U128Z via_user_channel_id_conv = *(LDKCOption_U128Z*)(via_user_channel_id_ptr);
78984         via_user_channel_id_conv = COption_U128Z_clone((LDKCOption_U128Z*)untag_ptr(via_user_channel_id));
78985         void* claim_deadline_ptr = untag_ptr(claim_deadline);
78986         CHECK_ACCESS(claim_deadline_ptr);
78987         LDKCOption_u32Z claim_deadline_conv = *(LDKCOption_u32Z*)(claim_deadline_ptr);
78988         claim_deadline_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(claim_deadline));
78989         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
78990         *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);
78991         uint64_t ret_ref = tag_ptr(ret_copy, true);
78992         return ret_ref;
78993 }
78994
78995 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) {
78996         LDKPublicKey receiver_node_id_ref;
78997         CHECK(receiver_node_id->arr_len == 33);
78998         memcpy(receiver_node_id_ref.compressed_form, receiver_node_id->elems, 33); FREE(receiver_node_id);
78999         LDKThirtyTwoBytes payment_hash_ref;
79000         CHECK(payment_hash->arr_len == 32);
79001         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
79002         void* purpose_ptr = untag_ptr(purpose);
79003         CHECK_ACCESS(purpose_ptr);
79004         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
79005         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
79006         LDKCVec_ClaimedHTLCZ htlcs_constr;
79007         htlcs_constr.datalen = htlcs->arr_len;
79008         if (htlcs_constr.datalen > 0)
79009                 htlcs_constr.data = MALLOC(htlcs_constr.datalen * sizeof(LDKClaimedHTLC), "LDKCVec_ClaimedHTLCZ Elements");
79010         else
79011                 htlcs_constr.data = NULL;
79012         uint64_t* htlcs_vals = htlcs->elems;
79013         for (size_t n = 0; n < htlcs_constr.datalen; n++) {
79014                 uint64_t htlcs_conv_13 = htlcs_vals[n];
79015                 LDKClaimedHTLC htlcs_conv_13_conv;
79016                 htlcs_conv_13_conv.inner = untag_ptr(htlcs_conv_13);
79017                 htlcs_conv_13_conv.is_owned = ptr_is_owned(htlcs_conv_13);
79018                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlcs_conv_13_conv);
79019                 htlcs_conv_13_conv = ClaimedHTLC_clone(&htlcs_conv_13_conv);
79020                 htlcs_constr.data[n] = htlcs_conv_13_conv;
79021         }
79022         FREE(htlcs);
79023         void* sender_intended_total_msat_ptr = untag_ptr(sender_intended_total_msat);
79024         CHECK_ACCESS(sender_intended_total_msat_ptr);
79025         LDKCOption_u64Z sender_intended_total_msat_conv = *(LDKCOption_u64Z*)(sender_intended_total_msat_ptr);
79026         sender_intended_total_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(sender_intended_total_msat));
79027         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79028         *ret_copy = Event_payment_claimed(receiver_node_id_ref, payment_hash_ref, amount_msat, purpose_conv, htlcs_constr, sender_intended_total_msat_conv);
79029         uint64_t ret_ref = tag_ptr(ret_copy, true);
79030         return ret_ref;
79031 }
79032
79033 uint64_t  __attribute__((export_name("TS_Event_connection_needed"))) TS_Event_connection_needed(int8_tArray node_id, uint64_tArray addresses) {
79034         LDKPublicKey node_id_ref;
79035         CHECK(node_id->arr_len == 33);
79036         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79037         LDKCVec_SocketAddressZ addresses_constr;
79038         addresses_constr.datalen = addresses->arr_len;
79039         if (addresses_constr.datalen > 0)
79040                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
79041         else
79042                 addresses_constr.data = NULL;
79043         uint64_t* addresses_vals = addresses->elems;
79044         for (size_t p = 0; p < addresses_constr.datalen; p++) {
79045                 uint64_t addresses_conv_15 = addresses_vals[p];
79046                 void* addresses_conv_15_ptr = untag_ptr(addresses_conv_15);
79047                 CHECK_ACCESS(addresses_conv_15_ptr);
79048                 LDKSocketAddress addresses_conv_15_conv = *(LDKSocketAddress*)(addresses_conv_15_ptr);
79049                 addresses_constr.data[p] = addresses_conv_15_conv;
79050         }
79051         FREE(addresses);
79052         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79053         *ret_copy = Event_connection_needed(node_id_ref, addresses_constr);
79054         uint64_t ret_ref = tag_ptr(ret_copy, true);
79055         return ret_ref;
79056 }
79057
79058 uint64_t  __attribute__((export_name("TS_Event_invoice_request_failed"))) TS_Event_invoice_request_failed(int8_tArray payment_id) {
79059         LDKThirtyTwoBytes payment_id_ref;
79060         CHECK(payment_id->arr_len == 32);
79061         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
79062         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79063         *ret_copy = Event_invoice_request_failed(payment_id_ref);
79064         uint64_t ret_ref = tag_ptr(ret_copy, true);
79065         return ret_ref;
79066 }
79067
79068 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) {
79069         void* payment_id_ptr = untag_ptr(payment_id);
79070         CHECK_ACCESS(payment_id_ptr);
79071         LDKCOption_ThirtyTwoBytesZ payment_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_id_ptr);
79072         payment_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_id));
79073         LDKThirtyTwoBytes payment_preimage_ref;
79074         CHECK(payment_preimage->arr_len == 32);
79075         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
79076         LDKThirtyTwoBytes payment_hash_ref;
79077         CHECK(payment_hash->arr_len == 32);
79078         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
79079         void* fee_paid_msat_ptr = untag_ptr(fee_paid_msat);
79080         CHECK_ACCESS(fee_paid_msat_ptr);
79081         LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
79082         fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_paid_msat));
79083         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79084         *ret_copy = Event_payment_sent(payment_id_conv, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
79085         uint64_t ret_ref = tag_ptr(ret_copy, true);
79086         return ret_ref;
79087 }
79088
79089 uint64_t  __attribute__((export_name("TS_Event_payment_failed"))) TS_Event_payment_failed(int8_tArray payment_id, int8_tArray payment_hash, uint64_t reason) {
79090         LDKThirtyTwoBytes payment_id_ref;
79091         CHECK(payment_id->arr_len == 32);
79092         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
79093         LDKThirtyTwoBytes payment_hash_ref;
79094         CHECK(payment_hash->arr_len == 32);
79095         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
79096         void* reason_ptr = untag_ptr(reason);
79097         CHECK_ACCESS(reason_ptr);
79098         LDKCOption_PaymentFailureReasonZ reason_conv = *(LDKCOption_PaymentFailureReasonZ*)(reason_ptr);
79099         reason_conv = COption_PaymentFailureReasonZ_clone((LDKCOption_PaymentFailureReasonZ*)untag_ptr(reason));
79100         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79101         *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref, reason_conv);
79102         uint64_t ret_ref = tag_ptr(ret_copy, true);
79103         return ret_ref;
79104 }
79105
79106 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) {
79107         LDKThirtyTwoBytes payment_id_ref;
79108         CHECK(payment_id->arr_len == 32);
79109         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
79110         void* payment_hash_ptr = untag_ptr(payment_hash);
79111         CHECK_ACCESS(payment_hash_ptr);
79112         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
79113         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
79114         LDKPath path_conv;
79115         path_conv.inner = untag_ptr(path);
79116         path_conv.is_owned = ptr_is_owned(path);
79117         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
79118         path_conv = Path_clone(&path_conv);
79119         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79120         *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_conv, path_conv);
79121         uint64_t ret_ref = tag_ptr(ret_copy, true);
79122         return ret_ref;
79123 }
79124
79125 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) {
79126         void* payment_id_ptr = untag_ptr(payment_id);
79127         CHECK_ACCESS(payment_id_ptr);
79128         LDKCOption_ThirtyTwoBytesZ payment_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_id_ptr);
79129         payment_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_id));
79130         LDKThirtyTwoBytes payment_hash_ref;
79131         CHECK(payment_hash->arr_len == 32);
79132         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
79133         void* failure_ptr = untag_ptr(failure);
79134         CHECK_ACCESS(failure_ptr);
79135         LDKPathFailure failure_conv = *(LDKPathFailure*)(failure_ptr);
79136         failure_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(failure));
79137         LDKPath path_conv;
79138         path_conv.inner = untag_ptr(path);
79139         path_conv.is_owned = ptr_is_owned(path);
79140         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
79141         path_conv = Path_clone(&path_conv);
79142         void* short_channel_id_ptr = untag_ptr(short_channel_id);
79143         CHECK_ACCESS(short_channel_id_ptr);
79144         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
79145         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
79146         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79147         *ret_copy = Event_payment_path_failed(payment_id_conv, payment_hash_ref, payment_failed_permanently, failure_conv, path_conv, short_channel_id_conv);
79148         uint64_t ret_ref = tag_ptr(ret_copy, true);
79149         return ret_ref;
79150 }
79151
79152 uint64_t  __attribute__((export_name("TS_Event_probe_successful"))) TS_Event_probe_successful(int8_tArray payment_id, int8_tArray payment_hash, uint64_t path) {
79153         LDKThirtyTwoBytes payment_id_ref;
79154         CHECK(payment_id->arr_len == 32);
79155         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
79156         LDKThirtyTwoBytes payment_hash_ref;
79157         CHECK(payment_hash->arr_len == 32);
79158         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
79159         LDKPath path_conv;
79160         path_conv.inner = untag_ptr(path);
79161         path_conv.is_owned = ptr_is_owned(path);
79162         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
79163         path_conv = Path_clone(&path_conv);
79164         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79165         *ret_copy = Event_probe_successful(payment_id_ref, payment_hash_ref, path_conv);
79166         uint64_t ret_ref = tag_ptr(ret_copy, true);
79167         return ret_ref;
79168 }
79169
79170 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) {
79171         LDKThirtyTwoBytes payment_id_ref;
79172         CHECK(payment_id->arr_len == 32);
79173         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
79174         LDKThirtyTwoBytes payment_hash_ref;
79175         CHECK(payment_hash->arr_len == 32);
79176         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
79177         LDKPath path_conv;
79178         path_conv.inner = untag_ptr(path);
79179         path_conv.is_owned = ptr_is_owned(path);
79180         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
79181         path_conv = Path_clone(&path_conv);
79182         void* short_channel_id_ptr = untag_ptr(short_channel_id);
79183         CHECK_ACCESS(short_channel_id_ptr);
79184         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
79185         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
79186         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79187         *ret_copy = Event_probe_failed(payment_id_ref, payment_hash_ref, path_conv, short_channel_id_conv);
79188         uint64_t ret_ref = tag_ptr(ret_copy, true);
79189         return ret_ref;
79190 }
79191
79192 uint64_t  __attribute__((export_name("TS_Event_pending_htlcs_forwardable"))) TS_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
79193         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79194         *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
79195         uint64_t ret_ref = tag_ptr(ret_copy, true);
79196         return ret_ref;
79197 }
79198
79199 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) {
79200         LDKThirtyTwoBytes intercept_id_ref;
79201         CHECK(intercept_id->arr_len == 32);
79202         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
79203         LDKThirtyTwoBytes payment_hash_ref;
79204         CHECK(payment_hash->arr_len == 32);
79205         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
79206         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79207         *ret_copy = Event_htlcintercepted(intercept_id_ref, requested_next_hop_scid, payment_hash_ref, inbound_amount_msat, expected_outbound_amount_msat);
79208         uint64_t ret_ref = tag_ptr(ret_copy, true);
79209         return ret_ref;
79210 }
79211
79212 uint64_t  __attribute__((export_name("TS_Event_spendable_outputs"))) TS_Event_spendable_outputs(uint64_tArray outputs, uint64_t channel_id) {
79213         LDKCVec_SpendableOutputDescriptorZ outputs_constr;
79214         outputs_constr.datalen = outputs->arr_len;
79215         if (outputs_constr.datalen > 0)
79216                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
79217         else
79218                 outputs_constr.data = NULL;
79219         uint64_t* outputs_vals = outputs->elems;
79220         for (size_t b = 0; b < outputs_constr.datalen; b++) {
79221                 uint64_t outputs_conv_27 = outputs_vals[b];
79222                 void* outputs_conv_27_ptr = untag_ptr(outputs_conv_27);
79223                 CHECK_ACCESS(outputs_conv_27_ptr);
79224                 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
79225                 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(outputs_conv_27));
79226                 outputs_constr.data[b] = outputs_conv_27_conv;
79227         }
79228         FREE(outputs);
79229         LDKChannelId channel_id_conv;
79230         channel_id_conv.inner = untag_ptr(channel_id);
79231         channel_id_conv.is_owned = ptr_is_owned(channel_id);
79232         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
79233         channel_id_conv = ChannelId_clone(&channel_id_conv);
79234         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79235         *ret_copy = Event_spendable_outputs(outputs_constr, channel_id_conv);
79236         uint64_t ret_ref = tag_ptr(ret_copy, true);
79237         return ret_ref;
79238 }
79239
79240 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) {
79241         LDKChannelId prev_channel_id_conv;
79242         prev_channel_id_conv.inner = untag_ptr(prev_channel_id);
79243         prev_channel_id_conv.is_owned = ptr_is_owned(prev_channel_id);
79244         CHECK_INNER_FIELD_ACCESS_OR_NULL(prev_channel_id_conv);
79245         prev_channel_id_conv = ChannelId_clone(&prev_channel_id_conv);
79246         LDKChannelId next_channel_id_conv;
79247         next_channel_id_conv.inner = untag_ptr(next_channel_id);
79248         next_channel_id_conv.is_owned = ptr_is_owned(next_channel_id);
79249         CHECK_INNER_FIELD_ACCESS_OR_NULL(next_channel_id_conv);
79250         next_channel_id_conv = ChannelId_clone(&next_channel_id_conv);
79251         void* prev_user_channel_id_ptr = untag_ptr(prev_user_channel_id);
79252         CHECK_ACCESS(prev_user_channel_id_ptr);
79253         LDKCOption_U128Z prev_user_channel_id_conv = *(LDKCOption_U128Z*)(prev_user_channel_id_ptr);
79254         prev_user_channel_id_conv = COption_U128Z_clone((LDKCOption_U128Z*)untag_ptr(prev_user_channel_id));
79255         void* next_user_channel_id_ptr = untag_ptr(next_user_channel_id);
79256         CHECK_ACCESS(next_user_channel_id_ptr);
79257         LDKCOption_U128Z next_user_channel_id_conv = *(LDKCOption_U128Z*)(next_user_channel_id_ptr);
79258         next_user_channel_id_conv = COption_U128Z_clone((LDKCOption_U128Z*)untag_ptr(next_user_channel_id));
79259         void* total_fee_earned_msat_ptr = untag_ptr(total_fee_earned_msat);
79260         CHECK_ACCESS(total_fee_earned_msat_ptr);
79261         LDKCOption_u64Z total_fee_earned_msat_conv = *(LDKCOption_u64Z*)(total_fee_earned_msat_ptr);
79262         total_fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(total_fee_earned_msat));
79263         void* skimmed_fee_msat_ptr = untag_ptr(skimmed_fee_msat);
79264         CHECK_ACCESS(skimmed_fee_msat_ptr);
79265         LDKCOption_u64Z skimmed_fee_msat_conv = *(LDKCOption_u64Z*)(skimmed_fee_msat_ptr);
79266         skimmed_fee_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(skimmed_fee_msat));
79267         void* outbound_amount_forwarded_msat_ptr = untag_ptr(outbound_amount_forwarded_msat);
79268         CHECK_ACCESS(outbound_amount_forwarded_msat_ptr);
79269         LDKCOption_u64Z outbound_amount_forwarded_msat_conv = *(LDKCOption_u64Z*)(outbound_amount_forwarded_msat_ptr);
79270         outbound_amount_forwarded_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_amount_forwarded_msat));
79271         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79272         *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);
79273         uint64_t ret_ref = tag_ptr(ret_copy, true);
79274         return ret_ref;
79275 }
79276
79277 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) {
79278         LDKChannelId channel_id_conv;
79279         channel_id_conv.inner = untag_ptr(channel_id);
79280         channel_id_conv.is_owned = ptr_is_owned(channel_id);
79281         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
79282         channel_id_conv = ChannelId_clone(&channel_id_conv);
79283         LDKU128 user_channel_id_ref;
79284         CHECK(user_channel_id->arr_len == 16);
79285         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
79286         LDKChannelId former_temporary_channel_id_conv;
79287         former_temporary_channel_id_conv.inner = untag_ptr(former_temporary_channel_id);
79288         former_temporary_channel_id_conv.is_owned = ptr_is_owned(former_temporary_channel_id);
79289         CHECK_INNER_FIELD_ACCESS_OR_NULL(former_temporary_channel_id_conv);
79290         former_temporary_channel_id_conv = ChannelId_clone(&former_temporary_channel_id_conv);
79291         LDKPublicKey counterparty_node_id_ref;
79292         CHECK(counterparty_node_id->arr_len == 33);
79293         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
79294         LDKOutPoint funding_txo_conv;
79295         funding_txo_conv.inner = untag_ptr(funding_txo);
79296         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
79297         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
79298         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
79299         LDKChannelTypeFeatures channel_type_conv;
79300         channel_type_conv.inner = untag_ptr(channel_type);
79301         channel_type_conv.is_owned = ptr_is_owned(channel_type);
79302         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
79303         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
79304         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79305         *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);
79306         uint64_t ret_ref = tag_ptr(ret_copy, true);
79307         return ret_ref;
79308 }
79309
79310 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) {
79311         LDKChannelId channel_id_conv;
79312         channel_id_conv.inner = untag_ptr(channel_id);
79313         channel_id_conv.is_owned = ptr_is_owned(channel_id);
79314         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
79315         channel_id_conv = ChannelId_clone(&channel_id_conv);
79316         LDKU128 user_channel_id_ref;
79317         CHECK(user_channel_id->arr_len == 16);
79318         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
79319         LDKPublicKey counterparty_node_id_ref;
79320         CHECK(counterparty_node_id->arr_len == 33);
79321         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
79322         LDKChannelTypeFeatures channel_type_conv;
79323         channel_type_conv.inner = untag_ptr(channel_type);
79324         channel_type_conv.is_owned = ptr_is_owned(channel_type);
79325         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
79326         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
79327         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79328         *ret_copy = Event_channel_ready(channel_id_conv, user_channel_id_ref, counterparty_node_id_ref, channel_type_conv);
79329         uint64_t ret_ref = tag_ptr(ret_copy, true);
79330         return ret_ref;
79331 }
79332
79333 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) {
79334         LDKChannelId channel_id_conv;
79335         channel_id_conv.inner = untag_ptr(channel_id);
79336         channel_id_conv.is_owned = ptr_is_owned(channel_id);
79337         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
79338         channel_id_conv = ChannelId_clone(&channel_id_conv);
79339         LDKU128 user_channel_id_ref;
79340         CHECK(user_channel_id->arr_len == 16);
79341         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
79342         void* reason_ptr = untag_ptr(reason);
79343         CHECK_ACCESS(reason_ptr);
79344         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
79345         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
79346         LDKPublicKey counterparty_node_id_ref;
79347         CHECK(counterparty_node_id->arr_len == 33);
79348         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
79349         void* channel_capacity_sats_ptr = untag_ptr(channel_capacity_sats);
79350         CHECK_ACCESS(channel_capacity_sats_ptr);
79351         LDKCOption_u64Z channel_capacity_sats_conv = *(LDKCOption_u64Z*)(channel_capacity_sats_ptr);
79352         channel_capacity_sats_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(channel_capacity_sats));
79353         LDKOutPoint channel_funding_txo_conv;
79354         channel_funding_txo_conv.inner = untag_ptr(channel_funding_txo);
79355         channel_funding_txo_conv.is_owned = ptr_is_owned(channel_funding_txo);
79356         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_txo_conv);
79357         channel_funding_txo_conv = OutPoint_clone(&channel_funding_txo_conv);
79358         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79359         *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);
79360         uint64_t ret_ref = tag_ptr(ret_copy, true);
79361         return ret_ref;
79362 }
79363
79364 uint64_t  __attribute__((export_name("TS_Event_discard_funding"))) TS_Event_discard_funding(uint64_t channel_id, int8_tArray transaction) {
79365         LDKChannelId channel_id_conv;
79366         channel_id_conv.inner = untag_ptr(channel_id);
79367         channel_id_conv.is_owned = ptr_is_owned(channel_id);
79368         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
79369         channel_id_conv = ChannelId_clone(&channel_id_conv);
79370         LDKTransaction transaction_ref;
79371         transaction_ref.datalen = transaction->arr_len;
79372         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
79373         memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen); FREE(transaction);
79374         transaction_ref.data_is_owned = true;
79375         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79376         *ret_copy = Event_discard_funding(channel_id_conv, transaction_ref);
79377         uint64_t ret_ref = tag_ptr(ret_copy, true);
79378         return ret_ref;
79379 }
79380
79381 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) {
79382         LDKChannelId temporary_channel_id_conv;
79383         temporary_channel_id_conv.inner = untag_ptr(temporary_channel_id);
79384         temporary_channel_id_conv.is_owned = ptr_is_owned(temporary_channel_id);
79385         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_conv);
79386         temporary_channel_id_conv = ChannelId_clone(&temporary_channel_id_conv);
79387         LDKPublicKey counterparty_node_id_ref;
79388         CHECK(counterparty_node_id->arr_len == 33);
79389         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
79390         LDKChannelTypeFeatures channel_type_conv;
79391         channel_type_conv.inner = untag_ptr(channel_type);
79392         channel_type_conv.is_owned = ptr_is_owned(channel_type);
79393         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
79394         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
79395         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79396         *ret_copy = Event_open_channel_request(temporary_channel_id_conv, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
79397         uint64_t ret_ref = tag_ptr(ret_copy, true);
79398         return ret_ref;
79399 }
79400
79401 uint64_t  __attribute__((export_name("TS_Event_htlchandling_failed"))) TS_Event_htlchandling_failed(uint64_t prev_channel_id, uint64_t failed_next_destination) {
79402         LDKChannelId prev_channel_id_conv;
79403         prev_channel_id_conv.inner = untag_ptr(prev_channel_id);
79404         prev_channel_id_conv.is_owned = ptr_is_owned(prev_channel_id);
79405         CHECK_INNER_FIELD_ACCESS_OR_NULL(prev_channel_id_conv);
79406         prev_channel_id_conv = ChannelId_clone(&prev_channel_id_conv);
79407         void* failed_next_destination_ptr = untag_ptr(failed_next_destination);
79408         CHECK_ACCESS(failed_next_destination_ptr);
79409         LDKHTLCDestination failed_next_destination_conv = *(LDKHTLCDestination*)(failed_next_destination_ptr);
79410         failed_next_destination_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(failed_next_destination));
79411         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79412         *ret_copy = Event_htlchandling_failed(prev_channel_id_conv, failed_next_destination_conv);
79413         uint64_t ret_ref = tag_ptr(ret_copy, true);
79414         return ret_ref;
79415 }
79416
79417 uint64_t  __attribute__((export_name("TS_Event_bump_transaction"))) TS_Event_bump_transaction(uint64_t a) {
79418         void* a_ptr = untag_ptr(a);
79419         CHECK_ACCESS(a_ptr);
79420         LDKBumpTransactionEvent a_conv = *(LDKBumpTransactionEvent*)(a_ptr);
79421         a_conv = BumpTransactionEvent_clone((LDKBumpTransactionEvent*)untag_ptr(a));
79422         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79423         *ret_copy = Event_bump_transaction(a_conv);
79424         uint64_t ret_ref = tag_ptr(ret_copy, true);
79425         return ret_ref;
79426 }
79427
79428 jboolean  __attribute__((export_name("TS_Event_eq"))) TS_Event_eq(uint64_t a, uint64_t b) {
79429         LDKEvent* a_conv = (LDKEvent*)untag_ptr(a);
79430         LDKEvent* b_conv = (LDKEvent*)untag_ptr(b);
79431         jboolean ret_conv = Event_eq(a_conv, b_conv);
79432         return ret_conv;
79433 }
79434
79435 int8_tArray  __attribute__((export_name("TS_Event_write"))) TS_Event_write(uint64_t obj) {
79436         LDKEvent* obj_conv = (LDKEvent*)untag_ptr(obj);
79437         LDKCVec_u8Z ret_var = Event_write(obj_conv);
79438         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
79439         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
79440         CVec_u8Z_free(ret_var);
79441         return ret_arr;
79442 }
79443
79444 uint64_t  __attribute__((export_name("TS_Event_read"))) TS_Event_read(int8_tArray ser) {
79445         LDKu8slice ser_ref;
79446         ser_ref.datalen = ser->arr_len;
79447         ser_ref.data = ser->elems;
79448         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
79449         *ret_conv = Event_read(ser_ref);
79450         FREE(ser);
79451         return tag_ptr(ret_conv, true);
79452 }
79453
79454 void  __attribute__((export_name("TS_MessageSendEvent_free"))) TS_MessageSendEvent_free(uint64_t this_ptr) {
79455         if (!ptr_is_owned(this_ptr)) return;
79456         void* this_ptr_ptr = untag_ptr(this_ptr);
79457         CHECK_ACCESS(this_ptr_ptr);
79458         LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
79459         FREE(untag_ptr(this_ptr));
79460         MessageSendEvent_free(this_ptr_conv);
79461 }
79462
79463 static inline uint64_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
79464         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79465         *ret_copy = MessageSendEvent_clone(arg);
79466         uint64_t ret_ref = tag_ptr(ret_copy, true);
79467         return ret_ref;
79468 }
79469 int64_t  __attribute__((export_name("TS_MessageSendEvent_clone_ptr"))) TS_MessageSendEvent_clone_ptr(uint64_t arg) {
79470         LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)untag_ptr(arg);
79471         int64_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
79472         return ret_conv;
79473 }
79474
79475 uint64_t  __attribute__((export_name("TS_MessageSendEvent_clone"))) TS_MessageSendEvent_clone(uint64_t orig) {
79476         LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)untag_ptr(orig);
79477         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79478         *ret_copy = MessageSendEvent_clone(orig_conv);
79479         uint64_t ret_ref = tag_ptr(ret_copy, true);
79480         return ret_ref;
79481 }
79482
79483 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_accept_channel"))) TS_MessageSendEvent_send_accept_channel(int8_tArray node_id, uint64_t msg) {
79484         LDKPublicKey node_id_ref;
79485         CHECK(node_id->arr_len == 33);
79486         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79487         LDKAcceptChannel msg_conv;
79488         msg_conv.inner = untag_ptr(msg);
79489         msg_conv.is_owned = ptr_is_owned(msg);
79490         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79491         msg_conv = AcceptChannel_clone(&msg_conv);
79492         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79493         *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
79494         uint64_t ret_ref = tag_ptr(ret_copy, true);
79495         return ret_ref;
79496 }
79497
79498 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_accept_channel_v2"))) TS_MessageSendEvent_send_accept_channel_v2(int8_tArray node_id, uint64_t msg) {
79499         LDKPublicKey node_id_ref;
79500         CHECK(node_id->arr_len == 33);
79501         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79502         LDKAcceptChannelV2 msg_conv;
79503         msg_conv.inner = untag_ptr(msg);
79504         msg_conv.is_owned = ptr_is_owned(msg);
79505         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79506         msg_conv = AcceptChannelV2_clone(&msg_conv);
79507         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79508         *ret_copy = MessageSendEvent_send_accept_channel_v2(node_id_ref, msg_conv);
79509         uint64_t ret_ref = tag_ptr(ret_copy, true);
79510         return ret_ref;
79511 }
79512
79513 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_open_channel"))) TS_MessageSendEvent_send_open_channel(int8_tArray node_id, uint64_t msg) {
79514         LDKPublicKey node_id_ref;
79515         CHECK(node_id->arr_len == 33);
79516         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79517         LDKOpenChannel msg_conv;
79518         msg_conv.inner = untag_ptr(msg);
79519         msg_conv.is_owned = ptr_is_owned(msg);
79520         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79521         msg_conv = OpenChannel_clone(&msg_conv);
79522         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79523         *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
79524         uint64_t ret_ref = tag_ptr(ret_copy, true);
79525         return ret_ref;
79526 }
79527
79528 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_open_channel_v2"))) TS_MessageSendEvent_send_open_channel_v2(int8_tArray node_id, uint64_t msg) {
79529         LDKPublicKey node_id_ref;
79530         CHECK(node_id->arr_len == 33);
79531         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79532         LDKOpenChannelV2 msg_conv;
79533         msg_conv.inner = untag_ptr(msg);
79534         msg_conv.is_owned = ptr_is_owned(msg);
79535         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79536         msg_conv = OpenChannelV2_clone(&msg_conv);
79537         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79538         *ret_copy = MessageSendEvent_send_open_channel_v2(node_id_ref, msg_conv);
79539         uint64_t ret_ref = tag_ptr(ret_copy, true);
79540         return ret_ref;
79541 }
79542
79543 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_funding_created"))) TS_MessageSendEvent_send_funding_created(int8_tArray node_id, uint64_t msg) {
79544         LDKPublicKey node_id_ref;
79545         CHECK(node_id->arr_len == 33);
79546         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79547         LDKFundingCreated msg_conv;
79548         msg_conv.inner = untag_ptr(msg);
79549         msg_conv.is_owned = ptr_is_owned(msg);
79550         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79551         msg_conv = FundingCreated_clone(&msg_conv);
79552         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79553         *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
79554         uint64_t ret_ref = tag_ptr(ret_copy, true);
79555         return ret_ref;
79556 }
79557
79558 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_funding_signed"))) TS_MessageSendEvent_send_funding_signed(int8_tArray node_id, uint64_t msg) {
79559         LDKPublicKey node_id_ref;
79560         CHECK(node_id->arr_len == 33);
79561         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79562         LDKFundingSigned msg_conv;
79563         msg_conv.inner = untag_ptr(msg);
79564         msg_conv.is_owned = ptr_is_owned(msg);
79565         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79566         msg_conv = FundingSigned_clone(&msg_conv);
79567         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79568         *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
79569         uint64_t ret_ref = tag_ptr(ret_copy, true);
79570         return ret_ref;
79571 }
79572
79573 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_stfu"))) TS_MessageSendEvent_send_stfu(int8_tArray node_id, uint64_t msg) {
79574         LDKPublicKey node_id_ref;
79575         CHECK(node_id->arr_len == 33);
79576         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79577         LDKStfu msg_conv;
79578         msg_conv.inner = untag_ptr(msg);
79579         msg_conv.is_owned = ptr_is_owned(msg);
79580         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79581         msg_conv = Stfu_clone(&msg_conv);
79582         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79583         *ret_copy = MessageSendEvent_send_stfu(node_id_ref, msg_conv);
79584         uint64_t ret_ref = tag_ptr(ret_copy, true);
79585         return ret_ref;
79586 }
79587
79588 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_splice"))) TS_MessageSendEvent_send_splice(int8_tArray node_id, uint64_t msg) {
79589         LDKPublicKey node_id_ref;
79590         CHECK(node_id->arr_len == 33);
79591         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79592         LDKSplice msg_conv;
79593         msg_conv.inner = untag_ptr(msg);
79594         msg_conv.is_owned = ptr_is_owned(msg);
79595         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79596         msg_conv = Splice_clone(&msg_conv);
79597         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79598         *ret_copy = MessageSendEvent_send_splice(node_id_ref, msg_conv);
79599         uint64_t ret_ref = tag_ptr(ret_copy, true);
79600         return ret_ref;
79601 }
79602
79603 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_splice_ack"))) TS_MessageSendEvent_send_splice_ack(int8_tArray node_id, uint64_t msg) {
79604         LDKPublicKey node_id_ref;
79605         CHECK(node_id->arr_len == 33);
79606         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79607         LDKSpliceAck msg_conv;
79608         msg_conv.inner = untag_ptr(msg);
79609         msg_conv.is_owned = ptr_is_owned(msg);
79610         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79611         msg_conv = SpliceAck_clone(&msg_conv);
79612         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79613         *ret_copy = MessageSendEvent_send_splice_ack(node_id_ref, msg_conv);
79614         uint64_t ret_ref = tag_ptr(ret_copy, true);
79615         return ret_ref;
79616 }
79617
79618 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_splice_locked"))) TS_MessageSendEvent_send_splice_locked(int8_tArray node_id, uint64_t msg) {
79619         LDKPublicKey node_id_ref;
79620         CHECK(node_id->arr_len == 33);
79621         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79622         LDKSpliceLocked msg_conv;
79623         msg_conv.inner = untag_ptr(msg);
79624         msg_conv.is_owned = ptr_is_owned(msg);
79625         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79626         msg_conv = SpliceLocked_clone(&msg_conv);
79627         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79628         *ret_copy = MessageSendEvent_send_splice_locked(node_id_ref, msg_conv);
79629         uint64_t ret_ref = tag_ptr(ret_copy, true);
79630         return ret_ref;
79631 }
79632
79633 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_add_input"))) TS_MessageSendEvent_send_tx_add_input(int8_tArray node_id, uint64_t msg) {
79634         LDKPublicKey node_id_ref;
79635         CHECK(node_id->arr_len == 33);
79636         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79637         LDKTxAddInput msg_conv;
79638         msg_conv.inner = untag_ptr(msg);
79639         msg_conv.is_owned = ptr_is_owned(msg);
79640         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79641         msg_conv = TxAddInput_clone(&msg_conv);
79642         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79643         *ret_copy = MessageSendEvent_send_tx_add_input(node_id_ref, msg_conv);
79644         uint64_t ret_ref = tag_ptr(ret_copy, true);
79645         return ret_ref;
79646 }
79647
79648 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_add_output"))) TS_MessageSendEvent_send_tx_add_output(int8_tArray node_id, uint64_t msg) {
79649         LDKPublicKey node_id_ref;
79650         CHECK(node_id->arr_len == 33);
79651         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79652         LDKTxAddOutput msg_conv;
79653         msg_conv.inner = untag_ptr(msg);
79654         msg_conv.is_owned = ptr_is_owned(msg);
79655         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79656         msg_conv = TxAddOutput_clone(&msg_conv);
79657         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79658         *ret_copy = MessageSendEvent_send_tx_add_output(node_id_ref, msg_conv);
79659         uint64_t ret_ref = tag_ptr(ret_copy, true);
79660         return ret_ref;
79661 }
79662
79663 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_remove_input"))) TS_MessageSendEvent_send_tx_remove_input(int8_tArray node_id, uint64_t msg) {
79664         LDKPublicKey node_id_ref;
79665         CHECK(node_id->arr_len == 33);
79666         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79667         LDKTxRemoveInput msg_conv;
79668         msg_conv.inner = untag_ptr(msg);
79669         msg_conv.is_owned = ptr_is_owned(msg);
79670         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79671         msg_conv = TxRemoveInput_clone(&msg_conv);
79672         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79673         *ret_copy = MessageSendEvent_send_tx_remove_input(node_id_ref, msg_conv);
79674         uint64_t ret_ref = tag_ptr(ret_copy, true);
79675         return ret_ref;
79676 }
79677
79678 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_remove_output"))) TS_MessageSendEvent_send_tx_remove_output(int8_tArray node_id, uint64_t msg) {
79679         LDKPublicKey node_id_ref;
79680         CHECK(node_id->arr_len == 33);
79681         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79682         LDKTxRemoveOutput msg_conv;
79683         msg_conv.inner = untag_ptr(msg);
79684         msg_conv.is_owned = ptr_is_owned(msg);
79685         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79686         msg_conv = TxRemoveOutput_clone(&msg_conv);
79687         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79688         *ret_copy = MessageSendEvent_send_tx_remove_output(node_id_ref, msg_conv);
79689         uint64_t ret_ref = tag_ptr(ret_copy, true);
79690         return ret_ref;
79691 }
79692
79693 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_complete"))) TS_MessageSendEvent_send_tx_complete(int8_tArray node_id, uint64_t msg) {
79694         LDKPublicKey node_id_ref;
79695         CHECK(node_id->arr_len == 33);
79696         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79697         LDKTxComplete msg_conv;
79698         msg_conv.inner = untag_ptr(msg);
79699         msg_conv.is_owned = ptr_is_owned(msg);
79700         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79701         msg_conv = TxComplete_clone(&msg_conv);
79702         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79703         *ret_copy = MessageSendEvent_send_tx_complete(node_id_ref, msg_conv);
79704         uint64_t ret_ref = tag_ptr(ret_copy, true);
79705         return ret_ref;
79706 }
79707
79708 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_signatures"))) TS_MessageSendEvent_send_tx_signatures(int8_tArray node_id, uint64_t msg) {
79709         LDKPublicKey node_id_ref;
79710         CHECK(node_id->arr_len == 33);
79711         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79712         LDKTxSignatures msg_conv;
79713         msg_conv.inner = untag_ptr(msg);
79714         msg_conv.is_owned = ptr_is_owned(msg);
79715         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79716         msg_conv = TxSignatures_clone(&msg_conv);
79717         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79718         *ret_copy = MessageSendEvent_send_tx_signatures(node_id_ref, msg_conv);
79719         uint64_t ret_ref = tag_ptr(ret_copy, true);
79720         return ret_ref;
79721 }
79722
79723 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_init_rbf"))) TS_MessageSendEvent_send_tx_init_rbf(int8_tArray node_id, uint64_t msg) {
79724         LDKPublicKey node_id_ref;
79725         CHECK(node_id->arr_len == 33);
79726         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79727         LDKTxInitRbf msg_conv;
79728         msg_conv.inner = untag_ptr(msg);
79729         msg_conv.is_owned = ptr_is_owned(msg);
79730         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79731         msg_conv = TxInitRbf_clone(&msg_conv);
79732         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79733         *ret_copy = MessageSendEvent_send_tx_init_rbf(node_id_ref, msg_conv);
79734         uint64_t ret_ref = tag_ptr(ret_copy, true);
79735         return ret_ref;
79736 }
79737
79738 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_ack_rbf"))) TS_MessageSendEvent_send_tx_ack_rbf(int8_tArray node_id, uint64_t msg) {
79739         LDKPublicKey node_id_ref;
79740         CHECK(node_id->arr_len == 33);
79741         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79742         LDKTxAckRbf msg_conv;
79743         msg_conv.inner = untag_ptr(msg);
79744         msg_conv.is_owned = ptr_is_owned(msg);
79745         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79746         msg_conv = TxAckRbf_clone(&msg_conv);
79747         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79748         *ret_copy = MessageSendEvent_send_tx_ack_rbf(node_id_ref, msg_conv);
79749         uint64_t ret_ref = tag_ptr(ret_copy, true);
79750         return ret_ref;
79751 }
79752
79753 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_abort"))) TS_MessageSendEvent_send_tx_abort(int8_tArray node_id, uint64_t msg) {
79754         LDKPublicKey node_id_ref;
79755         CHECK(node_id->arr_len == 33);
79756         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79757         LDKTxAbort msg_conv;
79758         msg_conv.inner = untag_ptr(msg);
79759         msg_conv.is_owned = ptr_is_owned(msg);
79760         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79761         msg_conv = TxAbort_clone(&msg_conv);
79762         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79763         *ret_copy = MessageSendEvent_send_tx_abort(node_id_ref, msg_conv);
79764         uint64_t ret_ref = tag_ptr(ret_copy, true);
79765         return ret_ref;
79766 }
79767
79768 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_ready"))) TS_MessageSendEvent_send_channel_ready(int8_tArray node_id, uint64_t msg) {
79769         LDKPublicKey node_id_ref;
79770         CHECK(node_id->arr_len == 33);
79771         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79772         LDKChannelReady msg_conv;
79773         msg_conv.inner = untag_ptr(msg);
79774         msg_conv.is_owned = ptr_is_owned(msg);
79775         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79776         msg_conv = ChannelReady_clone(&msg_conv);
79777         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79778         *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
79779         uint64_t ret_ref = tag_ptr(ret_copy, true);
79780         return ret_ref;
79781 }
79782
79783 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_announcement_signatures"))) TS_MessageSendEvent_send_announcement_signatures(int8_tArray node_id, uint64_t msg) {
79784         LDKPublicKey node_id_ref;
79785         CHECK(node_id->arr_len == 33);
79786         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79787         LDKAnnouncementSignatures msg_conv;
79788         msg_conv.inner = untag_ptr(msg);
79789         msg_conv.is_owned = ptr_is_owned(msg);
79790         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79791         msg_conv = AnnouncementSignatures_clone(&msg_conv);
79792         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79793         *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
79794         uint64_t ret_ref = tag_ptr(ret_copy, true);
79795         return ret_ref;
79796 }
79797
79798 uint64_t  __attribute__((export_name("TS_MessageSendEvent_update_htlcs"))) TS_MessageSendEvent_update_htlcs(int8_tArray node_id, uint64_t updates) {
79799         LDKPublicKey node_id_ref;
79800         CHECK(node_id->arr_len == 33);
79801         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79802         LDKCommitmentUpdate updates_conv;
79803         updates_conv.inner = untag_ptr(updates);
79804         updates_conv.is_owned = ptr_is_owned(updates);
79805         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
79806         updates_conv = CommitmentUpdate_clone(&updates_conv);
79807         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79808         *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
79809         uint64_t ret_ref = tag_ptr(ret_copy, true);
79810         return ret_ref;
79811 }
79812
79813 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_revoke_and_ack"))) TS_MessageSendEvent_send_revoke_and_ack(int8_tArray node_id, uint64_t msg) {
79814         LDKPublicKey node_id_ref;
79815         CHECK(node_id->arr_len == 33);
79816         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79817         LDKRevokeAndACK msg_conv;
79818         msg_conv.inner = untag_ptr(msg);
79819         msg_conv.is_owned = ptr_is_owned(msg);
79820         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79821         msg_conv = RevokeAndACK_clone(&msg_conv);
79822         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79823         *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
79824         uint64_t ret_ref = tag_ptr(ret_copy, true);
79825         return ret_ref;
79826 }
79827
79828 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_closing_signed"))) TS_MessageSendEvent_send_closing_signed(int8_tArray node_id, uint64_t msg) {
79829         LDKPublicKey node_id_ref;
79830         CHECK(node_id->arr_len == 33);
79831         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79832         LDKClosingSigned msg_conv;
79833         msg_conv.inner = untag_ptr(msg);
79834         msg_conv.is_owned = ptr_is_owned(msg);
79835         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79836         msg_conv = ClosingSigned_clone(&msg_conv);
79837         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79838         *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
79839         uint64_t ret_ref = tag_ptr(ret_copy, true);
79840         return ret_ref;
79841 }
79842
79843 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_shutdown"))) TS_MessageSendEvent_send_shutdown(int8_tArray node_id, uint64_t msg) {
79844         LDKPublicKey node_id_ref;
79845         CHECK(node_id->arr_len == 33);
79846         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79847         LDKShutdown msg_conv;
79848         msg_conv.inner = untag_ptr(msg);
79849         msg_conv.is_owned = ptr_is_owned(msg);
79850         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79851         msg_conv = Shutdown_clone(&msg_conv);
79852         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79853         *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
79854         uint64_t ret_ref = tag_ptr(ret_copy, true);
79855         return ret_ref;
79856 }
79857
79858 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_reestablish"))) TS_MessageSendEvent_send_channel_reestablish(int8_tArray node_id, uint64_t msg) {
79859         LDKPublicKey node_id_ref;
79860         CHECK(node_id->arr_len == 33);
79861         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79862         LDKChannelReestablish msg_conv;
79863         msg_conv.inner = untag_ptr(msg);
79864         msg_conv.is_owned = ptr_is_owned(msg);
79865         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79866         msg_conv = ChannelReestablish_clone(&msg_conv);
79867         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79868         *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
79869         uint64_t ret_ref = tag_ptr(ret_copy, true);
79870         return ret_ref;
79871 }
79872
79873 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) {
79874         LDKPublicKey node_id_ref;
79875         CHECK(node_id->arr_len == 33);
79876         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79877         LDKChannelAnnouncement msg_conv;
79878         msg_conv.inner = untag_ptr(msg);
79879         msg_conv.is_owned = ptr_is_owned(msg);
79880         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79881         msg_conv = ChannelAnnouncement_clone(&msg_conv);
79882         LDKChannelUpdate update_msg_conv;
79883         update_msg_conv.inner = untag_ptr(update_msg);
79884         update_msg_conv.is_owned = ptr_is_owned(update_msg);
79885         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
79886         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
79887         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79888         *ret_copy = MessageSendEvent_send_channel_announcement(node_id_ref, msg_conv, update_msg_conv);
79889         uint64_t ret_ref = tag_ptr(ret_copy, true);
79890         return ret_ref;
79891 }
79892
79893 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_announcement"))) TS_MessageSendEvent_broadcast_channel_announcement(uint64_t msg, uint64_t update_msg) {
79894         LDKChannelAnnouncement msg_conv;
79895         msg_conv.inner = untag_ptr(msg);
79896         msg_conv.is_owned = ptr_is_owned(msg);
79897         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79898         msg_conv = ChannelAnnouncement_clone(&msg_conv);
79899         LDKChannelUpdate update_msg_conv;
79900         update_msg_conv.inner = untag_ptr(update_msg);
79901         update_msg_conv.is_owned = ptr_is_owned(update_msg);
79902         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
79903         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
79904         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79905         *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
79906         uint64_t ret_ref = tag_ptr(ret_copy, true);
79907         return ret_ref;
79908 }
79909
79910 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_update"))) TS_MessageSendEvent_broadcast_channel_update(uint64_t msg) {
79911         LDKChannelUpdate msg_conv;
79912         msg_conv.inner = untag_ptr(msg);
79913         msg_conv.is_owned = ptr_is_owned(msg);
79914         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79915         msg_conv = ChannelUpdate_clone(&msg_conv);
79916         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79917         *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
79918         uint64_t ret_ref = tag_ptr(ret_copy, true);
79919         return ret_ref;
79920 }
79921
79922 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_node_announcement"))) TS_MessageSendEvent_broadcast_node_announcement(uint64_t msg) {
79923         LDKNodeAnnouncement msg_conv;
79924         msg_conv.inner = untag_ptr(msg);
79925         msg_conv.is_owned = ptr_is_owned(msg);
79926         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79927         msg_conv = NodeAnnouncement_clone(&msg_conv);
79928         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79929         *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
79930         uint64_t ret_ref = tag_ptr(ret_copy, true);
79931         return ret_ref;
79932 }
79933
79934 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_update"))) TS_MessageSendEvent_send_channel_update(int8_tArray node_id, uint64_t msg) {
79935         LDKPublicKey node_id_ref;
79936         CHECK(node_id->arr_len == 33);
79937         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79938         LDKChannelUpdate msg_conv;
79939         msg_conv.inner = untag_ptr(msg);
79940         msg_conv.is_owned = ptr_is_owned(msg);
79941         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79942         msg_conv = ChannelUpdate_clone(&msg_conv);
79943         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79944         *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
79945         uint64_t ret_ref = tag_ptr(ret_copy, true);
79946         return ret_ref;
79947 }
79948
79949 uint64_t  __attribute__((export_name("TS_MessageSendEvent_handle_error"))) TS_MessageSendEvent_handle_error(int8_tArray node_id, uint64_t action) {
79950         LDKPublicKey node_id_ref;
79951         CHECK(node_id->arr_len == 33);
79952         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79953         void* action_ptr = untag_ptr(action);
79954         CHECK_ACCESS(action_ptr);
79955         LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
79956         action_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action));
79957         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79958         *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
79959         uint64_t ret_ref = tag_ptr(ret_copy, true);
79960         return ret_ref;
79961 }
79962
79963 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_range_query"))) TS_MessageSendEvent_send_channel_range_query(int8_tArray node_id, uint64_t msg) {
79964         LDKPublicKey node_id_ref;
79965         CHECK(node_id->arr_len == 33);
79966         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79967         LDKQueryChannelRange msg_conv;
79968         msg_conv.inner = untag_ptr(msg);
79969         msg_conv.is_owned = ptr_is_owned(msg);
79970         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79971         msg_conv = QueryChannelRange_clone(&msg_conv);
79972         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79973         *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
79974         uint64_t ret_ref = tag_ptr(ret_copy, true);
79975         return ret_ref;
79976 }
79977
79978 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_short_ids_query"))) TS_MessageSendEvent_send_short_ids_query(int8_tArray node_id, uint64_t msg) {
79979         LDKPublicKey node_id_ref;
79980         CHECK(node_id->arr_len == 33);
79981         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79982         LDKQueryShortChannelIds msg_conv;
79983         msg_conv.inner = untag_ptr(msg);
79984         msg_conv.is_owned = ptr_is_owned(msg);
79985         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
79986         msg_conv = QueryShortChannelIds_clone(&msg_conv);
79987         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
79988         *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
79989         uint64_t ret_ref = tag_ptr(ret_copy, true);
79990         return ret_ref;
79991 }
79992
79993 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_reply_channel_range"))) TS_MessageSendEvent_send_reply_channel_range(int8_tArray node_id, uint64_t msg) {
79994         LDKPublicKey node_id_ref;
79995         CHECK(node_id->arr_len == 33);
79996         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79997         LDKReplyChannelRange msg_conv;
79998         msg_conv.inner = untag_ptr(msg);
79999         msg_conv.is_owned = ptr_is_owned(msg);
80000         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
80001         msg_conv = ReplyChannelRange_clone(&msg_conv);
80002         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
80003         *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
80004         uint64_t ret_ref = tag_ptr(ret_copy, true);
80005         return ret_ref;
80006 }
80007
80008 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_gossip_timestamp_filter"))) TS_MessageSendEvent_send_gossip_timestamp_filter(int8_tArray node_id, uint64_t msg) {
80009         LDKPublicKey node_id_ref;
80010         CHECK(node_id->arr_len == 33);
80011         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
80012         LDKGossipTimestampFilter msg_conv;
80013         msg_conv.inner = untag_ptr(msg);
80014         msg_conv.is_owned = ptr_is_owned(msg);
80015         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
80016         msg_conv = GossipTimestampFilter_clone(&msg_conv);
80017         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
80018         *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
80019         uint64_t ret_ref = tag_ptr(ret_copy, true);
80020         return ret_ref;
80021 }
80022
80023 void  __attribute__((export_name("TS_MessageSendEventsProvider_free"))) TS_MessageSendEventsProvider_free(uint64_t this_ptr) {
80024         if (!ptr_is_owned(this_ptr)) return;
80025         void* this_ptr_ptr = untag_ptr(this_ptr);
80026         CHECK_ACCESS(this_ptr_ptr);
80027         LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
80028         FREE(untag_ptr(this_ptr));
80029         MessageSendEventsProvider_free(this_ptr_conv);
80030 }
80031
80032 void  __attribute__((export_name("TS_EventsProvider_free"))) TS_EventsProvider_free(uint64_t this_ptr) {
80033         if (!ptr_is_owned(this_ptr)) return;
80034         void* this_ptr_ptr = untag_ptr(this_ptr);
80035         CHECK_ACCESS(this_ptr_ptr);
80036         LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
80037         FREE(untag_ptr(this_ptr));
80038         EventsProvider_free(this_ptr_conv);
80039 }
80040
80041 void  __attribute__((export_name("TS_EventHandler_free"))) TS_EventHandler_free(uint64_t this_ptr) {
80042         if (!ptr_is_owned(this_ptr)) return;
80043         void* this_ptr_ptr = untag_ptr(this_ptr);
80044         CHECK_ACCESS(this_ptr_ptr);
80045         LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
80046         FREE(untag_ptr(this_ptr));
80047         EventHandler_free(this_ptr_conv);
80048 }
80049
80050 void  __attribute__((export_name("TS_AnchorDescriptor_free"))) TS_AnchorDescriptor_free(uint64_t this_obj) {
80051         LDKAnchorDescriptor this_obj_conv;
80052         this_obj_conv.inner = untag_ptr(this_obj);
80053         this_obj_conv.is_owned = ptr_is_owned(this_obj);
80054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
80055         AnchorDescriptor_free(this_obj_conv);
80056 }
80057
80058 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_get_channel_derivation_parameters"))) TS_AnchorDescriptor_get_channel_derivation_parameters(uint64_t this_ptr) {
80059         LDKAnchorDescriptor this_ptr_conv;
80060         this_ptr_conv.inner = untag_ptr(this_ptr);
80061         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80063         this_ptr_conv.is_owned = false;
80064         LDKChannelDerivationParameters ret_var = AnchorDescriptor_get_channel_derivation_parameters(&this_ptr_conv);
80065         uint64_t ret_ref = 0;
80066         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80067         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80068         return ret_ref;
80069 }
80070
80071 void  __attribute__((export_name("TS_AnchorDescriptor_set_channel_derivation_parameters"))) TS_AnchorDescriptor_set_channel_derivation_parameters(uint64_t this_ptr, uint64_t val) {
80072         LDKAnchorDescriptor this_ptr_conv;
80073         this_ptr_conv.inner = untag_ptr(this_ptr);
80074         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80076         this_ptr_conv.is_owned = false;
80077         LDKChannelDerivationParameters val_conv;
80078         val_conv.inner = untag_ptr(val);
80079         val_conv.is_owned = ptr_is_owned(val);
80080         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
80081         val_conv = ChannelDerivationParameters_clone(&val_conv);
80082         AnchorDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv);
80083 }
80084
80085 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_get_outpoint"))) TS_AnchorDescriptor_get_outpoint(uint64_t this_ptr) {
80086         LDKAnchorDescriptor this_ptr_conv;
80087         this_ptr_conv.inner = untag_ptr(this_ptr);
80088         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80090         this_ptr_conv.is_owned = false;
80091         LDKOutPoint ret_var = AnchorDescriptor_get_outpoint(&this_ptr_conv);
80092         uint64_t ret_ref = 0;
80093         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80094         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80095         return ret_ref;
80096 }
80097
80098 void  __attribute__((export_name("TS_AnchorDescriptor_set_outpoint"))) TS_AnchorDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
80099         LDKAnchorDescriptor this_ptr_conv;
80100         this_ptr_conv.inner = untag_ptr(this_ptr);
80101         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80103         this_ptr_conv.is_owned = false;
80104         LDKOutPoint val_conv;
80105         val_conv.inner = untag_ptr(val);
80106         val_conv.is_owned = ptr_is_owned(val);
80107         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
80108         val_conv = OutPoint_clone(&val_conv);
80109         AnchorDescriptor_set_outpoint(&this_ptr_conv, val_conv);
80110 }
80111
80112 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_new"))) TS_AnchorDescriptor_new(uint64_t channel_derivation_parameters_arg, uint64_t outpoint_arg) {
80113         LDKChannelDerivationParameters channel_derivation_parameters_arg_conv;
80114         channel_derivation_parameters_arg_conv.inner = untag_ptr(channel_derivation_parameters_arg);
80115         channel_derivation_parameters_arg_conv.is_owned = ptr_is_owned(channel_derivation_parameters_arg);
80116         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_derivation_parameters_arg_conv);
80117         channel_derivation_parameters_arg_conv = ChannelDerivationParameters_clone(&channel_derivation_parameters_arg_conv);
80118         LDKOutPoint outpoint_arg_conv;
80119         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
80120         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
80121         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
80122         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
80123         LDKAnchorDescriptor ret_var = AnchorDescriptor_new(channel_derivation_parameters_arg_conv, outpoint_arg_conv);
80124         uint64_t ret_ref = 0;
80125         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80126         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80127         return ret_ref;
80128 }
80129
80130 static inline uint64_t AnchorDescriptor_clone_ptr(LDKAnchorDescriptor *NONNULL_PTR arg) {
80131         LDKAnchorDescriptor ret_var = AnchorDescriptor_clone(arg);
80132         uint64_t ret_ref = 0;
80133         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80134         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80135         return ret_ref;
80136 }
80137 int64_t  __attribute__((export_name("TS_AnchorDescriptor_clone_ptr"))) TS_AnchorDescriptor_clone_ptr(uint64_t arg) {
80138         LDKAnchorDescriptor arg_conv;
80139         arg_conv.inner = untag_ptr(arg);
80140         arg_conv.is_owned = ptr_is_owned(arg);
80141         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
80142         arg_conv.is_owned = false;
80143         int64_t ret_conv = AnchorDescriptor_clone_ptr(&arg_conv);
80144         return ret_conv;
80145 }
80146
80147 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_clone"))) TS_AnchorDescriptor_clone(uint64_t orig) {
80148         LDKAnchorDescriptor orig_conv;
80149         orig_conv.inner = untag_ptr(orig);
80150         orig_conv.is_owned = ptr_is_owned(orig);
80151         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
80152         orig_conv.is_owned = false;
80153         LDKAnchorDescriptor ret_var = AnchorDescriptor_clone(&orig_conv);
80154         uint64_t ret_ref = 0;
80155         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80156         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80157         return ret_ref;
80158 }
80159
80160 jboolean  __attribute__((export_name("TS_AnchorDescriptor_eq"))) TS_AnchorDescriptor_eq(uint64_t a, uint64_t b) {
80161         LDKAnchorDescriptor a_conv;
80162         a_conv.inner = untag_ptr(a);
80163         a_conv.is_owned = ptr_is_owned(a);
80164         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
80165         a_conv.is_owned = false;
80166         LDKAnchorDescriptor b_conv;
80167         b_conv.inner = untag_ptr(b);
80168         b_conv.is_owned = ptr_is_owned(b);
80169         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
80170         b_conv.is_owned = false;
80171         jboolean ret_conv = AnchorDescriptor_eq(&a_conv, &b_conv);
80172         return ret_conv;
80173 }
80174
80175 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_previous_utxo"))) TS_AnchorDescriptor_previous_utxo(uint64_t this_arg) {
80176         LDKAnchorDescriptor this_arg_conv;
80177         this_arg_conv.inner = untag_ptr(this_arg);
80178         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80180         this_arg_conv.is_owned = false;
80181         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
80182         *ret_ref = AnchorDescriptor_previous_utxo(&this_arg_conv);
80183         return tag_ptr(ret_ref, true);
80184 }
80185
80186 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_unsigned_tx_input"))) TS_AnchorDescriptor_unsigned_tx_input(uint64_t this_arg) {
80187         LDKAnchorDescriptor this_arg_conv;
80188         this_arg_conv.inner = untag_ptr(this_arg);
80189         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80191         this_arg_conv.is_owned = false;
80192         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
80193         *ret_ref = AnchorDescriptor_unsigned_tx_input(&this_arg_conv);
80194         return tag_ptr(ret_ref, true);
80195 }
80196
80197 int8_tArray  __attribute__((export_name("TS_AnchorDescriptor_witness_script"))) TS_AnchorDescriptor_witness_script(uint64_t this_arg) {
80198         LDKAnchorDescriptor this_arg_conv;
80199         this_arg_conv.inner = untag_ptr(this_arg);
80200         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80202         this_arg_conv.is_owned = false;
80203         LDKCVec_u8Z ret_var = AnchorDescriptor_witness_script(&this_arg_conv);
80204         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
80205         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
80206         CVec_u8Z_free(ret_var);
80207         return ret_arr;
80208 }
80209
80210 int8_tArray  __attribute__((export_name("TS_AnchorDescriptor_tx_input_witness"))) TS_AnchorDescriptor_tx_input_witness(uint64_t this_arg, int8_tArray signature) {
80211         LDKAnchorDescriptor this_arg_conv;
80212         this_arg_conv.inner = untag_ptr(this_arg);
80213         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80215         this_arg_conv.is_owned = false;
80216         LDKECDSASignature signature_ref;
80217         CHECK(signature->arr_len == 64);
80218         memcpy(signature_ref.compact_form, signature->elems, 64); FREE(signature);
80219         LDKWitness ret_var = AnchorDescriptor_tx_input_witness(&this_arg_conv, signature_ref);
80220         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
80221         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
80222         Witness_free(ret_var);
80223         return ret_arr;
80224 }
80225
80226 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_derive_channel_signer"))) TS_AnchorDescriptor_derive_channel_signer(uint64_t this_arg, uint64_t signer_provider) {
80227         LDKAnchorDescriptor this_arg_conv;
80228         this_arg_conv.inner = untag_ptr(this_arg);
80229         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80231         this_arg_conv.is_owned = false;
80232         void* signer_provider_ptr = untag_ptr(signer_provider);
80233         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
80234         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
80235         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
80236         *ret_ret = AnchorDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv);
80237         return tag_ptr(ret_ret, true);
80238 }
80239
80240 void  __attribute__((export_name("TS_BumpTransactionEvent_free"))) TS_BumpTransactionEvent_free(uint64_t this_ptr) {
80241         if (!ptr_is_owned(this_ptr)) return;
80242         void* this_ptr_ptr = untag_ptr(this_ptr);
80243         CHECK_ACCESS(this_ptr_ptr);
80244         LDKBumpTransactionEvent this_ptr_conv = *(LDKBumpTransactionEvent*)(this_ptr_ptr);
80245         FREE(untag_ptr(this_ptr));
80246         BumpTransactionEvent_free(this_ptr_conv);
80247 }
80248
80249 static inline uint64_t BumpTransactionEvent_clone_ptr(LDKBumpTransactionEvent *NONNULL_PTR arg) {
80250         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
80251         *ret_copy = BumpTransactionEvent_clone(arg);
80252         uint64_t ret_ref = tag_ptr(ret_copy, true);
80253         return ret_ref;
80254 }
80255 int64_t  __attribute__((export_name("TS_BumpTransactionEvent_clone_ptr"))) TS_BumpTransactionEvent_clone_ptr(uint64_t arg) {
80256         LDKBumpTransactionEvent* arg_conv = (LDKBumpTransactionEvent*)untag_ptr(arg);
80257         int64_t ret_conv = BumpTransactionEvent_clone_ptr(arg_conv);
80258         return ret_conv;
80259 }
80260
80261 uint64_t  __attribute__((export_name("TS_BumpTransactionEvent_clone"))) TS_BumpTransactionEvent_clone(uint64_t orig) {
80262         LDKBumpTransactionEvent* orig_conv = (LDKBumpTransactionEvent*)untag_ptr(orig);
80263         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
80264         *ret_copy = BumpTransactionEvent_clone(orig_conv);
80265         uint64_t ret_ref = tag_ptr(ret_copy, true);
80266         return ret_ref;
80267 }
80268
80269 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) {
80270         LDKChannelId channel_id_conv;
80271         channel_id_conv.inner = untag_ptr(channel_id);
80272         channel_id_conv.is_owned = ptr_is_owned(channel_id);
80273         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
80274         channel_id_conv = ChannelId_clone(&channel_id_conv);
80275         LDKPublicKey counterparty_node_id_ref;
80276         CHECK(counterparty_node_id->arr_len == 33);
80277         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
80278         LDKThirtyTwoBytes claim_id_ref;
80279         CHECK(claim_id->arr_len == 32);
80280         memcpy(claim_id_ref.data, claim_id->elems, 32); FREE(claim_id);
80281         LDKTransaction commitment_tx_ref;
80282         commitment_tx_ref.datalen = commitment_tx->arr_len;
80283         commitment_tx_ref.data = MALLOC(commitment_tx_ref.datalen, "LDKTransaction Bytes");
80284         memcpy(commitment_tx_ref.data, commitment_tx->elems, commitment_tx_ref.datalen); FREE(commitment_tx);
80285         commitment_tx_ref.data_is_owned = true;
80286         LDKAnchorDescriptor anchor_descriptor_conv;
80287         anchor_descriptor_conv.inner = untag_ptr(anchor_descriptor);
80288         anchor_descriptor_conv.is_owned = ptr_is_owned(anchor_descriptor);
80289         CHECK_INNER_FIELD_ACCESS_OR_NULL(anchor_descriptor_conv);
80290         anchor_descriptor_conv = AnchorDescriptor_clone(&anchor_descriptor_conv);
80291         LDKCVec_HTLCOutputInCommitmentZ pending_htlcs_constr;
80292         pending_htlcs_constr.datalen = pending_htlcs->arr_len;
80293         if (pending_htlcs_constr.datalen > 0)
80294                 pending_htlcs_constr.data = MALLOC(pending_htlcs_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
80295         else
80296                 pending_htlcs_constr.data = NULL;
80297         uint64_t* pending_htlcs_vals = pending_htlcs->elems;
80298         for (size_t y = 0; y < pending_htlcs_constr.datalen; y++) {
80299                 uint64_t pending_htlcs_conv_24 = pending_htlcs_vals[y];
80300                 LDKHTLCOutputInCommitment pending_htlcs_conv_24_conv;
80301                 pending_htlcs_conv_24_conv.inner = untag_ptr(pending_htlcs_conv_24);
80302                 pending_htlcs_conv_24_conv.is_owned = ptr_is_owned(pending_htlcs_conv_24);
80303                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_htlcs_conv_24_conv);
80304                 pending_htlcs_conv_24_conv = HTLCOutputInCommitment_clone(&pending_htlcs_conv_24_conv);
80305                 pending_htlcs_constr.data[y] = pending_htlcs_conv_24_conv;
80306         }
80307         FREE(pending_htlcs);
80308         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
80309         *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);
80310         uint64_t ret_ref = tag_ptr(ret_copy, true);
80311         return ret_ref;
80312 }
80313
80314 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) {
80315         LDKChannelId channel_id_conv;
80316         channel_id_conv.inner = untag_ptr(channel_id);
80317         channel_id_conv.is_owned = ptr_is_owned(channel_id);
80318         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
80319         channel_id_conv = ChannelId_clone(&channel_id_conv);
80320         LDKPublicKey counterparty_node_id_ref;
80321         CHECK(counterparty_node_id->arr_len == 33);
80322         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
80323         LDKThirtyTwoBytes claim_id_ref;
80324         CHECK(claim_id->arr_len == 32);
80325         memcpy(claim_id_ref.data, claim_id->elems, 32); FREE(claim_id);
80326         LDKCVec_HTLCDescriptorZ htlc_descriptors_constr;
80327         htlc_descriptors_constr.datalen = htlc_descriptors->arr_len;
80328         if (htlc_descriptors_constr.datalen > 0)
80329                 htlc_descriptors_constr.data = MALLOC(htlc_descriptors_constr.datalen * sizeof(LDKHTLCDescriptor), "LDKCVec_HTLCDescriptorZ Elements");
80330         else
80331                 htlc_descriptors_constr.data = NULL;
80332         uint64_t* htlc_descriptors_vals = htlc_descriptors->elems;
80333         for (size_t q = 0; q < htlc_descriptors_constr.datalen; q++) {
80334                 uint64_t htlc_descriptors_conv_16 = htlc_descriptors_vals[q];
80335                 LDKHTLCDescriptor htlc_descriptors_conv_16_conv;
80336                 htlc_descriptors_conv_16_conv.inner = untag_ptr(htlc_descriptors_conv_16);
80337                 htlc_descriptors_conv_16_conv.is_owned = ptr_is_owned(htlc_descriptors_conv_16);
80338                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptors_conv_16_conv);
80339                 htlc_descriptors_conv_16_conv = HTLCDescriptor_clone(&htlc_descriptors_conv_16_conv);
80340                 htlc_descriptors_constr.data[q] = htlc_descriptors_conv_16_conv;
80341         }
80342         FREE(htlc_descriptors);
80343         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
80344         *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);
80345         uint64_t ret_ref = tag_ptr(ret_copy, true);
80346         return ret_ref;
80347 }
80348
80349 jboolean  __attribute__((export_name("TS_BumpTransactionEvent_eq"))) TS_BumpTransactionEvent_eq(uint64_t a, uint64_t b) {
80350         LDKBumpTransactionEvent* a_conv = (LDKBumpTransactionEvent*)untag_ptr(a);
80351         LDKBumpTransactionEvent* b_conv = (LDKBumpTransactionEvent*)untag_ptr(b);
80352         jboolean ret_conv = BumpTransactionEvent_eq(a_conv, b_conv);
80353         return ret_conv;
80354 }
80355
80356 void  __attribute__((export_name("TS_Input_free"))) TS_Input_free(uint64_t this_obj) {
80357         LDKInput this_obj_conv;
80358         this_obj_conv.inner = untag_ptr(this_obj);
80359         this_obj_conv.is_owned = ptr_is_owned(this_obj);
80360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
80361         Input_free(this_obj_conv);
80362 }
80363
80364 uint64_t  __attribute__((export_name("TS_Input_get_outpoint"))) TS_Input_get_outpoint(uint64_t this_ptr) {
80365         LDKInput this_ptr_conv;
80366         this_ptr_conv.inner = untag_ptr(this_ptr);
80367         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80369         this_ptr_conv.is_owned = false;
80370         LDKOutPoint ret_var = Input_get_outpoint(&this_ptr_conv);
80371         uint64_t ret_ref = 0;
80372         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80373         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80374         return ret_ref;
80375 }
80376
80377 void  __attribute__((export_name("TS_Input_set_outpoint"))) TS_Input_set_outpoint(uint64_t this_ptr, uint64_t val) {
80378         LDKInput this_ptr_conv;
80379         this_ptr_conv.inner = untag_ptr(this_ptr);
80380         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80382         this_ptr_conv.is_owned = false;
80383         LDKOutPoint val_conv;
80384         val_conv.inner = untag_ptr(val);
80385         val_conv.is_owned = ptr_is_owned(val);
80386         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
80387         val_conv = OutPoint_clone(&val_conv);
80388         Input_set_outpoint(&this_ptr_conv, val_conv);
80389 }
80390
80391 uint64_t  __attribute__((export_name("TS_Input_get_previous_utxo"))) TS_Input_get_previous_utxo(uint64_t this_ptr) {
80392         LDKInput this_ptr_conv;
80393         this_ptr_conv.inner = untag_ptr(this_ptr);
80394         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80396         this_ptr_conv.is_owned = false;
80397         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
80398         *ret_ref = Input_get_previous_utxo(&this_ptr_conv);
80399         return tag_ptr(ret_ref, true);
80400 }
80401
80402 void  __attribute__((export_name("TS_Input_set_previous_utxo"))) TS_Input_set_previous_utxo(uint64_t this_ptr, uint64_t val) {
80403         LDKInput this_ptr_conv;
80404         this_ptr_conv.inner = untag_ptr(this_ptr);
80405         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80407         this_ptr_conv.is_owned = false;
80408         void* val_ptr = untag_ptr(val);
80409         CHECK_ACCESS(val_ptr);
80410         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
80411         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
80412         Input_set_previous_utxo(&this_ptr_conv, val_conv);
80413 }
80414
80415 int64_t  __attribute__((export_name("TS_Input_get_satisfaction_weight"))) TS_Input_get_satisfaction_weight(uint64_t this_ptr) {
80416         LDKInput this_ptr_conv;
80417         this_ptr_conv.inner = untag_ptr(this_ptr);
80418         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80420         this_ptr_conv.is_owned = false;
80421         int64_t ret_conv = Input_get_satisfaction_weight(&this_ptr_conv);
80422         return ret_conv;
80423 }
80424
80425 void  __attribute__((export_name("TS_Input_set_satisfaction_weight"))) TS_Input_set_satisfaction_weight(uint64_t this_ptr, int64_t val) {
80426         LDKInput this_ptr_conv;
80427         this_ptr_conv.inner = untag_ptr(this_ptr);
80428         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80430         this_ptr_conv.is_owned = false;
80431         Input_set_satisfaction_weight(&this_ptr_conv, val);
80432 }
80433
80434 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) {
80435         LDKOutPoint outpoint_arg_conv;
80436         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
80437         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
80438         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
80439         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
80440         void* previous_utxo_arg_ptr = untag_ptr(previous_utxo_arg);
80441         CHECK_ACCESS(previous_utxo_arg_ptr);
80442         LDKTxOut previous_utxo_arg_conv = *(LDKTxOut*)(previous_utxo_arg_ptr);
80443         previous_utxo_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(previous_utxo_arg));
80444         LDKInput ret_var = Input_new(outpoint_arg_conv, previous_utxo_arg_conv, satisfaction_weight_arg);
80445         uint64_t ret_ref = 0;
80446         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80447         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80448         return ret_ref;
80449 }
80450
80451 static inline uint64_t Input_clone_ptr(LDKInput *NONNULL_PTR arg) {
80452         LDKInput ret_var = Input_clone(arg);
80453         uint64_t ret_ref = 0;
80454         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80455         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80456         return ret_ref;
80457 }
80458 int64_t  __attribute__((export_name("TS_Input_clone_ptr"))) TS_Input_clone_ptr(uint64_t arg) {
80459         LDKInput arg_conv;
80460         arg_conv.inner = untag_ptr(arg);
80461         arg_conv.is_owned = ptr_is_owned(arg);
80462         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
80463         arg_conv.is_owned = false;
80464         int64_t ret_conv = Input_clone_ptr(&arg_conv);
80465         return ret_conv;
80466 }
80467
80468 uint64_t  __attribute__((export_name("TS_Input_clone"))) TS_Input_clone(uint64_t orig) {
80469         LDKInput orig_conv;
80470         orig_conv.inner = untag_ptr(orig);
80471         orig_conv.is_owned = ptr_is_owned(orig);
80472         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
80473         orig_conv.is_owned = false;
80474         LDKInput ret_var = Input_clone(&orig_conv);
80475         uint64_t ret_ref = 0;
80476         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80477         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80478         return ret_ref;
80479 }
80480
80481 int64_t  __attribute__((export_name("TS_Input_hash"))) TS_Input_hash(uint64_t o) {
80482         LDKInput o_conv;
80483         o_conv.inner = untag_ptr(o);
80484         o_conv.is_owned = ptr_is_owned(o);
80485         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
80486         o_conv.is_owned = false;
80487         int64_t ret_conv = Input_hash(&o_conv);
80488         return ret_conv;
80489 }
80490
80491 jboolean  __attribute__((export_name("TS_Input_eq"))) TS_Input_eq(uint64_t a, uint64_t b) {
80492         LDKInput a_conv;
80493         a_conv.inner = untag_ptr(a);
80494         a_conv.is_owned = ptr_is_owned(a);
80495         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
80496         a_conv.is_owned = false;
80497         LDKInput b_conv;
80498         b_conv.inner = untag_ptr(b);
80499         b_conv.is_owned = ptr_is_owned(b);
80500         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
80501         b_conv.is_owned = false;
80502         jboolean ret_conv = Input_eq(&a_conv, &b_conv);
80503         return ret_conv;
80504 }
80505
80506 void  __attribute__((export_name("TS_Utxo_free"))) TS_Utxo_free(uint64_t this_obj) {
80507         LDKUtxo this_obj_conv;
80508         this_obj_conv.inner = untag_ptr(this_obj);
80509         this_obj_conv.is_owned = ptr_is_owned(this_obj);
80510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
80511         Utxo_free(this_obj_conv);
80512 }
80513
80514 uint64_t  __attribute__((export_name("TS_Utxo_get_outpoint"))) TS_Utxo_get_outpoint(uint64_t this_ptr) {
80515         LDKUtxo this_ptr_conv;
80516         this_ptr_conv.inner = untag_ptr(this_ptr);
80517         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80519         this_ptr_conv.is_owned = false;
80520         LDKOutPoint ret_var = Utxo_get_outpoint(&this_ptr_conv);
80521         uint64_t ret_ref = 0;
80522         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80523         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80524         return ret_ref;
80525 }
80526
80527 void  __attribute__((export_name("TS_Utxo_set_outpoint"))) TS_Utxo_set_outpoint(uint64_t this_ptr, uint64_t val) {
80528         LDKUtxo this_ptr_conv;
80529         this_ptr_conv.inner = untag_ptr(this_ptr);
80530         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80532         this_ptr_conv.is_owned = false;
80533         LDKOutPoint val_conv;
80534         val_conv.inner = untag_ptr(val);
80535         val_conv.is_owned = ptr_is_owned(val);
80536         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
80537         val_conv = OutPoint_clone(&val_conv);
80538         Utxo_set_outpoint(&this_ptr_conv, val_conv);
80539 }
80540
80541 uint64_t  __attribute__((export_name("TS_Utxo_get_output"))) TS_Utxo_get_output(uint64_t this_ptr) {
80542         LDKUtxo this_ptr_conv;
80543         this_ptr_conv.inner = untag_ptr(this_ptr);
80544         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80546         this_ptr_conv.is_owned = false;
80547         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
80548         *ret_ref = Utxo_get_output(&this_ptr_conv);
80549         return tag_ptr(ret_ref, true);
80550 }
80551
80552 void  __attribute__((export_name("TS_Utxo_set_output"))) TS_Utxo_set_output(uint64_t this_ptr, uint64_t val) {
80553         LDKUtxo this_ptr_conv;
80554         this_ptr_conv.inner = untag_ptr(this_ptr);
80555         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80557         this_ptr_conv.is_owned = false;
80558         void* val_ptr = untag_ptr(val);
80559         CHECK_ACCESS(val_ptr);
80560         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
80561         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
80562         Utxo_set_output(&this_ptr_conv, val_conv);
80563 }
80564
80565 int64_t  __attribute__((export_name("TS_Utxo_get_satisfaction_weight"))) TS_Utxo_get_satisfaction_weight(uint64_t this_ptr) {
80566         LDKUtxo this_ptr_conv;
80567         this_ptr_conv.inner = untag_ptr(this_ptr);
80568         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80570         this_ptr_conv.is_owned = false;
80571         int64_t ret_conv = Utxo_get_satisfaction_weight(&this_ptr_conv);
80572         return ret_conv;
80573 }
80574
80575 void  __attribute__((export_name("TS_Utxo_set_satisfaction_weight"))) TS_Utxo_set_satisfaction_weight(uint64_t this_ptr, int64_t val) {
80576         LDKUtxo this_ptr_conv;
80577         this_ptr_conv.inner = untag_ptr(this_ptr);
80578         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80580         this_ptr_conv.is_owned = false;
80581         Utxo_set_satisfaction_weight(&this_ptr_conv, val);
80582 }
80583
80584 uint64_t  __attribute__((export_name("TS_Utxo_new"))) TS_Utxo_new(uint64_t outpoint_arg, uint64_t output_arg, int64_t satisfaction_weight_arg) {
80585         LDKOutPoint outpoint_arg_conv;
80586         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
80587         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
80588         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
80589         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
80590         void* output_arg_ptr = untag_ptr(output_arg);
80591         CHECK_ACCESS(output_arg_ptr);
80592         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
80593         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
80594         LDKUtxo ret_var = Utxo_new(outpoint_arg_conv, output_arg_conv, satisfaction_weight_arg);
80595         uint64_t ret_ref = 0;
80596         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80597         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80598         return ret_ref;
80599 }
80600
80601 static inline uint64_t Utxo_clone_ptr(LDKUtxo *NONNULL_PTR arg) {
80602         LDKUtxo ret_var = Utxo_clone(arg);
80603         uint64_t ret_ref = 0;
80604         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80605         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80606         return ret_ref;
80607 }
80608 int64_t  __attribute__((export_name("TS_Utxo_clone_ptr"))) TS_Utxo_clone_ptr(uint64_t arg) {
80609         LDKUtxo arg_conv;
80610         arg_conv.inner = untag_ptr(arg);
80611         arg_conv.is_owned = ptr_is_owned(arg);
80612         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
80613         arg_conv.is_owned = false;
80614         int64_t ret_conv = Utxo_clone_ptr(&arg_conv);
80615         return ret_conv;
80616 }
80617
80618 uint64_t  __attribute__((export_name("TS_Utxo_clone"))) TS_Utxo_clone(uint64_t orig) {
80619         LDKUtxo orig_conv;
80620         orig_conv.inner = untag_ptr(orig);
80621         orig_conv.is_owned = ptr_is_owned(orig);
80622         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
80623         orig_conv.is_owned = false;
80624         LDKUtxo ret_var = Utxo_clone(&orig_conv);
80625         uint64_t ret_ref = 0;
80626         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80627         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80628         return ret_ref;
80629 }
80630
80631 int64_t  __attribute__((export_name("TS_Utxo_hash"))) TS_Utxo_hash(uint64_t o) {
80632         LDKUtxo o_conv;
80633         o_conv.inner = untag_ptr(o);
80634         o_conv.is_owned = ptr_is_owned(o);
80635         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
80636         o_conv.is_owned = false;
80637         int64_t ret_conv = Utxo_hash(&o_conv);
80638         return ret_conv;
80639 }
80640
80641 jboolean  __attribute__((export_name("TS_Utxo_eq"))) TS_Utxo_eq(uint64_t a, uint64_t b) {
80642         LDKUtxo a_conv;
80643         a_conv.inner = untag_ptr(a);
80644         a_conv.is_owned = ptr_is_owned(a);
80645         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
80646         a_conv.is_owned = false;
80647         LDKUtxo b_conv;
80648         b_conv.inner = untag_ptr(b);
80649         b_conv.is_owned = ptr_is_owned(b);
80650         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
80651         b_conv.is_owned = false;
80652         jboolean ret_conv = Utxo_eq(&a_conv, &b_conv);
80653         return ret_conv;
80654 }
80655
80656 uint64_t  __attribute__((export_name("TS_Utxo_new_p2pkh"))) TS_Utxo_new_p2pkh(uint64_t outpoint, int64_t value, int8_tArray pubkey_hash) {
80657         LDKOutPoint outpoint_conv;
80658         outpoint_conv.inner = untag_ptr(outpoint);
80659         outpoint_conv.is_owned = ptr_is_owned(outpoint);
80660         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
80661         outpoint_conv = OutPoint_clone(&outpoint_conv);
80662         uint8_t pubkey_hash_arr[20];
80663         CHECK(pubkey_hash->arr_len == 20);
80664         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
80665         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
80666         LDKUtxo ret_var = Utxo_new_p2pkh(outpoint_conv, value, pubkey_hash_ref);
80667         uint64_t ret_ref = 0;
80668         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80669         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80670         return ret_ref;
80671 }
80672
80673 void  __attribute__((export_name("TS_CoinSelection_free"))) TS_CoinSelection_free(uint64_t this_obj) {
80674         LDKCoinSelection this_obj_conv;
80675         this_obj_conv.inner = untag_ptr(this_obj);
80676         this_obj_conv.is_owned = ptr_is_owned(this_obj);
80677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
80678         CoinSelection_free(this_obj_conv);
80679 }
80680
80681 uint64_tArray  __attribute__((export_name("TS_CoinSelection_get_confirmed_utxos"))) TS_CoinSelection_get_confirmed_utxos(uint64_t this_ptr) {
80682         LDKCoinSelection this_ptr_conv;
80683         this_ptr_conv.inner = untag_ptr(this_ptr);
80684         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80686         this_ptr_conv.is_owned = false;
80687         LDKCVec_UtxoZ ret_var = CoinSelection_get_confirmed_utxos(&this_ptr_conv);
80688         uint64_tArray ret_arr = NULL;
80689         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
80690         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
80691         for (size_t g = 0; g < ret_var.datalen; g++) {
80692                 LDKUtxo ret_conv_6_var = ret_var.data[g];
80693                 uint64_t ret_conv_6_ref = 0;
80694                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
80695                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
80696                 ret_arr_ptr[g] = ret_conv_6_ref;
80697         }
80698         
80699         FREE(ret_var.data);
80700         return ret_arr;
80701 }
80702
80703 void  __attribute__((export_name("TS_CoinSelection_set_confirmed_utxos"))) TS_CoinSelection_set_confirmed_utxos(uint64_t this_ptr, uint64_tArray val) {
80704         LDKCoinSelection this_ptr_conv;
80705         this_ptr_conv.inner = untag_ptr(this_ptr);
80706         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80708         this_ptr_conv.is_owned = false;
80709         LDKCVec_UtxoZ val_constr;
80710         val_constr.datalen = val->arr_len;
80711         if (val_constr.datalen > 0)
80712                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
80713         else
80714                 val_constr.data = NULL;
80715         uint64_t* val_vals = val->elems;
80716         for (size_t g = 0; g < val_constr.datalen; g++) {
80717                 uint64_t val_conv_6 = val_vals[g];
80718                 LDKUtxo val_conv_6_conv;
80719                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
80720                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
80721                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
80722                 val_conv_6_conv = Utxo_clone(&val_conv_6_conv);
80723                 val_constr.data[g] = val_conv_6_conv;
80724         }
80725         FREE(val);
80726         CoinSelection_set_confirmed_utxos(&this_ptr_conv, val_constr);
80727 }
80728
80729 uint64_t  __attribute__((export_name("TS_CoinSelection_get_change_output"))) TS_CoinSelection_get_change_output(uint64_t this_ptr) {
80730         LDKCoinSelection this_ptr_conv;
80731         this_ptr_conv.inner = untag_ptr(this_ptr);
80732         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80734         this_ptr_conv.is_owned = false;
80735         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
80736         *ret_copy = CoinSelection_get_change_output(&this_ptr_conv);
80737         uint64_t ret_ref = tag_ptr(ret_copy, true);
80738         return ret_ref;
80739 }
80740
80741 void  __attribute__((export_name("TS_CoinSelection_set_change_output"))) TS_CoinSelection_set_change_output(uint64_t this_ptr, uint64_t val) {
80742         LDKCoinSelection this_ptr_conv;
80743         this_ptr_conv.inner = untag_ptr(this_ptr);
80744         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80746         this_ptr_conv.is_owned = false;
80747         void* val_ptr = untag_ptr(val);
80748         CHECK_ACCESS(val_ptr);
80749         LDKCOption_TxOutZ val_conv = *(LDKCOption_TxOutZ*)(val_ptr);
80750         val_conv = COption_TxOutZ_clone((LDKCOption_TxOutZ*)untag_ptr(val));
80751         CoinSelection_set_change_output(&this_ptr_conv, val_conv);
80752 }
80753
80754 uint64_t  __attribute__((export_name("TS_CoinSelection_new"))) TS_CoinSelection_new(uint64_tArray confirmed_utxos_arg, uint64_t change_output_arg) {
80755         LDKCVec_UtxoZ confirmed_utxos_arg_constr;
80756         confirmed_utxos_arg_constr.datalen = confirmed_utxos_arg->arr_len;
80757         if (confirmed_utxos_arg_constr.datalen > 0)
80758                 confirmed_utxos_arg_constr.data = MALLOC(confirmed_utxos_arg_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
80759         else
80760                 confirmed_utxos_arg_constr.data = NULL;
80761         uint64_t* confirmed_utxos_arg_vals = confirmed_utxos_arg->elems;
80762         for (size_t g = 0; g < confirmed_utxos_arg_constr.datalen; g++) {
80763                 uint64_t confirmed_utxos_arg_conv_6 = confirmed_utxos_arg_vals[g];
80764                 LDKUtxo confirmed_utxos_arg_conv_6_conv;
80765                 confirmed_utxos_arg_conv_6_conv.inner = untag_ptr(confirmed_utxos_arg_conv_6);
80766                 confirmed_utxos_arg_conv_6_conv.is_owned = ptr_is_owned(confirmed_utxos_arg_conv_6);
80767                 CHECK_INNER_FIELD_ACCESS_OR_NULL(confirmed_utxos_arg_conv_6_conv);
80768                 confirmed_utxos_arg_conv_6_conv = Utxo_clone(&confirmed_utxos_arg_conv_6_conv);
80769                 confirmed_utxos_arg_constr.data[g] = confirmed_utxos_arg_conv_6_conv;
80770         }
80771         FREE(confirmed_utxos_arg);
80772         void* change_output_arg_ptr = untag_ptr(change_output_arg);
80773         CHECK_ACCESS(change_output_arg_ptr);
80774         LDKCOption_TxOutZ change_output_arg_conv = *(LDKCOption_TxOutZ*)(change_output_arg_ptr);
80775         change_output_arg_conv = COption_TxOutZ_clone((LDKCOption_TxOutZ*)untag_ptr(change_output_arg));
80776         LDKCoinSelection ret_var = CoinSelection_new(confirmed_utxos_arg_constr, change_output_arg_conv);
80777         uint64_t ret_ref = 0;
80778         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80779         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80780         return ret_ref;
80781 }
80782
80783 static inline uint64_t CoinSelection_clone_ptr(LDKCoinSelection *NONNULL_PTR arg) {
80784         LDKCoinSelection ret_var = CoinSelection_clone(arg);
80785         uint64_t ret_ref = 0;
80786         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80787         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80788         return ret_ref;
80789 }
80790 int64_t  __attribute__((export_name("TS_CoinSelection_clone_ptr"))) TS_CoinSelection_clone_ptr(uint64_t arg) {
80791         LDKCoinSelection arg_conv;
80792         arg_conv.inner = untag_ptr(arg);
80793         arg_conv.is_owned = ptr_is_owned(arg);
80794         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
80795         arg_conv.is_owned = false;
80796         int64_t ret_conv = CoinSelection_clone_ptr(&arg_conv);
80797         return ret_conv;
80798 }
80799
80800 uint64_t  __attribute__((export_name("TS_CoinSelection_clone"))) TS_CoinSelection_clone(uint64_t orig) {
80801         LDKCoinSelection orig_conv;
80802         orig_conv.inner = untag_ptr(orig);
80803         orig_conv.is_owned = ptr_is_owned(orig);
80804         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
80805         orig_conv.is_owned = false;
80806         LDKCoinSelection ret_var = CoinSelection_clone(&orig_conv);
80807         uint64_t ret_ref = 0;
80808         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80809         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80810         return ret_ref;
80811 }
80812
80813 void  __attribute__((export_name("TS_CoinSelectionSource_free"))) TS_CoinSelectionSource_free(uint64_t this_ptr) {
80814         if (!ptr_is_owned(this_ptr)) return;
80815         void* this_ptr_ptr = untag_ptr(this_ptr);
80816         CHECK_ACCESS(this_ptr_ptr);
80817         LDKCoinSelectionSource this_ptr_conv = *(LDKCoinSelectionSource*)(this_ptr_ptr);
80818         FREE(untag_ptr(this_ptr));
80819         CoinSelectionSource_free(this_ptr_conv);
80820 }
80821
80822 void  __attribute__((export_name("TS_WalletSource_free"))) TS_WalletSource_free(uint64_t this_ptr) {
80823         if (!ptr_is_owned(this_ptr)) return;
80824         void* this_ptr_ptr = untag_ptr(this_ptr);
80825         CHECK_ACCESS(this_ptr_ptr);
80826         LDKWalletSource this_ptr_conv = *(LDKWalletSource*)(this_ptr_ptr);
80827         FREE(untag_ptr(this_ptr));
80828         WalletSource_free(this_ptr_conv);
80829 }
80830
80831 void  __attribute__((export_name("TS_Wallet_free"))) TS_Wallet_free(uint64_t this_obj) {
80832         LDKWallet this_obj_conv;
80833         this_obj_conv.inner = untag_ptr(this_obj);
80834         this_obj_conv.is_owned = ptr_is_owned(this_obj);
80835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
80836         Wallet_free(this_obj_conv);
80837 }
80838
80839 uint64_t  __attribute__((export_name("TS_Wallet_new"))) TS_Wallet_new(uint64_t source, uint64_t logger) {
80840         void* source_ptr = untag_ptr(source);
80841         CHECK_ACCESS(source_ptr);
80842         LDKWalletSource source_conv = *(LDKWalletSource*)(source_ptr);
80843         if (source_conv.free == LDKWalletSource_JCalls_free) {
80844                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
80845                 LDKWalletSource_JCalls_cloned(&source_conv);
80846         }
80847         void* logger_ptr = untag_ptr(logger);
80848         CHECK_ACCESS(logger_ptr);
80849         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
80850         if (logger_conv.free == LDKLogger_JCalls_free) {
80851                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
80852                 LDKLogger_JCalls_cloned(&logger_conv);
80853         }
80854         LDKWallet ret_var = Wallet_new(source_conv, logger_conv);
80855         uint64_t ret_ref = 0;
80856         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80857         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80858         return ret_ref;
80859 }
80860
80861 uint64_t  __attribute__((export_name("TS_Wallet_as_CoinSelectionSource"))) TS_Wallet_as_CoinSelectionSource(uint64_t this_arg) {
80862         LDKWallet this_arg_conv;
80863         this_arg_conv.inner = untag_ptr(this_arg);
80864         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80866         this_arg_conv.is_owned = false;
80867         LDKCoinSelectionSource* ret_ret = MALLOC(sizeof(LDKCoinSelectionSource), "LDKCoinSelectionSource");
80868         *ret_ret = Wallet_as_CoinSelectionSource(&this_arg_conv);
80869         return tag_ptr(ret_ret, true);
80870 }
80871
80872 void  __attribute__((export_name("TS_BumpTransactionEventHandler_free"))) TS_BumpTransactionEventHandler_free(uint64_t this_obj) {
80873         LDKBumpTransactionEventHandler this_obj_conv;
80874         this_obj_conv.inner = untag_ptr(this_obj);
80875         this_obj_conv.is_owned = ptr_is_owned(this_obj);
80876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
80877         BumpTransactionEventHandler_free(this_obj_conv);
80878 }
80879
80880 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) {
80881         void* broadcaster_ptr = untag_ptr(broadcaster);
80882         CHECK_ACCESS(broadcaster_ptr);
80883         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
80884         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
80885                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
80886                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
80887         }
80888         void* utxo_source_ptr = untag_ptr(utxo_source);
80889         CHECK_ACCESS(utxo_source_ptr);
80890         LDKCoinSelectionSource utxo_source_conv = *(LDKCoinSelectionSource*)(utxo_source_ptr);
80891         if (utxo_source_conv.free == LDKCoinSelectionSource_JCalls_free) {
80892                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
80893                 LDKCoinSelectionSource_JCalls_cloned(&utxo_source_conv);
80894         }
80895         void* signer_provider_ptr = untag_ptr(signer_provider);
80896         CHECK_ACCESS(signer_provider_ptr);
80897         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
80898         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
80899                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
80900                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
80901         }
80902         void* logger_ptr = untag_ptr(logger);
80903         CHECK_ACCESS(logger_ptr);
80904         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
80905         if (logger_conv.free == LDKLogger_JCalls_free) {
80906                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
80907                 LDKLogger_JCalls_cloned(&logger_conv);
80908         }
80909         LDKBumpTransactionEventHandler ret_var = BumpTransactionEventHandler_new(broadcaster_conv, utxo_source_conv, signer_provider_conv, logger_conv);
80910         uint64_t ret_ref = 0;
80911         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80912         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80913         return ret_ref;
80914 }
80915
80916 void  __attribute__((export_name("TS_BumpTransactionEventHandler_handle_event"))) TS_BumpTransactionEventHandler_handle_event(uint64_t this_arg, uint64_t event) {
80917         LDKBumpTransactionEventHandler this_arg_conv;
80918         this_arg_conv.inner = untag_ptr(this_arg);
80919         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80921         this_arg_conv.is_owned = false;
80922         LDKBumpTransactionEvent* event_conv = (LDKBumpTransactionEvent*)untag_ptr(event);
80923         BumpTransactionEventHandler_handle_event(&this_arg_conv, event_conv);
80924 }
80925
80926 void  __attribute__((export_name("TS_GossipSync_free"))) TS_GossipSync_free(uint64_t this_ptr) {
80927         if (!ptr_is_owned(this_ptr)) return;
80928         void* this_ptr_ptr = untag_ptr(this_ptr);
80929         CHECK_ACCESS(this_ptr_ptr);
80930         LDKGossipSync this_ptr_conv = *(LDKGossipSync*)(this_ptr_ptr);
80931         FREE(untag_ptr(this_ptr));
80932         GossipSync_free(this_ptr_conv);
80933 }
80934
80935 uint64_t  __attribute__((export_name("TS_GossipSync_p2_p"))) TS_GossipSync_p2_p(uint64_t a) {
80936         LDKP2PGossipSync a_conv;
80937         a_conv.inner = untag_ptr(a);
80938         a_conv.is_owned = ptr_is_owned(a);
80939         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
80940         a_conv.is_owned = false;
80941         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
80942         *ret_copy = GossipSync_p2_p(&a_conv);
80943         uint64_t ret_ref = tag_ptr(ret_copy, true);
80944         return ret_ref;
80945 }
80946
80947 uint64_t  __attribute__((export_name("TS_GossipSync_rapid"))) TS_GossipSync_rapid(uint64_t a) {
80948         LDKRapidGossipSync a_conv;
80949         a_conv.inner = untag_ptr(a);
80950         a_conv.is_owned = ptr_is_owned(a);
80951         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
80952         a_conv.is_owned = false;
80953         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
80954         *ret_copy = GossipSync_rapid(&a_conv);
80955         uint64_t ret_ref = tag_ptr(ret_copy, true);
80956         return ret_ref;
80957 }
80958
80959 uint64_t  __attribute__((export_name("TS_GossipSync_none"))) TS_GossipSync_none() {
80960         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
80961         *ret_copy = GossipSync_none();
80962         uint64_t ret_ref = tag_ptr(ret_copy, true);
80963         return ret_ref;
80964 }
80965
80966 void  __attribute__((export_name("TS_GraphSyncError_free"))) TS_GraphSyncError_free(uint64_t this_ptr) {
80967         if (!ptr_is_owned(this_ptr)) return;
80968         void* this_ptr_ptr = untag_ptr(this_ptr);
80969         CHECK_ACCESS(this_ptr_ptr);
80970         LDKGraphSyncError this_ptr_conv = *(LDKGraphSyncError*)(this_ptr_ptr);
80971         FREE(untag_ptr(this_ptr));
80972         GraphSyncError_free(this_ptr_conv);
80973 }
80974
80975 static inline uint64_t GraphSyncError_clone_ptr(LDKGraphSyncError *NONNULL_PTR arg) {
80976         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
80977         *ret_copy = GraphSyncError_clone(arg);
80978         uint64_t ret_ref = tag_ptr(ret_copy, true);
80979         return ret_ref;
80980 }
80981 int64_t  __attribute__((export_name("TS_GraphSyncError_clone_ptr"))) TS_GraphSyncError_clone_ptr(uint64_t arg) {
80982         LDKGraphSyncError* arg_conv = (LDKGraphSyncError*)untag_ptr(arg);
80983         int64_t ret_conv = GraphSyncError_clone_ptr(arg_conv);
80984         return ret_conv;
80985 }
80986
80987 uint64_t  __attribute__((export_name("TS_GraphSyncError_clone"))) TS_GraphSyncError_clone(uint64_t orig) {
80988         LDKGraphSyncError* orig_conv = (LDKGraphSyncError*)untag_ptr(orig);
80989         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
80990         *ret_copy = GraphSyncError_clone(orig_conv);
80991         uint64_t ret_ref = tag_ptr(ret_copy, true);
80992         return ret_ref;
80993 }
80994
80995 uint64_t  __attribute__((export_name("TS_GraphSyncError_decode_error"))) TS_GraphSyncError_decode_error(uint64_t a) {
80996         void* a_ptr = untag_ptr(a);
80997         CHECK_ACCESS(a_ptr);
80998         LDKDecodeError a_conv = *(LDKDecodeError*)(a_ptr);
80999         a_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(a));
81000         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
81001         *ret_copy = GraphSyncError_decode_error(a_conv);
81002         uint64_t ret_ref = tag_ptr(ret_copy, true);
81003         return ret_ref;
81004 }
81005
81006 uint64_t  __attribute__((export_name("TS_GraphSyncError_lightning_error"))) TS_GraphSyncError_lightning_error(uint64_t a) {
81007         LDKLightningError a_conv;
81008         a_conv.inner = untag_ptr(a);
81009         a_conv.is_owned = ptr_is_owned(a);
81010         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
81011         a_conv = LightningError_clone(&a_conv);
81012         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
81013         *ret_copy = GraphSyncError_lightning_error(a_conv);
81014         uint64_t ret_ref = tag_ptr(ret_copy, true);
81015         return ret_ref;
81016 }
81017
81018 void  __attribute__((export_name("TS_RapidGossipSync_free"))) TS_RapidGossipSync_free(uint64_t this_obj) {
81019         LDKRapidGossipSync this_obj_conv;
81020         this_obj_conv.inner = untag_ptr(this_obj);
81021         this_obj_conv.is_owned = ptr_is_owned(this_obj);
81022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
81023         RapidGossipSync_free(this_obj_conv);
81024 }
81025
81026 uint64_t  __attribute__((export_name("TS_RapidGossipSync_new"))) TS_RapidGossipSync_new(uint64_t network_graph, uint64_t logger) {
81027         LDKNetworkGraph network_graph_conv;
81028         network_graph_conv.inner = untag_ptr(network_graph);
81029         network_graph_conv.is_owned = ptr_is_owned(network_graph);
81030         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
81031         network_graph_conv.is_owned = false;
81032         void* logger_ptr = untag_ptr(logger);
81033         CHECK_ACCESS(logger_ptr);
81034         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
81035         if (logger_conv.free == LDKLogger_JCalls_free) {
81036                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
81037                 LDKLogger_JCalls_cloned(&logger_conv);
81038         }
81039         LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv, logger_conv);
81040         uint64_t ret_ref = 0;
81041         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81042         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81043         return ret_ref;
81044 }
81045
81046 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) {
81047         LDKRapidGossipSync this_arg_conv;
81048         this_arg_conv.inner = untag_ptr(this_arg);
81049         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81051         this_arg_conv.is_owned = false;
81052         LDKu8slice update_data_ref;
81053         update_data_ref.datalen = update_data->arr_len;
81054         update_data_ref.data = update_data->elems;
81055         void* current_time_unix_ptr = untag_ptr(current_time_unix);
81056         CHECK_ACCESS(current_time_unix_ptr);
81057         LDKCOption_u64Z current_time_unix_conv = *(LDKCOption_u64Z*)(current_time_unix_ptr);
81058         current_time_unix_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(current_time_unix));
81059         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
81060         *ret_conv = RapidGossipSync_update_network_graph_no_std(&this_arg_conv, update_data_ref, current_time_unix_conv);
81061         FREE(update_data);
81062         return tag_ptr(ret_conv, true);
81063 }
81064
81065 jboolean  __attribute__((export_name("TS_RapidGossipSync_is_initial_sync_complete"))) TS_RapidGossipSync_is_initial_sync_complete(uint64_t this_arg) {
81066         LDKRapidGossipSync this_arg_conv;
81067         this_arg_conv.inner = untag_ptr(this_arg);
81068         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81070         this_arg_conv.is_owned = false;
81071         jboolean ret_conv = RapidGossipSync_is_initial_sync_complete(&this_arg_conv);
81072         return ret_conv;
81073 }
81074
81075 void  __attribute__((export_name("TS_Bolt11ParseError_free"))) TS_Bolt11ParseError_free(uint64_t this_ptr) {
81076         if (!ptr_is_owned(this_ptr)) return;
81077         void* this_ptr_ptr = untag_ptr(this_ptr);
81078         CHECK_ACCESS(this_ptr_ptr);
81079         LDKBolt11ParseError this_ptr_conv = *(LDKBolt11ParseError*)(this_ptr_ptr);
81080         FREE(untag_ptr(this_ptr));
81081         Bolt11ParseError_free(this_ptr_conv);
81082 }
81083
81084 static inline uint64_t Bolt11ParseError_clone_ptr(LDKBolt11ParseError *NONNULL_PTR arg) {
81085         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81086         *ret_copy = Bolt11ParseError_clone(arg);
81087         uint64_t ret_ref = tag_ptr(ret_copy, true);
81088         return ret_ref;
81089 }
81090 int64_t  __attribute__((export_name("TS_Bolt11ParseError_clone_ptr"))) TS_Bolt11ParseError_clone_ptr(uint64_t arg) {
81091         LDKBolt11ParseError* arg_conv = (LDKBolt11ParseError*)untag_ptr(arg);
81092         int64_t ret_conv = Bolt11ParseError_clone_ptr(arg_conv);
81093         return ret_conv;
81094 }
81095
81096 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_clone"))) TS_Bolt11ParseError_clone(uint64_t orig) {
81097         LDKBolt11ParseError* orig_conv = (LDKBolt11ParseError*)untag_ptr(orig);
81098         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81099         *ret_copy = Bolt11ParseError_clone(orig_conv);
81100         uint64_t ret_ref = tag_ptr(ret_copy, true);
81101         return ret_ref;
81102 }
81103
81104 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_bech32_error"))) TS_Bolt11ParseError_bech32_error(uint64_t a) {
81105         void* a_ptr = untag_ptr(a);
81106         CHECK_ACCESS(a_ptr);
81107         LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
81108         a_conv = Bech32Error_clone((LDKBech32Error*)untag_ptr(a));
81109         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81110         *ret_copy = Bolt11ParseError_bech32_error(a_conv);
81111         uint64_t ret_ref = tag_ptr(ret_copy, true);
81112         return ret_ref;
81113 }
81114
81115 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_parse_amount_error"))) TS_Bolt11ParseError_parse_amount_error(int32_t a) {
81116         
81117         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81118         *ret_copy = Bolt11ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
81119         uint64_t ret_ref = tag_ptr(ret_copy, true);
81120         return ret_ref;
81121 }
81122
81123 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_malformed_signature"))) TS_Bolt11ParseError_malformed_signature(uint32_t a) {
81124         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
81125         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81126         *ret_copy = Bolt11ParseError_malformed_signature(a_conv);
81127         uint64_t ret_ref = tag_ptr(ret_copy, true);
81128         return ret_ref;
81129 }
81130
81131 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_bad_prefix"))) TS_Bolt11ParseError_bad_prefix() {
81132         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81133         *ret_copy = Bolt11ParseError_bad_prefix();
81134         uint64_t ret_ref = tag_ptr(ret_copy, true);
81135         return ret_ref;
81136 }
81137
81138 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_unknown_currency"))) TS_Bolt11ParseError_unknown_currency() {
81139         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81140         *ret_copy = Bolt11ParseError_unknown_currency();
81141         uint64_t ret_ref = tag_ptr(ret_copy, true);
81142         return ret_ref;
81143 }
81144
81145 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_unknown_si_prefix"))) TS_Bolt11ParseError_unknown_si_prefix() {
81146         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81147         *ret_copy = Bolt11ParseError_unknown_si_prefix();
81148         uint64_t ret_ref = tag_ptr(ret_copy, true);
81149         return ret_ref;
81150 }
81151
81152 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_malformed_hrp"))) TS_Bolt11ParseError_malformed_hrp() {
81153         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81154         *ret_copy = Bolt11ParseError_malformed_hrp();
81155         uint64_t ret_ref = tag_ptr(ret_copy, true);
81156         return ret_ref;
81157 }
81158
81159 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_too_short_data_part"))) TS_Bolt11ParseError_too_short_data_part() {
81160         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81161         *ret_copy = Bolt11ParseError_too_short_data_part();
81162         uint64_t ret_ref = tag_ptr(ret_copy, true);
81163         return ret_ref;
81164 }
81165
81166 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_unexpected_end_of_tagged_fields"))) TS_Bolt11ParseError_unexpected_end_of_tagged_fields() {
81167         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81168         *ret_copy = Bolt11ParseError_unexpected_end_of_tagged_fields();
81169         uint64_t ret_ref = tag_ptr(ret_copy, true);
81170         return ret_ref;
81171 }
81172
81173 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_description_decode_error"))) TS_Bolt11ParseError_description_decode_error(int32_t a) {
81174         
81175         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81176         *ret_copy = Bolt11ParseError_description_decode_error((LDKError){ ._dummy = 0 });
81177         uint64_t ret_ref = tag_ptr(ret_copy, true);
81178         return ret_ref;
81179 }
81180
81181 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_padding_error"))) TS_Bolt11ParseError_padding_error() {
81182         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81183         *ret_copy = Bolt11ParseError_padding_error();
81184         uint64_t ret_ref = tag_ptr(ret_copy, true);
81185         return ret_ref;
81186 }
81187
81188 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_integer_overflow_error"))) TS_Bolt11ParseError_integer_overflow_error() {
81189         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81190         *ret_copy = Bolt11ParseError_integer_overflow_error();
81191         uint64_t ret_ref = tag_ptr(ret_copy, true);
81192         return ret_ref;
81193 }
81194
81195 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_seg_wit_program_length"))) TS_Bolt11ParseError_invalid_seg_wit_program_length() {
81196         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81197         *ret_copy = Bolt11ParseError_invalid_seg_wit_program_length();
81198         uint64_t ret_ref = tag_ptr(ret_copy, true);
81199         return ret_ref;
81200 }
81201
81202 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_pub_key_hash_length"))) TS_Bolt11ParseError_invalid_pub_key_hash_length() {
81203         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81204         *ret_copy = Bolt11ParseError_invalid_pub_key_hash_length();
81205         uint64_t ret_ref = tag_ptr(ret_copy, true);
81206         return ret_ref;
81207 }
81208
81209 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_script_hash_length"))) TS_Bolt11ParseError_invalid_script_hash_length() {
81210         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81211         *ret_copy = Bolt11ParseError_invalid_script_hash_length();
81212         uint64_t ret_ref = tag_ptr(ret_copy, true);
81213         return ret_ref;
81214 }
81215
81216 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_recovery_id"))) TS_Bolt11ParseError_invalid_recovery_id() {
81217         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81218         *ret_copy = Bolt11ParseError_invalid_recovery_id();
81219         uint64_t ret_ref = tag_ptr(ret_copy, true);
81220         return ret_ref;
81221 }
81222
81223 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_slice_length"))) TS_Bolt11ParseError_invalid_slice_length(jstring a) {
81224         LDKStr a_conv = str_ref_to_owned_c(a);
81225         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81226         *ret_copy = Bolt11ParseError_invalid_slice_length(a_conv);
81227         uint64_t ret_ref = tag_ptr(ret_copy, true);
81228         return ret_ref;
81229 }
81230
81231 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_skip"))) TS_Bolt11ParseError_skip() {
81232         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81233         *ret_copy = Bolt11ParseError_skip();
81234         uint64_t ret_ref = tag_ptr(ret_copy, true);
81235         return ret_ref;
81236 }
81237
81238 jboolean  __attribute__((export_name("TS_Bolt11ParseError_eq"))) TS_Bolt11ParseError_eq(uint64_t a, uint64_t b) {
81239         LDKBolt11ParseError* a_conv = (LDKBolt11ParseError*)untag_ptr(a);
81240         LDKBolt11ParseError* b_conv = (LDKBolt11ParseError*)untag_ptr(b);
81241         jboolean ret_conv = Bolt11ParseError_eq(a_conv, b_conv);
81242         return ret_conv;
81243 }
81244
81245 void  __attribute__((export_name("TS_ParseOrSemanticError_free"))) TS_ParseOrSemanticError_free(uint64_t this_ptr) {
81246         if (!ptr_is_owned(this_ptr)) return;
81247         void* this_ptr_ptr = untag_ptr(this_ptr);
81248         CHECK_ACCESS(this_ptr_ptr);
81249         LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
81250         FREE(untag_ptr(this_ptr));
81251         ParseOrSemanticError_free(this_ptr_conv);
81252 }
81253
81254 static inline uint64_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
81255         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
81256         *ret_copy = ParseOrSemanticError_clone(arg);
81257         uint64_t ret_ref = tag_ptr(ret_copy, true);
81258         return ret_ref;
81259 }
81260 int64_t  __attribute__((export_name("TS_ParseOrSemanticError_clone_ptr"))) TS_ParseOrSemanticError_clone_ptr(uint64_t arg) {
81261         LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)untag_ptr(arg);
81262         int64_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
81263         return ret_conv;
81264 }
81265
81266 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_clone"))) TS_ParseOrSemanticError_clone(uint64_t orig) {
81267         LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)untag_ptr(orig);
81268         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
81269         *ret_copy = ParseOrSemanticError_clone(orig_conv);
81270         uint64_t ret_ref = tag_ptr(ret_copy, true);
81271         return ret_ref;
81272 }
81273
81274 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_parse_error"))) TS_ParseOrSemanticError_parse_error(uint64_t a) {
81275         void* a_ptr = untag_ptr(a);
81276         CHECK_ACCESS(a_ptr);
81277         LDKBolt11ParseError a_conv = *(LDKBolt11ParseError*)(a_ptr);
81278         a_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(a));
81279         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
81280         *ret_copy = ParseOrSemanticError_parse_error(a_conv);
81281         uint64_t ret_ref = tag_ptr(ret_copy, true);
81282         return ret_ref;
81283 }
81284
81285 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_semantic_error"))) TS_ParseOrSemanticError_semantic_error(uint32_t a) {
81286         LDKBolt11SemanticError a_conv = LDKBolt11SemanticError_from_js(a);
81287         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
81288         *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
81289         uint64_t ret_ref = tag_ptr(ret_copy, true);
81290         return ret_ref;
81291 }
81292
81293 jboolean  __attribute__((export_name("TS_ParseOrSemanticError_eq"))) TS_ParseOrSemanticError_eq(uint64_t a, uint64_t b) {
81294         LDKParseOrSemanticError* a_conv = (LDKParseOrSemanticError*)untag_ptr(a);
81295         LDKParseOrSemanticError* b_conv = (LDKParseOrSemanticError*)untag_ptr(b);
81296         jboolean ret_conv = ParseOrSemanticError_eq(a_conv, b_conv);
81297         return ret_conv;
81298 }
81299
81300 void  __attribute__((export_name("TS_Bolt11Invoice_free"))) TS_Bolt11Invoice_free(uint64_t this_obj) {
81301         LDKBolt11Invoice this_obj_conv;
81302         this_obj_conv.inner = untag_ptr(this_obj);
81303         this_obj_conv.is_owned = ptr_is_owned(this_obj);
81304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
81305         Bolt11Invoice_free(this_obj_conv);
81306 }
81307
81308 jboolean  __attribute__((export_name("TS_Bolt11Invoice_eq"))) TS_Bolt11Invoice_eq(uint64_t a, uint64_t b) {
81309         LDKBolt11Invoice a_conv;
81310         a_conv.inner = untag_ptr(a);
81311         a_conv.is_owned = ptr_is_owned(a);
81312         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
81313         a_conv.is_owned = false;
81314         LDKBolt11Invoice b_conv;
81315         b_conv.inner = untag_ptr(b);
81316         b_conv.is_owned = ptr_is_owned(b);
81317         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
81318         b_conv.is_owned = false;
81319         jboolean ret_conv = Bolt11Invoice_eq(&a_conv, &b_conv);
81320         return ret_conv;
81321 }
81322
81323 static inline uint64_t Bolt11Invoice_clone_ptr(LDKBolt11Invoice *NONNULL_PTR arg) {
81324         LDKBolt11Invoice ret_var = Bolt11Invoice_clone(arg);
81325         uint64_t ret_ref = 0;
81326         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81327         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81328         return ret_ref;
81329 }
81330 int64_t  __attribute__((export_name("TS_Bolt11Invoice_clone_ptr"))) TS_Bolt11Invoice_clone_ptr(uint64_t arg) {
81331         LDKBolt11Invoice arg_conv;
81332         arg_conv.inner = untag_ptr(arg);
81333         arg_conv.is_owned = ptr_is_owned(arg);
81334         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
81335         arg_conv.is_owned = false;
81336         int64_t ret_conv = Bolt11Invoice_clone_ptr(&arg_conv);
81337         return ret_conv;
81338 }
81339
81340 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_clone"))) TS_Bolt11Invoice_clone(uint64_t orig) {
81341         LDKBolt11Invoice orig_conv;
81342         orig_conv.inner = untag_ptr(orig);
81343         orig_conv.is_owned = ptr_is_owned(orig);
81344         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
81345         orig_conv.is_owned = false;
81346         LDKBolt11Invoice ret_var = Bolt11Invoice_clone(&orig_conv);
81347         uint64_t ret_ref = 0;
81348         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81349         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81350         return ret_ref;
81351 }
81352
81353 int64_t  __attribute__((export_name("TS_Bolt11Invoice_hash"))) TS_Bolt11Invoice_hash(uint64_t o) {
81354         LDKBolt11Invoice o_conv;
81355         o_conv.inner = untag_ptr(o);
81356         o_conv.is_owned = ptr_is_owned(o);
81357         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
81358         o_conv.is_owned = false;
81359         int64_t ret_conv = Bolt11Invoice_hash(&o_conv);
81360         return ret_conv;
81361 }
81362
81363 void  __attribute__((export_name("TS_SignedRawBolt11Invoice_free"))) TS_SignedRawBolt11Invoice_free(uint64_t this_obj) {
81364         LDKSignedRawBolt11Invoice this_obj_conv;
81365         this_obj_conv.inner = untag_ptr(this_obj);
81366         this_obj_conv.is_owned = ptr_is_owned(this_obj);
81367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
81368         SignedRawBolt11Invoice_free(this_obj_conv);
81369 }
81370
81371 jboolean  __attribute__((export_name("TS_SignedRawBolt11Invoice_eq"))) TS_SignedRawBolt11Invoice_eq(uint64_t a, uint64_t b) {
81372         LDKSignedRawBolt11Invoice a_conv;
81373         a_conv.inner = untag_ptr(a);
81374         a_conv.is_owned = ptr_is_owned(a);
81375         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
81376         a_conv.is_owned = false;
81377         LDKSignedRawBolt11Invoice b_conv;
81378         b_conv.inner = untag_ptr(b);
81379         b_conv.is_owned = ptr_is_owned(b);
81380         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
81381         b_conv.is_owned = false;
81382         jboolean ret_conv = SignedRawBolt11Invoice_eq(&a_conv, &b_conv);
81383         return ret_conv;
81384 }
81385
81386 static inline uint64_t SignedRawBolt11Invoice_clone_ptr(LDKSignedRawBolt11Invoice *NONNULL_PTR arg) {
81387         LDKSignedRawBolt11Invoice ret_var = SignedRawBolt11Invoice_clone(arg);
81388         uint64_t ret_ref = 0;
81389         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81390         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81391         return ret_ref;
81392 }
81393 int64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_clone_ptr"))) TS_SignedRawBolt11Invoice_clone_ptr(uint64_t arg) {
81394         LDKSignedRawBolt11Invoice arg_conv;
81395         arg_conv.inner = untag_ptr(arg);
81396         arg_conv.is_owned = ptr_is_owned(arg);
81397         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
81398         arg_conv.is_owned = false;
81399         int64_t ret_conv = SignedRawBolt11Invoice_clone_ptr(&arg_conv);
81400         return ret_conv;
81401 }
81402
81403 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_clone"))) TS_SignedRawBolt11Invoice_clone(uint64_t orig) {
81404         LDKSignedRawBolt11Invoice orig_conv;
81405         orig_conv.inner = untag_ptr(orig);
81406         orig_conv.is_owned = ptr_is_owned(orig);
81407         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
81408         orig_conv.is_owned = false;
81409         LDKSignedRawBolt11Invoice ret_var = SignedRawBolt11Invoice_clone(&orig_conv);
81410         uint64_t ret_ref = 0;
81411         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81412         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81413         return ret_ref;
81414 }
81415
81416 int64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_hash"))) TS_SignedRawBolt11Invoice_hash(uint64_t o) {
81417         LDKSignedRawBolt11Invoice o_conv;
81418         o_conv.inner = untag_ptr(o);
81419         o_conv.is_owned = ptr_is_owned(o);
81420         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
81421         o_conv.is_owned = false;
81422         int64_t ret_conv = SignedRawBolt11Invoice_hash(&o_conv);
81423         return ret_conv;
81424 }
81425
81426 void  __attribute__((export_name("TS_RawBolt11Invoice_free"))) TS_RawBolt11Invoice_free(uint64_t this_obj) {
81427         LDKRawBolt11Invoice this_obj_conv;
81428         this_obj_conv.inner = untag_ptr(this_obj);
81429         this_obj_conv.is_owned = ptr_is_owned(this_obj);
81430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
81431         RawBolt11Invoice_free(this_obj_conv);
81432 }
81433
81434 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_get_data"))) TS_RawBolt11Invoice_get_data(uint64_t this_ptr) {
81435         LDKRawBolt11Invoice this_ptr_conv;
81436         this_ptr_conv.inner = untag_ptr(this_ptr);
81437         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81439         this_ptr_conv.is_owned = false;
81440         LDKRawDataPart ret_var = RawBolt11Invoice_get_data(&this_ptr_conv);
81441         uint64_t ret_ref = 0;
81442         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81443         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81444         return ret_ref;
81445 }
81446
81447 void  __attribute__((export_name("TS_RawBolt11Invoice_set_data"))) TS_RawBolt11Invoice_set_data(uint64_t this_ptr, uint64_t val) {
81448         LDKRawBolt11Invoice this_ptr_conv;
81449         this_ptr_conv.inner = untag_ptr(this_ptr);
81450         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81452         this_ptr_conv.is_owned = false;
81453         LDKRawDataPart val_conv;
81454         val_conv.inner = untag_ptr(val);
81455         val_conv.is_owned = ptr_is_owned(val);
81456         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
81457         val_conv = RawDataPart_clone(&val_conv);
81458         RawBolt11Invoice_set_data(&this_ptr_conv, val_conv);
81459 }
81460
81461 jboolean  __attribute__((export_name("TS_RawBolt11Invoice_eq"))) TS_RawBolt11Invoice_eq(uint64_t a, uint64_t b) {
81462         LDKRawBolt11Invoice a_conv;
81463         a_conv.inner = untag_ptr(a);
81464         a_conv.is_owned = ptr_is_owned(a);
81465         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
81466         a_conv.is_owned = false;
81467         LDKRawBolt11Invoice b_conv;
81468         b_conv.inner = untag_ptr(b);
81469         b_conv.is_owned = ptr_is_owned(b);
81470         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
81471         b_conv.is_owned = false;
81472         jboolean ret_conv = RawBolt11Invoice_eq(&a_conv, &b_conv);
81473         return ret_conv;
81474 }
81475
81476 static inline uint64_t RawBolt11Invoice_clone_ptr(LDKRawBolt11Invoice *NONNULL_PTR arg) {
81477         LDKRawBolt11Invoice ret_var = RawBolt11Invoice_clone(arg);
81478         uint64_t ret_ref = 0;
81479         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81480         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81481         return ret_ref;
81482 }
81483 int64_t  __attribute__((export_name("TS_RawBolt11Invoice_clone_ptr"))) TS_RawBolt11Invoice_clone_ptr(uint64_t arg) {
81484         LDKRawBolt11Invoice arg_conv;
81485         arg_conv.inner = untag_ptr(arg);
81486         arg_conv.is_owned = ptr_is_owned(arg);
81487         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
81488         arg_conv.is_owned = false;
81489         int64_t ret_conv = RawBolt11Invoice_clone_ptr(&arg_conv);
81490         return ret_conv;
81491 }
81492
81493 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_clone"))) TS_RawBolt11Invoice_clone(uint64_t orig) {
81494         LDKRawBolt11Invoice orig_conv;
81495         orig_conv.inner = untag_ptr(orig);
81496         orig_conv.is_owned = ptr_is_owned(orig);
81497         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
81498         orig_conv.is_owned = false;
81499         LDKRawBolt11Invoice ret_var = RawBolt11Invoice_clone(&orig_conv);
81500         uint64_t ret_ref = 0;
81501         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81502         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81503         return ret_ref;
81504 }
81505
81506 int64_t  __attribute__((export_name("TS_RawBolt11Invoice_hash"))) TS_RawBolt11Invoice_hash(uint64_t o) {
81507         LDKRawBolt11Invoice o_conv;
81508         o_conv.inner = untag_ptr(o);
81509         o_conv.is_owned = ptr_is_owned(o);
81510         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
81511         o_conv.is_owned = false;
81512         int64_t ret_conv = RawBolt11Invoice_hash(&o_conv);
81513         return ret_conv;
81514 }
81515
81516 void  __attribute__((export_name("TS_RawDataPart_free"))) TS_RawDataPart_free(uint64_t this_obj) {
81517         LDKRawDataPart this_obj_conv;
81518         this_obj_conv.inner = untag_ptr(this_obj);
81519         this_obj_conv.is_owned = ptr_is_owned(this_obj);
81520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
81521         RawDataPart_free(this_obj_conv);
81522 }
81523
81524 uint64_t  __attribute__((export_name("TS_RawDataPart_get_timestamp"))) TS_RawDataPart_get_timestamp(uint64_t this_ptr) {
81525         LDKRawDataPart this_ptr_conv;
81526         this_ptr_conv.inner = untag_ptr(this_ptr);
81527         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81529         this_ptr_conv.is_owned = false;
81530         LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
81531         uint64_t ret_ref = 0;
81532         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81533         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81534         return ret_ref;
81535 }
81536
81537 void  __attribute__((export_name("TS_RawDataPart_set_timestamp"))) TS_RawDataPart_set_timestamp(uint64_t this_ptr, uint64_t val) {
81538         LDKRawDataPart this_ptr_conv;
81539         this_ptr_conv.inner = untag_ptr(this_ptr);
81540         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81542         this_ptr_conv.is_owned = false;
81543         LDKPositiveTimestamp val_conv;
81544         val_conv.inner = untag_ptr(val);
81545         val_conv.is_owned = ptr_is_owned(val);
81546         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
81547         val_conv = PositiveTimestamp_clone(&val_conv);
81548         RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
81549 }
81550
81551 jboolean  __attribute__((export_name("TS_RawDataPart_eq"))) TS_RawDataPart_eq(uint64_t a, uint64_t b) {
81552         LDKRawDataPart a_conv;
81553         a_conv.inner = untag_ptr(a);
81554         a_conv.is_owned = ptr_is_owned(a);
81555         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
81556         a_conv.is_owned = false;
81557         LDKRawDataPart b_conv;
81558         b_conv.inner = untag_ptr(b);
81559         b_conv.is_owned = ptr_is_owned(b);
81560         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
81561         b_conv.is_owned = false;
81562         jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
81563         return ret_conv;
81564 }
81565
81566 static inline uint64_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
81567         LDKRawDataPart ret_var = RawDataPart_clone(arg);
81568         uint64_t ret_ref = 0;
81569         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81570         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81571         return ret_ref;
81572 }
81573 int64_t  __attribute__((export_name("TS_RawDataPart_clone_ptr"))) TS_RawDataPart_clone_ptr(uint64_t arg) {
81574         LDKRawDataPart arg_conv;
81575         arg_conv.inner = untag_ptr(arg);
81576         arg_conv.is_owned = ptr_is_owned(arg);
81577         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
81578         arg_conv.is_owned = false;
81579         int64_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
81580         return ret_conv;
81581 }
81582
81583 uint64_t  __attribute__((export_name("TS_RawDataPart_clone"))) TS_RawDataPart_clone(uint64_t orig) {
81584         LDKRawDataPart orig_conv;
81585         orig_conv.inner = untag_ptr(orig);
81586         orig_conv.is_owned = ptr_is_owned(orig);
81587         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
81588         orig_conv.is_owned = false;
81589         LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
81590         uint64_t ret_ref = 0;
81591         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81592         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81593         return ret_ref;
81594 }
81595
81596 int64_t  __attribute__((export_name("TS_RawDataPart_hash"))) TS_RawDataPart_hash(uint64_t o) {
81597         LDKRawDataPart o_conv;
81598         o_conv.inner = untag_ptr(o);
81599         o_conv.is_owned = ptr_is_owned(o);
81600         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
81601         o_conv.is_owned = false;
81602         int64_t ret_conv = RawDataPart_hash(&o_conv);
81603         return ret_conv;
81604 }
81605
81606 void  __attribute__((export_name("TS_PositiveTimestamp_free"))) TS_PositiveTimestamp_free(uint64_t this_obj) {
81607         LDKPositiveTimestamp this_obj_conv;
81608         this_obj_conv.inner = untag_ptr(this_obj);
81609         this_obj_conv.is_owned = ptr_is_owned(this_obj);
81610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
81611         PositiveTimestamp_free(this_obj_conv);
81612 }
81613
81614 jboolean  __attribute__((export_name("TS_PositiveTimestamp_eq"))) TS_PositiveTimestamp_eq(uint64_t a, uint64_t b) {
81615         LDKPositiveTimestamp a_conv;
81616         a_conv.inner = untag_ptr(a);
81617         a_conv.is_owned = ptr_is_owned(a);
81618         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
81619         a_conv.is_owned = false;
81620         LDKPositiveTimestamp b_conv;
81621         b_conv.inner = untag_ptr(b);
81622         b_conv.is_owned = ptr_is_owned(b);
81623         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
81624         b_conv.is_owned = false;
81625         jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
81626         return ret_conv;
81627 }
81628
81629 static inline uint64_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
81630         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
81631         uint64_t ret_ref = 0;
81632         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81633         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81634         return ret_ref;
81635 }
81636 int64_t  __attribute__((export_name("TS_PositiveTimestamp_clone_ptr"))) TS_PositiveTimestamp_clone_ptr(uint64_t arg) {
81637         LDKPositiveTimestamp arg_conv;
81638         arg_conv.inner = untag_ptr(arg);
81639         arg_conv.is_owned = ptr_is_owned(arg);
81640         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
81641         arg_conv.is_owned = false;
81642         int64_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
81643         return ret_conv;
81644 }
81645
81646 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_clone"))) TS_PositiveTimestamp_clone(uint64_t orig) {
81647         LDKPositiveTimestamp orig_conv;
81648         orig_conv.inner = untag_ptr(orig);
81649         orig_conv.is_owned = ptr_is_owned(orig);
81650         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
81651         orig_conv.is_owned = false;
81652         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
81653         uint64_t ret_ref = 0;
81654         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81655         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81656         return ret_ref;
81657 }
81658
81659 int64_t  __attribute__((export_name("TS_PositiveTimestamp_hash"))) TS_PositiveTimestamp_hash(uint64_t o) {
81660         LDKPositiveTimestamp o_conv;
81661         o_conv.inner = untag_ptr(o);
81662         o_conv.is_owned = ptr_is_owned(o);
81663         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
81664         o_conv.is_owned = false;
81665         int64_t ret_conv = PositiveTimestamp_hash(&o_conv);
81666         return ret_conv;
81667 }
81668
81669 uint32_t  __attribute__((export_name("TS_SiPrefix_clone"))) TS_SiPrefix_clone(uint64_t orig) {
81670         LDKSiPrefix* orig_conv = (LDKSiPrefix*)untag_ptr(orig);
81671         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_clone(orig_conv));
81672         return ret_conv;
81673 }
81674
81675 uint32_t  __attribute__((export_name("TS_SiPrefix_milli"))) TS_SiPrefix_milli() {
81676         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_milli());
81677         return ret_conv;
81678 }
81679
81680 uint32_t  __attribute__((export_name("TS_SiPrefix_micro"))) TS_SiPrefix_micro() {
81681         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_micro());
81682         return ret_conv;
81683 }
81684
81685 uint32_t  __attribute__((export_name("TS_SiPrefix_nano"))) TS_SiPrefix_nano() {
81686         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_nano());
81687         return ret_conv;
81688 }
81689
81690 uint32_t  __attribute__((export_name("TS_SiPrefix_pico"))) TS_SiPrefix_pico() {
81691         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_pico());
81692         return ret_conv;
81693 }
81694
81695 jboolean  __attribute__((export_name("TS_SiPrefix_eq"))) TS_SiPrefix_eq(uint64_t a, uint64_t b) {
81696         LDKSiPrefix* a_conv = (LDKSiPrefix*)untag_ptr(a);
81697         LDKSiPrefix* b_conv = (LDKSiPrefix*)untag_ptr(b);
81698         jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
81699         return ret_conv;
81700 }
81701
81702 int64_t  __attribute__((export_name("TS_SiPrefix_hash"))) TS_SiPrefix_hash(uint64_t o) {
81703         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
81704         int64_t ret_conv = SiPrefix_hash(o_conv);
81705         return ret_conv;
81706 }
81707
81708 int64_t  __attribute__((export_name("TS_SiPrefix_multiplier"))) TS_SiPrefix_multiplier(uint64_t this_arg) {
81709         LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)untag_ptr(this_arg);
81710         int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
81711         return ret_conv;
81712 }
81713
81714 uint32_t  __attribute__((export_name("TS_Currency_clone"))) TS_Currency_clone(uint64_t orig) {
81715         LDKCurrency* orig_conv = (LDKCurrency*)untag_ptr(orig);
81716         uint32_t ret_conv = LDKCurrency_to_js(Currency_clone(orig_conv));
81717         return ret_conv;
81718 }
81719
81720 uint32_t  __attribute__((export_name("TS_Currency_bitcoin"))) TS_Currency_bitcoin() {
81721         uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin());
81722         return ret_conv;
81723 }
81724
81725 uint32_t  __attribute__((export_name("TS_Currency_bitcoin_testnet"))) TS_Currency_bitcoin_testnet() {
81726         uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin_testnet());
81727         return ret_conv;
81728 }
81729
81730 uint32_t  __attribute__((export_name("TS_Currency_regtest"))) TS_Currency_regtest() {
81731         uint32_t ret_conv = LDKCurrency_to_js(Currency_regtest());
81732         return ret_conv;
81733 }
81734
81735 uint32_t  __attribute__((export_name("TS_Currency_simnet"))) TS_Currency_simnet() {
81736         uint32_t ret_conv = LDKCurrency_to_js(Currency_simnet());
81737         return ret_conv;
81738 }
81739
81740 uint32_t  __attribute__((export_name("TS_Currency_signet"))) TS_Currency_signet() {
81741         uint32_t ret_conv = LDKCurrency_to_js(Currency_signet());
81742         return ret_conv;
81743 }
81744
81745 int64_t  __attribute__((export_name("TS_Currency_hash"))) TS_Currency_hash(uint64_t o) {
81746         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
81747         int64_t ret_conv = Currency_hash(o_conv);
81748         return ret_conv;
81749 }
81750
81751 jboolean  __attribute__((export_name("TS_Currency_eq"))) TS_Currency_eq(uint64_t a, uint64_t b) {
81752         LDKCurrency* a_conv = (LDKCurrency*)untag_ptr(a);
81753         LDKCurrency* b_conv = (LDKCurrency*)untag_ptr(b);
81754         jboolean ret_conv = Currency_eq(a_conv, b_conv);
81755         return ret_conv;
81756 }
81757
81758 void  __attribute__((export_name("TS_Sha256_free"))) TS_Sha256_free(uint64_t this_obj) {
81759         LDKSha256 this_obj_conv;
81760         this_obj_conv.inner = untag_ptr(this_obj);
81761         this_obj_conv.is_owned = ptr_is_owned(this_obj);
81762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
81763         Sha256_free(this_obj_conv);
81764 }
81765
81766 static inline uint64_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
81767         LDKSha256 ret_var = Sha256_clone(arg);
81768         uint64_t ret_ref = 0;
81769         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81770         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81771         return ret_ref;
81772 }
81773 int64_t  __attribute__((export_name("TS_Sha256_clone_ptr"))) TS_Sha256_clone_ptr(uint64_t arg) {
81774         LDKSha256 arg_conv;
81775         arg_conv.inner = untag_ptr(arg);
81776         arg_conv.is_owned = ptr_is_owned(arg);
81777         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
81778         arg_conv.is_owned = false;
81779         int64_t ret_conv = Sha256_clone_ptr(&arg_conv);
81780         return ret_conv;
81781 }
81782
81783 uint64_t  __attribute__((export_name("TS_Sha256_clone"))) TS_Sha256_clone(uint64_t orig) {
81784         LDKSha256 orig_conv;
81785         orig_conv.inner = untag_ptr(orig);
81786         orig_conv.is_owned = ptr_is_owned(orig);
81787         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
81788         orig_conv.is_owned = false;
81789         LDKSha256 ret_var = Sha256_clone(&orig_conv);
81790         uint64_t ret_ref = 0;
81791         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81792         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81793         return ret_ref;
81794 }
81795
81796 int64_t  __attribute__((export_name("TS_Sha256_hash"))) TS_Sha256_hash(uint64_t o) {
81797         LDKSha256 o_conv;
81798         o_conv.inner = untag_ptr(o);
81799         o_conv.is_owned = ptr_is_owned(o);
81800         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
81801         o_conv.is_owned = false;
81802         int64_t ret_conv = Sha256_hash(&o_conv);
81803         return ret_conv;
81804 }
81805
81806 jboolean  __attribute__((export_name("TS_Sha256_eq"))) TS_Sha256_eq(uint64_t a, uint64_t b) {
81807         LDKSha256 a_conv;
81808         a_conv.inner = untag_ptr(a);
81809         a_conv.is_owned = ptr_is_owned(a);
81810         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
81811         a_conv.is_owned = false;
81812         LDKSha256 b_conv;
81813         b_conv.inner = untag_ptr(b);
81814         b_conv.is_owned = ptr_is_owned(b);
81815         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
81816         b_conv.is_owned = false;
81817         jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
81818         return ret_conv;
81819 }
81820
81821 uint64_t  __attribute__((export_name("TS_Sha256_from_bytes"))) TS_Sha256_from_bytes(int8_tArray bytes) {
81822         uint8_t bytes_arr[32];
81823         CHECK(bytes->arr_len == 32);
81824         memcpy(bytes_arr, bytes->elems, 32); FREE(bytes);
81825         uint8_t (*bytes_ref)[32] = &bytes_arr;
81826         LDKSha256 ret_var = Sha256_from_bytes(bytes_ref);
81827         uint64_t ret_ref = 0;
81828         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81829         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81830         return ret_ref;
81831 }
81832
81833 void  __attribute__((export_name("TS_Description_free"))) TS_Description_free(uint64_t this_obj) {
81834         LDKDescription this_obj_conv;
81835         this_obj_conv.inner = untag_ptr(this_obj);
81836         this_obj_conv.is_owned = ptr_is_owned(this_obj);
81837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
81838         Description_free(this_obj_conv);
81839 }
81840
81841 static inline uint64_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
81842         LDKDescription ret_var = Description_clone(arg);
81843         uint64_t ret_ref = 0;
81844         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81845         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81846         return ret_ref;
81847 }
81848 int64_t  __attribute__((export_name("TS_Description_clone_ptr"))) TS_Description_clone_ptr(uint64_t arg) {
81849         LDKDescription arg_conv;
81850         arg_conv.inner = untag_ptr(arg);
81851         arg_conv.is_owned = ptr_is_owned(arg);
81852         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
81853         arg_conv.is_owned = false;
81854         int64_t ret_conv = Description_clone_ptr(&arg_conv);
81855         return ret_conv;
81856 }
81857
81858 uint64_t  __attribute__((export_name("TS_Description_clone"))) TS_Description_clone(uint64_t orig) {
81859         LDKDescription orig_conv;
81860         orig_conv.inner = untag_ptr(orig);
81861         orig_conv.is_owned = ptr_is_owned(orig);
81862         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
81863         orig_conv.is_owned = false;
81864         LDKDescription ret_var = Description_clone(&orig_conv);
81865         uint64_t ret_ref = 0;
81866         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81867         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81868         return ret_ref;
81869 }
81870
81871 int64_t  __attribute__((export_name("TS_Description_hash"))) TS_Description_hash(uint64_t o) {
81872         LDKDescription o_conv;
81873         o_conv.inner = untag_ptr(o);
81874         o_conv.is_owned = ptr_is_owned(o);
81875         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
81876         o_conv.is_owned = false;
81877         int64_t ret_conv = Description_hash(&o_conv);
81878         return ret_conv;
81879 }
81880
81881 jboolean  __attribute__((export_name("TS_Description_eq"))) TS_Description_eq(uint64_t a, uint64_t b) {
81882         LDKDescription a_conv;
81883         a_conv.inner = untag_ptr(a);
81884         a_conv.is_owned = ptr_is_owned(a);
81885         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
81886         a_conv.is_owned = false;
81887         LDKDescription b_conv;
81888         b_conv.inner = untag_ptr(b);
81889         b_conv.is_owned = ptr_is_owned(b);
81890         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
81891         b_conv.is_owned = false;
81892         jboolean ret_conv = Description_eq(&a_conv, &b_conv);
81893         return ret_conv;
81894 }
81895
81896 void  __attribute__((export_name("TS_PayeePubKey_free"))) TS_PayeePubKey_free(uint64_t this_obj) {
81897         LDKPayeePubKey this_obj_conv;
81898         this_obj_conv.inner = untag_ptr(this_obj);
81899         this_obj_conv.is_owned = ptr_is_owned(this_obj);
81900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
81901         PayeePubKey_free(this_obj_conv);
81902 }
81903
81904 int8_tArray  __attribute__((export_name("TS_PayeePubKey_get_a"))) TS_PayeePubKey_get_a(uint64_t this_ptr) {
81905         LDKPayeePubKey this_ptr_conv;
81906         this_ptr_conv.inner = untag_ptr(this_ptr);
81907         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81909         this_ptr_conv.is_owned = false;
81910         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
81911         memcpy(ret_arr->elems, PayeePubKey_get_a(&this_ptr_conv).compressed_form, 33);
81912         return ret_arr;
81913 }
81914
81915 void  __attribute__((export_name("TS_PayeePubKey_set_a"))) TS_PayeePubKey_set_a(uint64_t this_ptr, int8_tArray val) {
81916         LDKPayeePubKey this_ptr_conv;
81917         this_ptr_conv.inner = untag_ptr(this_ptr);
81918         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81920         this_ptr_conv.is_owned = false;
81921         LDKPublicKey val_ref;
81922         CHECK(val->arr_len == 33);
81923         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
81924         PayeePubKey_set_a(&this_ptr_conv, val_ref);
81925 }
81926
81927 uint64_t  __attribute__((export_name("TS_PayeePubKey_new"))) TS_PayeePubKey_new(int8_tArray a_arg) {
81928         LDKPublicKey a_arg_ref;
81929         CHECK(a_arg->arr_len == 33);
81930         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
81931         LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
81932         uint64_t ret_ref = 0;
81933         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81934         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81935         return ret_ref;
81936 }
81937
81938 static inline uint64_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
81939         LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
81940         uint64_t ret_ref = 0;
81941         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81942         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81943         return ret_ref;
81944 }
81945 int64_t  __attribute__((export_name("TS_PayeePubKey_clone_ptr"))) TS_PayeePubKey_clone_ptr(uint64_t arg) {
81946         LDKPayeePubKey arg_conv;
81947         arg_conv.inner = untag_ptr(arg);
81948         arg_conv.is_owned = ptr_is_owned(arg);
81949         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
81950         arg_conv.is_owned = false;
81951         int64_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
81952         return ret_conv;
81953 }
81954
81955 uint64_t  __attribute__((export_name("TS_PayeePubKey_clone"))) TS_PayeePubKey_clone(uint64_t orig) {
81956         LDKPayeePubKey orig_conv;
81957         orig_conv.inner = untag_ptr(orig);
81958         orig_conv.is_owned = ptr_is_owned(orig);
81959         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
81960         orig_conv.is_owned = false;
81961         LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
81962         uint64_t ret_ref = 0;
81963         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81964         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81965         return ret_ref;
81966 }
81967
81968 int64_t  __attribute__((export_name("TS_PayeePubKey_hash"))) TS_PayeePubKey_hash(uint64_t o) {
81969         LDKPayeePubKey o_conv;
81970         o_conv.inner = untag_ptr(o);
81971         o_conv.is_owned = ptr_is_owned(o);
81972         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
81973         o_conv.is_owned = false;
81974         int64_t ret_conv = PayeePubKey_hash(&o_conv);
81975         return ret_conv;
81976 }
81977
81978 jboolean  __attribute__((export_name("TS_PayeePubKey_eq"))) TS_PayeePubKey_eq(uint64_t a, uint64_t b) {
81979         LDKPayeePubKey a_conv;
81980         a_conv.inner = untag_ptr(a);
81981         a_conv.is_owned = ptr_is_owned(a);
81982         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
81983         a_conv.is_owned = false;
81984         LDKPayeePubKey b_conv;
81985         b_conv.inner = untag_ptr(b);
81986         b_conv.is_owned = ptr_is_owned(b);
81987         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
81988         b_conv.is_owned = false;
81989         jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
81990         return ret_conv;
81991 }
81992
81993 void  __attribute__((export_name("TS_ExpiryTime_free"))) TS_ExpiryTime_free(uint64_t this_obj) {
81994         LDKExpiryTime this_obj_conv;
81995         this_obj_conv.inner = untag_ptr(this_obj);
81996         this_obj_conv.is_owned = ptr_is_owned(this_obj);
81997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
81998         ExpiryTime_free(this_obj_conv);
81999 }
82000
82001 static inline uint64_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
82002         LDKExpiryTime ret_var = ExpiryTime_clone(arg);
82003         uint64_t ret_ref = 0;
82004         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82005         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82006         return ret_ref;
82007 }
82008 int64_t  __attribute__((export_name("TS_ExpiryTime_clone_ptr"))) TS_ExpiryTime_clone_ptr(uint64_t arg) {
82009         LDKExpiryTime arg_conv;
82010         arg_conv.inner = untag_ptr(arg);
82011         arg_conv.is_owned = ptr_is_owned(arg);
82012         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
82013         arg_conv.is_owned = false;
82014         int64_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
82015         return ret_conv;
82016 }
82017
82018 uint64_t  __attribute__((export_name("TS_ExpiryTime_clone"))) TS_ExpiryTime_clone(uint64_t orig) {
82019         LDKExpiryTime orig_conv;
82020         orig_conv.inner = untag_ptr(orig);
82021         orig_conv.is_owned = ptr_is_owned(orig);
82022         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
82023         orig_conv.is_owned = false;
82024         LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
82025         uint64_t ret_ref = 0;
82026         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82027         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82028         return ret_ref;
82029 }
82030
82031 int64_t  __attribute__((export_name("TS_ExpiryTime_hash"))) TS_ExpiryTime_hash(uint64_t o) {
82032         LDKExpiryTime o_conv;
82033         o_conv.inner = untag_ptr(o);
82034         o_conv.is_owned = ptr_is_owned(o);
82035         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
82036         o_conv.is_owned = false;
82037         int64_t ret_conv = ExpiryTime_hash(&o_conv);
82038         return ret_conv;
82039 }
82040
82041 jboolean  __attribute__((export_name("TS_ExpiryTime_eq"))) TS_ExpiryTime_eq(uint64_t a, uint64_t b) {
82042         LDKExpiryTime a_conv;
82043         a_conv.inner = untag_ptr(a);
82044         a_conv.is_owned = ptr_is_owned(a);
82045         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
82046         a_conv.is_owned = false;
82047         LDKExpiryTime b_conv;
82048         b_conv.inner = untag_ptr(b);
82049         b_conv.is_owned = ptr_is_owned(b);
82050         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
82051         b_conv.is_owned = false;
82052         jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
82053         return ret_conv;
82054 }
82055
82056 void  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_free"))) TS_MinFinalCltvExpiryDelta_free(uint64_t this_obj) {
82057         LDKMinFinalCltvExpiryDelta this_obj_conv;
82058         this_obj_conv.inner = untag_ptr(this_obj);
82059         this_obj_conv.is_owned = ptr_is_owned(this_obj);
82060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
82061         MinFinalCltvExpiryDelta_free(this_obj_conv);
82062 }
82063
82064 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_get_a"))) TS_MinFinalCltvExpiryDelta_get_a(uint64_t this_ptr) {
82065         LDKMinFinalCltvExpiryDelta this_ptr_conv;
82066         this_ptr_conv.inner = untag_ptr(this_ptr);
82067         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82069         this_ptr_conv.is_owned = false;
82070         int64_t ret_conv = MinFinalCltvExpiryDelta_get_a(&this_ptr_conv);
82071         return ret_conv;
82072 }
82073
82074 void  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_set_a"))) TS_MinFinalCltvExpiryDelta_set_a(uint64_t this_ptr, int64_t val) {
82075         LDKMinFinalCltvExpiryDelta this_ptr_conv;
82076         this_ptr_conv.inner = untag_ptr(this_ptr);
82077         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82079         this_ptr_conv.is_owned = false;
82080         MinFinalCltvExpiryDelta_set_a(&this_ptr_conv, val);
82081 }
82082
82083 uint64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_new"))) TS_MinFinalCltvExpiryDelta_new(int64_t a_arg) {
82084         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_new(a_arg);
82085         uint64_t ret_ref = 0;
82086         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82087         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82088         return ret_ref;
82089 }
82090
82091 static inline uint64_t MinFinalCltvExpiryDelta_clone_ptr(LDKMinFinalCltvExpiryDelta *NONNULL_PTR arg) {
82092         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(arg);
82093         uint64_t ret_ref = 0;
82094         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82095         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82096         return ret_ref;
82097 }
82098 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_clone_ptr"))) TS_MinFinalCltvExpiryDelta_clone_ptr(uint64_t arg) {
82099         LDKMinFinalCltvExpiryDelta arg_conv;
82100         arg_conv.inner = untag_ptr(arg);
82101         arg_conv.is_owned = ptr_is_owned(arg);
82102         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
82103         arg_conv.is_owned = false;
82104         int64_t ret_conv = MinFinalCltvExpiryDelta_clone_ptr(&arg_conv);
82105         return ret_conv;
82106 }
82107
82108 uint64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_clone"))) TS_MinFinalCltvExpiryDelta_clone(uint64_t orig) {
82109         LDKMinFinalCltvExpiryDelta orig_conv;
82110         orig_conv.inner = untag_ptr(orig);
82111         orig_conv.is_owned = ptr_is_owned(orig);
82112         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
82113         orig_conv.is_owned = false;
82114         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(&orig_conv);
82115         uint64_t ret_ref = 0;
82116         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82117         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82118         return ret_ref;
82119 }
82120
82121 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_hash"))) TS_MinFinalCltvExpiryDelta_hash(uint64_t o) {
82122         LDKMinFinalCltvExpiryDelta o_conv;
82123         o_conv.inner = untag_ptr(o);
82124         o_conv.is_owned = ptr_is_owned(o);
82125         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
82126         o_conv.is_owned = false;
82127         int64_t ret_conv = MinFinalCltvExpiryDelta_hash(&o_conv);
82128         return ret_conv;
82129 }
82130
82131 jboolean  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_eq"))) TS_MinFinalCltvExpiryDelta_eq(uint64_t a, uint64_t b) {
82132         LDKMinFinalCltvExpiryDelta a_conv;
82133         a_conv.inner = untag_ptr(a);
82134         a_conv.is_owned = ptr_is_owned(a);
82135         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
82136         a_conv.is_owned = false;
82137         LDKMinFinalCltvExpiryDelta b_conv;
82138         b_conv.inner = untag_ptr(b);
82139         b_conv.is_owned = ptr_is_owned(b);
82140         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
82141         b_conv.is_owned = false;
82142         jboolean ret_conv = MinFinalCltvExpiryDelta_eq(&a_conv, &b_conv);
82143         return ret_conv;
82144 }
82145
82146 void  __attribute__((export_name("TS_Fallback_free"))) TS_Fallback_free(uint64_t this_ptr) {
82147         if (!ptr_is_owned(this_ptr)) return;
82148         void* this_ptr_ptr = untag_ptr(this_ptr);
82149         CHECK_ACCESS(this_ptr_ptr);
82150         LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
82151         FREE(untag_ptr(this_ptr));
82152         Fallback_free(this_ptr_conv);
82153 }
82154
82155 static inline uint64_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
82156         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
82157         *ret_copy = Fallback_clone(arg);
82158         uint64_t ret_ref = tag_ptr(ret_copy, true);
82159         return ret_ref;
82160 }
82161 int64_t  __attribute__((export_name("TS_Fallback_clone_ptr"))) TS_Fallback_clone_ptr(uint64_t arg) {
82162         LDKFallback* arg_conv = (LDKFallback*)untag_ptr(arg);
82163         int64_t ret_conv = Fallback_clone_ptr(arg_conv);
82164         return ret_conv;
82165 }
82166
82167 uint64_t  __attribute__((export_name("TS_Fallback_clone"))) TS_Fallback_clone(uint64_t orig) {
82168         LDKFallback* orig_conv = (LDKFallback*)untag_ptr(orig);
82169         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
82170         *ret_copy = Fallback_clone(orig_conv);
82171         uint64_t ret_ref = tag_ptr(ret_copy, true);
82172         return ret_ref;
82173 }
82174
82175 uint64_t  __attribute__((export_name("TS_Fallback_seg_wit_program"))) TS_Fallback_seg_wit_program(int8_t version, int8_tArray program) {
82176         
82177         LDKCVec_u8Z program_ref;
82178         program_ref.datalen = program->arr_len;
82179         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
82180         memcpy(program_ref.data, program->elems, program_ref.datalen); FREE(program);
82181         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
82182         *ret_copy = Fallback_seg_wit_program((LDKWitnessVersion){ ._0 = version }, program_ref);
82183         uint64_t ret_ref = tag_ptr(ret_copy, true);
82184         return ret_ref;
82185 }
82186
82187 uint64_t  __attribute__((export_name("TS_Fallback_pub_key_hash"))) TS_Fallback_pub_key_hash(int8_tArray a) {
82188         LDKTwentyBytes a_ref;
82189         CHECK(a->arr_len == 20);
82190         memcpy(a_ref.data, a->elems, 20); FREE(a);
82191         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
82192         *ret_copy = Fallback_pub_key_hash(a_ref);
82193         uint64_t ret_ref = tag_ptr(ret_copy, true);
82194         return ret_ref;
82195 }
82196
82197 uint64_t  __attribute__((export_name("TS_Fallback_script_hash"))) TS_Fallback_script_hash(int8_tArray a) {
82198         LDKTwentyBytes a_ref;
82199         CHECK(a->arr_len == 20);
82200         memcpy(a_ref.data, a->elems, 20); FREE(a);
82201         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
82202         *ret_copy = Fallback_script_hash(a_ref);
82203         uint64_t ret_ref = tag_ptr(ret_copy, true);
82204         return ret_ref;
82205 }
82206
82207 int64_t  __attribute__((export_name("TS_Fallback_hash"))) TS_Fallback_hash(uint64_t o) {
82208         LDKFallback* o_conv = (LDKFallback*)untag_ptr(o);
82209         int64_t ret_conv = Fallback_hash(o_conv);
82210         return ret_conv;
82211 }
82212
82213 jboolean  __attribute__((export_name("TS_Fallback_eq"))) TS_Fallback_eq(uint64_t a, uint64_t b) {
82214         LDKFallback* a_conv = (LDKFallback*)untag_ptr(a);
82215         LDKFallback* b_conv = (LDKFallback*)untag_ptr(b);
82216         jboolean ret_conv = Fallback_eq(a_conv, b_conv);
82217         return ret_conv;
82218 }
82219
82220 void  __attribute__((export_name("TS_Bolt11InvoiceSignature_free"))) TS_Bolt11InvoiceSignature_free(uint64_t this_obj) {
82221         LDKBolt11InvoiceSignature this_obj_conv;
82222         this_obj_conv.inner = untag_ptr(this_obj);
82223         this_obj_conv.is_owned = ptr_is_owned(this_obj);
82224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
82225         Bolt11InvoiceSignature_free(this_obj_conv);
82226 }
82227
82228 static inline uint64_t Bolt11InvoiceSignature_clone_ptr(LDKBolt11InvoiceSignature *NONNULL_PTR arg) {
82229         LDKBolt11InvoiceSignature ret_var = Bolt11InvoiceSignature_clone(arg);
82230         uint64_t ret_ref = 0;
82231         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82232         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82233         return ret_ref;
82234 }
82235 int64_t  __attribute__((export_name("TS_Bolt11InvoiceSignature_clone_ptr"))) TS_Bolt11InvoiceSignature_clone_ptr(uint64_t arg) {
82236         LDKBolt11InvoiceSignature arg_conv;
82237         arg_conv.inner = untag_ptr(arg);
82238         arg_conv.is_owned = ptr_is_owned(arg);
82239         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
82240         arg_conv.is_owned = false;
82241         int64_t ret_conv = Bolt11InvoiceSignature_clone_ptr(&arg_conv);
82242         return ret_conv;
82243 }
82244
82245 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceSignature_clone"))) TS_Bolt11InvoiceSignature_clone(uint64_t orig) {
82246         LDKBolt11InvoiceSignature orig_conv;
82247         orig_conv.inner = untag_ptr(orig);
82248         orig_conv.is_owned = ptr_is_owned(orig);
82249         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
82250         orig_conv.is_owned = false;
82251         LDKBolt11InvoiceSignature ret_var = Bolt11InvoiceSignature_clone(&orig_conv);
82252         uint64_t ret_ref = 0;
82253         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82254         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82255         return ret_ref;
82256 }
82257
82258 int64_t  __attribute__((export_name("TS_Bolt11InvoiceSignature_hash"))) TS_Bolt11InvoiceSignature_hash(uint64_t o) {
82259         LDKBolt11InvoiceSignature o_conv;
82260         o_conv.inner = untag_ptr(o);
82261         o_conv.is_owned = ptr_is_owned(o);
82262         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
82263         o_conv.is_owned = false;
82264         int64_t ret_conv = Bolt11InvoiceSignature_hash(&o_conv);
82265         return ret_conv;
82266 }
82267
82268 jboolean  __attribute__((export_name("TS_Bolt11InvoiceSignature_eq"))) TS_Bolt11InvoiceSignature_eq(uint64_t a, uint64_t b) {
82269         LDKBolt11InvoiceSignature a_conv;
82270         a_conv.inner = untag_ptr(a);
82271         a_conv.is_owned = ptr_is_owned(a);
82272         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
82273         a_conv.is_owned = false;
82274         LDKBolt11InvoiceSignature b_conv;
82275         b_conv.inner = untag_ptr(b);
82276         b_conv.is_owned = ptr_is_owned(b);
82277         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
82278         b_conv.is_owned = false;
82279         jboolean ret_conv = Bolt11InvoiceSignature_eq(&a_conv, &b_conv);
82280         return ret_conv;
82281 }
82282
82283 void  __attribute__((export_name("TS_PrivateRoute_free"))) TS_PrivateRoute_free(uint64_t this_obj) {
82284         LDKPrivateRoute this_obj_conv;
82285         this_obj_conv.inner = untag_ptr(this_obj);
82286         this_obj_conv.is_owned = ptr_is_owned(this_obj);
82287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
82288         PrivateRoute_free(this_obj_conv);
82289 }
82290
82291 static inline uint64_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
82292         LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
82293         uint64_t ret_ref = 0;
82294         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82295         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82296         return ret_ref;
82297 }
82298 int64_t  __attribute__((export_name("TS_PrivateRoute_clone_ptr"))) TS_PrivateRoute_clone_ptr(uint64_t arg) {
82299         LDKPrivateRoute arg_conv;
82300         arg_conv.inner = untag_ptr(arg);
82301         arg_conv.is_owned = ptr_is_owned(arg);
82302         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
82303         arg_conv.is_owned = false;
82304         int64_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
82305         return ret_conv;
82306 }
82307
82308 uint64_t  __attribute__((export_name("TS_PrivateRoute_clone"))) TS_PrivateRoute_clone(uint64_t orig) {
82309         LDKPrivateRoute orig_conv;
82310         orig_conv.inner = untag_ptr(orig);
82311         orig_conv.is_owned = ptr_is_owned(orig);
82312         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
82313         orig_conv.is_owned = false;
82314         LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
82315         uint64_t ret_ref = 0;
82316         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82317         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82318         return ret_ref;
82319 }
82320
82321 int64_t  __attribute__((export_name("TS_PrivateRoute_hash"))) TS_PrivateRoute_hash(uint64_t o) {
82322         LDKPrivateRoute o_conv;
82323         o_conv.inner = untag_ptr(o);
82324         o_conv.is_owned = ptr_is_owned(o);
82325         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
82326         o_conv.is_owned = false;
82327         int64_t ret_conv = PrivateRoute_hash(&o_conv);
82328         return ret_conv;
82329 }
82330
82331 jboolean  __attribute__((export_name("TS_PrivateRoute_eq"))) TS_PrivateRoute_eq(uint64_t a, uint64_t b) {
82332         LDKPrivateRoute a_conv;
82333         a_conv.inner = untag_ptr(a);
82334         a_conv.is_owned = ptr_is_owned(a);
82335         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
82336         a_conv.is_owned = false;
82337         LDKPrivateRoute b_conv;
82338         b_conv.inner = untag_ptr(b);
82339         b_conv.is_owned = ptr_is_owned(b);
82340         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
82341         b_conv.is_owned = false;
82342         jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
82343         return ret_conv;
82344 }
82345
82346 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_into_parts"))) TS_SignedRawBolt11Invoice_into_parts(uint64_t this_arg) {
82347         LDKSignedRawBolt11Invoice this_arg_conv;
82348         this_arg_conv.inner = untag_ptr(this_arg);
82349         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82351         this_arg_conv = SignedRawBolt11Invoice_clone(&this_arg_conv);
82352         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
82353         *ret_conv = SignedRawBolt11Invoice_into_parts(this_arg_conv);
82354         return tag_ptr(ret_conv, true);
82355 }
82356
82357 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_raw_invoice"))) TS_SignedRawBolt11Invoice_raw_invoice(uint64_t this_arg) {
82358         LDKSignedRawBolt11Invoice 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         LDKRawBolt11Invoice ret_var = SignedRawBolt11Invoice_raw_invoice(&this_arg_conv);
82364         uint64_t ret_ref = 0;
82365         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82366         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82367         return ret_ref;
82368 }
82369
82370 int8_tArray  __attribute__((export_name("TS_SignedRawBolt11Invoice_signable_hash"))) TS_SignedRawBolt11Invoice_signable_hash(uint64_t this_arg) {
82371         LDKSignedRawBolt11Invoice this_arg_conv;
82372         this_arg_conv.inner = untag_ptr(this_arg);
82373         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82375         this_arg_conv.is_owned = false;
82376         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
82377         memcpy(ret_arr->elems, *SignedRawBolt11Invoice_signable_hash(&this_arg_conv), 32);
82378         return ret_arr;
82379 }
82380
82381 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_signature"))) TS_SignedRawBolt11Invoice_signature(uint64_t this_arg) {
82382         LDKSignedRawBolt11Invoice this_arg_conv;
82383         this_arg_conv.inner = untag_ptr(this_arg);
82384         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82386         this_arg_conv.is_owned = false;
82387         LDKBolt11InvoiceSignature ret_var = SignedRawBolt11Invoice_signature(&this_arg_conv);
82388         uint64_t ret_ref = 0;
82389         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82390         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82391         return ret_ref;
82392 }
82393
82394 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_recover_payee_pub_key"))) TS_SignedRawBolt11Invoice_recover_payee_pub_key(uint64_t this_arg) {
82395         LDKSignedRawBolt11Invoice this_arg_conv;
82396         this_arg_conv.inner = untag_ptr(this_arg);
82397         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82399         this_arg_conv.is_owned = false;
82400         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
82401         *ret_conv = SignedRawBolt11Invoice_recover_payee_pub_key(&this_arg_conv);
82402         return tag_ptr(ret_conv, true);
82403 }
82404
82405 jboolean  __attribute__((export_name("TS_SignedRawBolt11Invoice_check_signature"))) TS_SignedRawBolt11Invoice_check_signature(uint64_t this_arg) {
82406         LDKSignedRawBolt11Invoice this_arg_conv;
82407         this_arg_conv.inner = untag_ptr(this_arg);
82408         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82410         this_arg_conv.is_owned = false;
82411         jboolean ret_conv = SignedRawBolt11Invoice_check_signature(&this_arg_conv);
82412         return ret_conv;
82413 }
82414
82415 int8_tArray  __attribute__((export_name("TS_RawBolt11Invoice_signable_hash"))) TS_RawBolt11Invoice_signable_hash(uint64_t this_arg) {
82416         LDKRawBolt11Invoice this_arg_conv;
82417         this_arg_conv.inner = untag_ptr(this_arg);
82418         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82420         this_arg_conv.is_owned = false;
82421         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
82422         memcpy(ret_arr->elems, RawBolt11Invoice_signable_hash(&this_arg_conv).data, 32);
82423         return ret_arr;
82424 }
82425
82426 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_payment_hash"))) TS_RawBolt11Invoice_payment_hash(uint64_t this_arg) {
82427         LDKRawBolt11Invoice this_arg_conv;
82428         this_arg_conv.inner = untag_ptr(this_arg);
82429         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82431         this_arg_conv.is_owned = false;
82432         LDKSha256 ret_var = RawBolt11Invoice_payment_hash(&this_arg_conv);
82433         uint64_t ret_ref = 0;
82434         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82435         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82436         return ret_ref;
82437 }
82438
82439 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_description"))) TS_RawBolt11Invoice_description(uint64_t this_arg) {
82440         LDKRawBolt11Invoice this_arg_conv;
82441         this_arg_conv.inner = untag_ptr(this_arg);
82442         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82444         this_arg_conv.is_owned = false;
82445         LDKDescription ret_var = RawBolt11Invoice_description(&this_arg_conv);
82446         uint64_t ret_ref = 0;
82447         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82448         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82449         return ret_ref;
82450 }
82451
82452 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_payee_pub_key"))) TS_RawBolt11Invoice_payee_pub_key(uint64_t this_arg) {
82453         LDKRawBolt11Invoice this_arg_conv;
82454         this_arg_conv.inner = untag_ptr(this_arg);
82455         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82457         this_arg_conv.is_owned = false;
82458         LDKPayeePubKey ret_var = RawBolt11Invoice_payee_pub_key(&this_arg_conv);
82459         uint64_t ret_ref = 0;
82460         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82461         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82462         return ret_ref;
82463 }
82464
82465 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_description_hash"))) TS_RawBolt11Invoice_description_hash(uint64_t this_arg) {
82466         LDKRawBolt11Invoice this_arg_conv;
82467         this_arg_conv.inner = untag_ptr(this_arg);
82468         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82470         this_arg_conv.is_owned = false;
82471         LDKSha256 ret_var = RawBolt11Invoice_description_hash(&this_arg_conv);
82472         uint64_t ret_ref = 0;
82473         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82474         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82475         return ret_ref;
82476 }
82477
82478 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_expiry_time"))) TS_RawBolt11Invoice_expiry_time(uint64_t this_arg) {
82479         LDKRawBolt11Invoice this_arg_conv;
82480         this_arg_conv.inner = untag_ptr(this_arg);
82481         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82483         this_arg_conv.is_owned = false;
82484         LDKExpiryTime ret_var = RawBolt11Invoice_expiry_time(&this_arg_conv);
82485         uint64_t ret_ref = 0;
82486         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82487         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82488         return ret_ref;
82489 }
82490
82491 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_min_final_cltv_expiry_delta"))) TS_RawBolt11Invoice_min_final_cltv_expiry_delta(uint64_t this_arg) {
82492         LDKRawBolt11Invoice this_arg_conv;
82493         this_arg_conv.inner = untag_ptr(this_arg);
82494         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82496         this_arg_conv.is_owned = false;
82497         LDKMinFinalCltvExpiryDelta ret_var = RawBolt11Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
82498         uint64_t ret_ref = 0;
82499         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82500         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82501         return ret_ref;
82502 }
82503
82504 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_payment_secret"))) TS_RawBolt11Invoice_payment_secret(uint64_t this_arg) {
82505         LDKRawBolt11Invoice this_arg_conv;
82506         this_arg_conv.inner = untag_ptr(this_arg);
82507         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82509         this_arg_conv.is_owned = false;
82510         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
82511         *ret_copy = RawBolt11Invoice_payment_secret(&this_arg_conv);
82512         uint64_t ret_ref = tag_ptr(ret_copy, true);
82513         return ret_ref;
82514 }
82515
82516 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_payment_metadata"))) TS_RawBolt11Invoice_payment_metadata(uint64_t this_arg) {
82517         LDKRawBolt11Invoice this_arg_conv;
82518         this_arg_conv.inner = untag_ptr(this_arg);
82519         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82521         this_arg_conv.is_owned = false;
82522         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
82523         *ret_copy = RawBolt11Invoice_payment_metadata(&this_arg_conv);
82524         uint64_t ret_ref = tag_ptr(ret_copy, true);
82525         return ret_ref;
82526 }
82527
82528 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_features"))) TS_RawBolt11Invoice_features(uint64_t this_arg) {
82529         LDKRawBolt11Invoice this_arg_conv;
82530         this_arg_conv.inner = untag_ptr(this_arg);
82531         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82533         this_arg_conv.is_owned = false;
82534         LDKBolt11InvoiceFeatures ret_var = RawBolt11Invoice_features(&this_arg_conv);
82535         uint64_t ret_ref = 0;
82536         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82537         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82538         return ret_ref;
82539 }
82540
82541 uint64_tArray  __attribute__((export_name("TS_RawBolt11Invoice_private_routes"))) TS_RawBolt11Invoice_private_routes(uint64_t this_arg) {
82542         LDKRawBolt11Invoice this_arg_conv;
82543         this_arg_conv.inner = untag_ptr(this_arg);
82544         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82546         this_arg_conv.is_owned = false;
82547         LDKCVec_PrivateRouteZ ret_var = RawBolt11Invoice_private_routes(&this_arg_conv);
82548         uint64_tArray ret_arr = NULL;
82549         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
82550         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
82551         for (size_t o = 0; o < ret_var.datalen; o++) {
82552                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
82553                 uint64_t ret_conv_14_ref = 0;
82554                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
82555                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
82556                 ret_arr_ptr[o] = ret_conv_14_ref;
82557         }
82558         
82559         FREE(ret_var.data);
82560         return ret_arr;
82561 }
82562
82563 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_amount_pico_btc"))) TS_RawBolt11Invoice_amount_pico_btc(uint64_t this_arg) {
82564         LDKRawBolt11Invoice this_arg_conv;
82565         this_arg_conv.inner = untag_ptr(this_arg);
82566         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82568         this_arg_conv.is_owned = false;
82569         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
82570         *ret_copy = RawBolt11Invoice_amount_pico_btc(&this_arg_conv);
82571         uint64_t ret_ref = tag_ptr(ret_copy, true);
82572         return ret_ref;
82573 }
82574
82575 uint32_t  __attribute__((export_name("TS_RawBolt11Invoice_currency"))) TS_RawBolt11Invoice_currency(uint64_t this_arg) {
82576         LDKRawBolt11Invoice this_arg_conv;
82577         this_arg_conv.inner = untag_ptr(this_arg);
82578         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82580         this_arg_conv.is_owned = false;
82581         uint32_t ret_conv = LDKCurrency_to_js(RawBolt11Invoice_currency(&this_arg_conv));
82582         return ret_conv;
82583 }
82584
82585 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_from_unix_timestamp"))) TS_PositiveTimestamp_from_unix_timestamp(int64_t unix_seconds) {
82586         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
82587         *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
82588         return tag_ptr(ret_conv, true);
82589 }
82590
82591 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_from_duration_since_epoch"))) TS_PositiveTimestamp_from_duration_since_epoch(int64_t duration) {
82592         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
82593         *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
82594         return tag_ptr(ret_conv, true);
82595 }
82596
82597 int64_t  __attribute__((export_name("TS_PositiveTimestamp_as_unix_timestamp"))) TS_PositiveTimestamp_as_unix_timestamp(uint64_t this_arg) {
82598         LDKPositiveTimestamp this_arg_conv;
82599         this_arg_conv.inner = untag_ptr(this_arg);
82600         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82602         this_arg_conv.is_owned = false;
82603         int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
82604         return ret_conv;
82605 }
82606
82607 int64_t  __attribute__((export_name("TS_PositiveTimestamp_as_duration_since_epoch"))) TS_PositiveTimestamp_as_duration_since_epoch(uint64_t this_arg) {
82608         LDKPositiveTimestamp this_arg_conv;
82609         this_arg_conv.inner = untag_ptr(this_arg);
82610         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82612         this_arg_conv.is_owned = false;
82613         int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
82614         return ret_conv;
82615 }
82616
82617 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_signable_hash"))) TS_Bolt11Invoice_signable_hash(uint64_t this_arg) {
82618         LDKBolt11Invoice this_arg_conv;
82619         this_arg_conv.inner = untag_ptr(this_arg);
82620         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82622         this_arg_conv.is_owned = false;
82623         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
82624         memcpy(ret_arr->elems, Bolt11Invoice_signable_hash(&this_arg_conv).data, 32);
82625         return ret_arr;
82626 }
82627
82628 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_into_signed_raw"))) TS_Bolt11Invoice_into_signed_raw(uint64_t this_arg) {
82629         LDKBolt11Invoice this_arg_conv;
82630         this_arg_conv.inner = untag_ptr(this_arg);
82631         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82633         this_arg_conv = Bolt11Invoice_clone(&this_arg_conv);
82634         LDKSignedRawBolt11Invoice ret_var = Bolt11Invoice_into_signed_raw(this_arg_conv);
82635         uint64_t ret_ref = 0;
82636         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82637         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82638         return ret_ref;
82639 }
82640
82641 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_check_signature"))) TS_Bolt11Invoice_check_signature(uint64_t this_arg) {
82642         LDKBolt11Invoice this_arg_conv;
82643         this_arg_conv.inner = untag_ptr(this_arg);
82644         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82646         this_arg_conv.is_owned = false;
82647         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
82648         *ret_conv = Bolt11Invoice_check_signature(&this_arg_conv);
82649         return tag_ptr(ret_conv, true);
82650 }
82651
82652 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_from_signed"))) TS_Bolt11Invoice_from_signed(uint64_t signed_invoice) {
82653         LDKSignedRawBolt11Invoice signed_invoice_conv;
82654         signed_invoice_conv.inner = untag_ptr(signed_invoice);
82655         signed_invoice_conv.is_owned = ptr_is_owned(signed_invoice);
82656         CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
82657         signed_invoice_conv = SignedRawBolt11Invoice_clone(&signed_invoice_conv);
82658         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
82659         *ret_conv = Bolt11Invoice_from_signed(signed_invoice_conv);
82660         return tag_ptr(ret_conv, true);
82661 }
82662
82663 int64_t  __attribute__((export_name("TS_Bolt11Invoice_duration_since_epoch"))) TS_Bolt11Invoice_duration_since_epoch(uint64_t this_arg) {
82664         LDKBolt11Invoice this_arg_conv;
82665         this_arg_conv.inner = untag_ptr(this_arg);
82666         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82668         this_arg_conv.is_owned = false;
82669         int64_t ret_conv = Bolt11Invoice_duration_since_epoch(&this_arg_conv);
82670         return ret_conv;
82671 }
82672
82673 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_payment_hash"))) TS_Bolt11Invoice_payment_hash(uint64_t this_arg) {
82674         LDKBolt11Invoice this_arg_conv;
82675         this_arg_conv.inner = untag_ptr(this_arg);
82676         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82678         this_arg_conv.is_owned = false;
82679         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
82680         memcpy(ret_arr->elems, *Bolt11Invoice_payment_hash(&this_arg_conv), 32);
82681         return ret_arr;
82682 }
82683
82684 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_payee_pub_key"))) TS_Bolt11Invoice_payee_pub_key(uint64_t this_arg) {
82685         LDKBolt11Invoice this_arg_conv;
82686         this_arg_conv.inner = untag_ptr(this_arg);
82687         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82689         this_arg_conv.is_owned = false;
82690         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
82691         memcpy(ret_arr->elems, Bolt11Invoice_payee_pub_key(&this_arg_conv).compressed_form, 33);
82692         return ret_arr;
82693 }
82694
82695 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_payment_secret"))) TS_Bolt11Invoice_payment_secret(uint64_t this_arg) {
82696         LDKBolt11Invoice this_arg_conv;
82697         this_arg_conv.inner = untag_ptr(this_arg);
82698         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82700         this_arg_conv.is_owned = false;
82701         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
82702         memcpy(ret_arr->elems, *Bolt11Invoice_payment_secret(&this_arg_conv), 32);
82703         return ret_arr;
82704 }
82705
82706 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_payment_metadata"))) TS_Bolt11Invoice_payment_metadata(uint64_t this_arg) {
82707         LDKBolt11Invoice this_arg_conv;
82708         this_arg_conv.inner = untag_ptr(this_arg);
82709         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82711         this_arg_conv.is_owned = false;
82712         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
82713         *ret_copy = Bolt11Invoice_payment_metadata(&this_arg_conv);
82714         uint64_t ret_ref = tag_ptr(ret_copy, true);
82715         return ret_ref;
82716 }
82717
82718 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_features"))) TS_Bolt11Invoice_features(uint64_t this_arg) {
82719         LDKBolt11Invoice this_arg_conv;
82720         this_arg_conv.inner = untag_ptr(this_arg);
82721         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82723         this_arg_conv.is_owned = false;
82724         LDKBolt11InvoiceFeatures ret_var = Bolt11Invoice_features(&this_arg_conv);
82725         uint64_t ret_ref = 0;
82726         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82727         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82728         return ret_ref;
82729 }
82730
82731 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_recover_payee_pub_key"))) TS_Bolt11Invoice_recover_payee_pub_key(uint64_t this_arg) {
82732         LDKBolt11Invoice this_arg_conv;
82733         this_arg_conv.inner = untag_ptr(this_arg);
82734         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82736         this_arg_conv.is_owned = false;
82737         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
82738         memcpy(ret_arr->elems, Bolt11Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form, 33);
82739         return ret_arr;
82740 }
82741
82742 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_get_payee_pub_key"))) TS_Bolt11Invoice_get_payee_pub_key(uint64_t this_arg) {
82743         LDKBolt11Invoice this_arg_conv;
82744         this_arg_conv.inner = untag_ptr(this_arg);
82745         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82747         this_arg_conv.is_owned = false;
82748         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
82749         memcpy(ret_arr->elems, Bolt11Invoice_get_payee_pub_key(&this_arg_conv).compressed_form, 33);
82750         return ret_arr;
82751 }
82752
82753 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_expires_at"))) TS_Bolt11Invoice_expires_at(uint64_t this_arg) {
82754         LDKBolt11Invoice this_arg_conv;
82755         this_arg_conv.inner = untag_ptr(this_arg);
82756         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82758         this_arg_conv.is_owned = false;
82759         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
82760         *ret_copy = Bolt11Invoice_expires_at(&this_arg_conv);
82761         uint64_t ret_ref = tag_ptr(ret_copy, true);
82762         return ret_ref;
82763 }
82764
82765 int64_t  __attribute__((export_name("TS_Bolt11Invoice_expiry_time"))) TS_Bolt11Invoice_expiry_time(uint64_t this_arg) {
82766         LDKBolt11Invoice this_arg_conv;
82767         this_arg_conv.inner = untag_ptr(this_arg);
82768         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82770         this_arg_conv.is_owned = false;
82771         int64_t ret_conv = Bolt11Invoice_expiry_time(&this_arg_conv);
82772         return ret_conv;
82773 }
82774
82775 int64_t  __attribute__((export_name("TS_Bolt11Invoice_expiration_remaining_from_epoch"))) TS_Bolt11Invoice_expiration_remaining_from_epoch(uint64_t this_arg, int64_t time) {
82776         LDKBolt11Invoice this_arg_conv;
82777         this_arg_conv.inner = untag_ptr(this_arg);
82778         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82780         this_arg_conv.is_owned = false;
82781         int64_t ret_conv = Bolt11Invoice_expiration_remaining_from_epoch(&this_arg_conv, time);
82782         return ret_conv;
82783 }
82784
82785 jboolean  __attribute__((export_name("TS_Bolt11Invoice_would_expire"))) TS_Bolt11Invoice_would_expire(uint64_t this_arg, int64_t at_time) {
82786         LDKBolt11Invoice this_arg_conv;
82787         this_arg_conv.inner = untag_ptr(this_arg);
82788         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82790         this_arg_conv.is_owned = false;
82791         jboolean ret_conv = Bolt11Invoice_would_expire(&this_arg_conv, at_time);
82792         return ret_conv;
82793 }
82794
82795 int64_t  __attribute__((export_name("TS_Bolt11Invoice_min_final_cltv_expiry_delta"))) TS_Bolt11Invoice_min_final_cltv_expiry_delta(uint64_t this_arg) {
82796         LDKBolt11Invoice this_arg_conv;
82797         this_arg_conv.inner = untag_ptr(this_arg);
82798         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82800         this_arg_conv.is_owned = false;
82801         int64_t ret_conv = Bolt11Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
82802         return ret_conv;
82803 }
82804
82805 ptrArray  __attribute__((export_name("TS_Bolt11Invoice_fallback_addresses"))) TS_Bolt11Invoice_fallback_addresses(uint64_t this_arg) {
82806         LDKBolt11Invoice this_arg_conv;
82807         this_arg_conv.inner = untag_ptr(this_arg);
82808         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82810         this_arg_conv.is_owned = false;
82811         LDKCVec_StrZ ret_var = Bolt11Invoice_fallback_addresses(&this_arg_conv);
82812         ptrArray ret_arr = NULL;
82813         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
82814         jstring *ret_arr_ptr = (jstring*)(((uint8_t*)ret_arr) + 8);
82815         for (size_t i = 0; i < ret_var.datalen; i++) {
82816                 LDKStr ret_conv_8_str = ret_var.data[i];
82817                 jstring ret_conv_8_conv = str_ref_to_ts(ret_conv_8_str.chars, ret_conv_8_str.len);
82818                 Str_free(ret_conv_8_str);
82819                 ret_arr_ptr[i] = ret_conv_8_conv;
82820         }
82821         
82822         FREE(ret_var.data);
82823         return ret_arr;
82824 }
82825
82826 uint64_tArray  __attribute__((export_name("TS_Bolt11Invoice_private_routes"))) TS_Bolt11Invoice_private_routes(uint64_t this_arg) {
82827         LDKBolt11Invoice this_arg_conv;
82828         this_arg_conv.inner = untag_ptr(this_arg);
82829         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82831         this_arg_conv.is_owned = false;
82832         LDKCVec_PrivateRouteZ ret_var = Bolt11Invoice_private_routes(&this_arg_conv);
82833         uint64_tArray ret_arr = NULL;
82834         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
82835         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
82836         for (size_t o = 0; o < ret_var.datalen; o++) {
82837                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
82838                 uint64_t ret_conv_14_ref = 0;
82839                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
82840                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
82841                 ret_arr_ptr[o] = ret_conv_14_ref;
82842         }
82843         
82844         FREE(ret_var.data);
82845         return ret_arr;
82846 }
82847
82848 uint64_tArray  __attribute__((export_name("TS_Bolt11Invoice_route_hints"))) TS_Bolt11Invoice_route_hints(uint64_t this_arg) {
82849         LDKBolt11Invoice this_arg_conv;
82850         this_arg_conv.inner = untag_ptr(this_arg);
82851         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82853         this_arg_conv.is_owned = false;
82854         LDKCVec_RouteHintZ ret_var = Bolt11Invoice_route_hints(&this_arg_conv);
82855         uint64_tArray ret_arr = NULL;
82856         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
82857         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
82858         for (size_t l = 0; l < ret_var.datalen; l++) {
82859                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
82860                 uint64_t ret_conv_11_ref = 0;
82861                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
82862                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
82863                 ret_arr_ptr[l] = ret_conv_11_ref;
82864         }
82865         
82866         FREE(ret_var.data);
82867         return ret_arr;
82868 }
82869
82870 uint32_t  __attribute__((export_name("TS_Bolt11Invoice_currency"))) TS_Bolt11Invoice_currency(uint64_t this_arg) {
82871         LDKBolt11Invoice this_arg_conv;
82872         this_arg_conv.inner = untag_ptr(this_arg);
82873         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82875         this_arg_conv.is_owned = false;
82876         uint32_t ret_conv = LDKCurrency_to_js(Bolt11Invoice_currency(&this_arg_conv));
82877         return ret_conv;
82878 }
82879
82880 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_amount_milli_satoshis"))) TS_Bolt11Invoice_amount_milli_satoshis(uint64_t this_arg) {
82881         LDKBolt11Invoice this_arg_conv;
82882         this_arg_conv.inner = untag_ptr(this_arg);
82883         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82885         this_arg_conv.is_owned = false;
82886         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
82887         *ret_copy = Bolt11Invoice_amount_milli_satoshis(&this_arg_conv);
82888         uint64_t ret_ref = tag_ptr(ret_copy, true);
82889         return ret_ref;
82890 }
82891
82892 uint64_t  __attribute__((export_name("TS_Description_new"))) TS_Description_new(jstring description) {
82893         LDKStr description_conv = str_ref_to_owned_c(description);
82894         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
82895         *ret_conv = Description_new(description_conv);
82896         return tag_ptr(ret_conv, true);
82897 }
82898
82899 uint64_t  __attribute__((export_name("TS_Description_into_inner"))) TS_Description_into_inner(uint64_t this_arg) {
82900         LDKDescription this_arg_conv;
82901         this_arg_conv.inner = untag_ptr(this_arg);
82902         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82904         this_arg_conv = Description_clone(&this_arg_conv);
82905         LDKUntrustedString ret_var = Description_into_inner(this_arg_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 jstring  __attribute__((export_name("TS_Description_to_str"))) TS_Description_to_str(uint64_t o) {
82913         LDKDescription 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         LDKStr ret_str = Description_to_str(&o_conv);
82919         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
82920         Str_free(ret_str);
82921         return ret_conv;
82922 }
82923
82924 uint64_t  __attribute__((export_name("TS_ExpiryTime_from_seconds"))) TS_ExpiryTime_from_seconds(int64_t seconds) {
82925         LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
82926         uint64_t ret_ref = 0;
82927         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82928         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82929         return ret_ref;
82930 }
82931
82932 uint64_t  __attribute__((export_name("TS_ExpiryTime_from_duration"))) TS_ExpiryTime_from_duration(int64_t duration) {
82933         LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
82934         uint64_t ret_ref = 0;
82935         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82936         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82937         return ret_ref;
82938 }
82939
82940 int64_t  __attribute__((export_name("TS_ExpiryTime_as_seconds"))) TS_ExpiryTime_as_seconds(uint64_t this_arg) {
82941         LDKExpiryTime this_arg_conv;
82942         this_arg_conv.inner = untag_ptr(this_arg);
82943         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82945         this_arg_conv.is_owned = false;
82946         int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
82947         return ret_conv;
82948 }
82949
82950 int64_t  __attribute__((export_name("TS_ExpiryTime_as_duration"))) TS_ExpiryTime_as_duration(uint64_t this_arg) {
82951         LDKExpiryTime this_arg_conv;
82952         this_arg_conv.inner = untag_ptr(this_arg);
82953         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82955         this_arg_conv.is_owned = false;
82956         int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
82957         return ret_conv;
82958 }
82959
82960 uint64_t  __attribute__((export_name("TS_PrivateRoute_new"))) TS_PrivateRoute_new(uint64_t hops) {
82961         LDKRouteHint hops_conv;
82962         hops_conv.inner = untag_ptr(hops);
82963         hops_conv.is_owned = ptr_is_owned(hops);
82964         CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
82965         hops_conv = RouteHint_clone(&hops_conv);
82966         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
82967         *ret_conv = PrivateRoute_new(hops_conv);
82968         return tag_ptr(ret_conv, true);
82969 }
82970
82971 uint64_t  __attribute__((export_name("TS_PrivateRoute_into_inner"))) TS_PrivateRoute_into_inner(uint64_t this_arg) {
82972         LDKPrivateRoute this_arg_conv;
82973         this_arg_conv.inner = untag_ptr(this_arg);
82974         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82976         this_arg_conv = PrivateRoute_clone(&this_arg_conv);
82977         LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
82978         uint64_t ret_ref = 0;
82979         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82980         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82981         return ret_ref;
82982 }
82983
82984 uint32_t  __attribute__((export_name("TS_CreationError_clone"))) TS_CreationError_clone(uint64_t orig) {
82985         LDKCreationError* orig_conv = (LDKCreationError*)untag_ptr(orig);
82986         uint32_t ret_conv = LDKCreationError_to_js(CreationError_clone(orig_conv));
82987         return ret_conv;
82988 }
82989
82990 uint32_t  __attribute__((export_name("TS_CreationError_description_too_long"))) TS_CreationError_description_too_long() {
82991         uint32_t ret_conv = LDKCreationError_to_js(CreationError_description_too_long());
82992         return ret_conv;
82993 }
82994
82995 uint32_t  __attribute__((export_name("TS_CreationError_route_too_long"))) TS_CreationError_route_too_long() {
82996         uint32_t ret_conv = LDKCreationError_to_js(CreationError_route_too_long());
82997         return ret_conv;
82998 }
82999
83000 uint32_t  __attribute__((export_name("TS_CreationError_timestamp_out_of_bounds"))) TS_CreationError_timestamp_out_of_bounds() {
83001         uint32_t ret_conv = LDKCreationError_to_js(CreationError_timestamp_out_of_bounds());
83002         return ret_conv;
83003 }
83004
83005 uint32_t  __attribute__((export_name("TS_CreationError_invalid_amount"))) TS_CreationError_invalid_amount() {
83006         uint32_t ret_conv = LDKCreationError_to_js(CreationError_invalid_amount());
83007         return ret_conv;
83008 }
83009
83010 uint32_t  __attribute__((export_name("TS_CreationError_missing_route_hints"))) TS_CreationError_missing_route_hints() {
83011         uint32_t ret_conv = LDKCreationError_to_js(CreationError_missing_route_hints());
83012         return ret_conv;
83013 }
83014
83015 uint32_t  __attribute__((export_name("TS_CreationError_min_final_cltv_expiry_delta_too_short"))) TS_CreationError_min_final_cltv_expiry_delta_too_short() {
83016         uint32_t ret_conv = LDKCreationError_to_js(CreationError_min_final_cltv_expiry_delta_too_short());
83017         return ret_conv;
83018 }
83019
83020 jboolean  __attribute__((export_name("TS_CreationError_eq"))) TS_CreationError_eq(uint64_t a, uint64_t b) {
83021         LDKCreationError* a_conv = (LDKCreationError*)untag_ptr(a);
83022         LDKCreationError* b_conv = (LDKCreationError*)untag_ptr(b);
83023         jboolean ret_conv = CreationError_eq(a_conv, b_conv);
83024         return ret_conv;
83025 }
83026
83027 jstring  __attribute__((export_name("TS_CreationError_to_str"))) TS_CreationError_to_str(uint64_t o) {
83028         LDKCreationError* o_conv = (LDKCreationError*)untag_ptr(o);
83029         LDKStr ret_str = CreationError_to_str(o_conv);
83030         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
83031         Str_free(ret_str);
83032         return ret_conv;
83033 }
83034
83035 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_clone"))) TS_Bolt11SemanticError_clone(uint64_t orig) {
83036         LDKBolt11SemanticError* orig_conv = (LDKBolt11SemanticError*)untag_ptr(orig);
83037         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_clone(orig_conv));
83038         return ret_conv;
83039 }
83040
83041 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_no_payment_hash"))) TS_Bolt11SemanticError_no_payment_hash() {
83042         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_no_payment_hash());
83043         return ret_conv;
83044 }
83045
83046 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_multiple_payment_hashes"))) TS_Bolt11SemanticError_multiple_payment_hashes() {
83047         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_multiple_payment_hashes());
83048         return ret_conv;
83049 }
83050
83051 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_no_description"))) TS_Bolt11SemanticError_no_description() {
83052         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_no_description());
83053         return ret_conv;
83054 }
83055
83056 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_multiple_descriptions"))) TS_Bolt11SemanticError_multiple_descriptions() {
83057         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_multiple_descriptions());
83058         return ret_conv;
83059 }
83060
83061 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_no_payment_secret"))) TS_Bolt11SemanticError_no_payment_secret() {
83062         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_no_payment_secret());
83063         return ret_conv;
83064 }
83065
83066 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_multiple_payment_secrets"))) TS_Bolt11SemanticError_multiple_payment_secrets() {
83067         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_multiple_payment_secrets());
83068         return ret_conv;
83069 }
83070
83071 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_invalid_features"))) TS_Bolt11SemanticError_invalid_features() {
83072         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_invalid_features());
83073         return ret_conv;
83074 }
83075
83076 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_invalid_recovery_id"))) TS_Bolt11SemanticError_invalid_recovery_id() {
83077         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_invalid_recovery_id());
83078         return ret_conv;
83079 }
83080
83081 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_invalid_signature"))) TS_Bolt11SemanticError_invalid_signature() {
83082         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_invalid_signature());
83083         return ret_conv;
83084 }
83085
83086 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_imprecise_amount"))) TS_Bolt11SemanticError_imprecise_amount() {
83087         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_imprecise_amount());
83088         return ret_conv;
83089 }
83090
83091 jboolean  __attribute__((export_name("TS_Bolt11SemanticError_eq"))) TS_Bolt11SemanticError_eq(uint64_t a, uint64_t b) {
83092         LDKBolt11SemanticError* a_conv = (LDKBolt11SemanticError*)untag_ptr(a);
83093         LDKBolt11SemanticError* b_conv = (LDKBolt11SemanticError*)untag_ptr(b);
83094         jboolean ret_conv = Bolt11SemanticError_eq(a_conv, b_conv);
83095         return ret_conv;
83096 }
83097
83098 jstring  __attribute__((export_name("TS_Bolt11SemanticError_to_str"))) TS_Bolt11SemanticError_to_str(uint64_t o) {
83099         LDKBolt11SemanticError* o_conv = (LDKBolt11SemanticError*)untag_ptr(o);
83100         LDKStr ret_str = Bolt11SemanticError_to_str(o_conv);
83101         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
83102         Str_free(ret_str);
83103         return ret_conv;
83104 }
83105
83106 void  __attribute__((export_name("TS_SignOrCreationError_free"))) TS_SignOrCreationError_free(uint64_t this_ptr) {
83107         if (!ptr_is_owned(this_ptr)) return;
83108         void* this_ptr_ptr = untag_ptr(this_ptr);
83109         CHECK_ACCESS(this_ptr_ptr);
83110         LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
83111         FREE(untag_ptr(this_ptr));
83112         SignOrCreationError_free(this_ptr_conv);
83113 }
83114
83115 static inline uint64_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
83116         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
83117         *ret_copy = SignOrCreationError_clone(arg);
83118         uint64_t ret_ref = tag_ptr(ret_copy, true);
83119         return ret_ref;
83120 }
83121 int64_t  __attribute__((export_name("TS_SignOrCreationError_clone_ptr"))) TS_SignOrCreationError_clone_ptr(uint64_t arg) {
83122         LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)untag_ptr(arg);
83123         int64_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
83124         return ret_conv;
83125 }
83126
83127 uint64_t  __attribute__((export_name("TS_SignOrCreationError_clone"))) TS_SignOrCreationError_clone(uint64_t orig) {
83128         LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)untag_ptr(orig);
83129         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
83130         *ret_copy = SignOrCreationError_clone(orig_conv);
83131         uint64_t ret_ref = tag_ptr(ret_copy, true);
83132         return ret_ref;
83133 }
83134
83135 uint64_t  __attribute__((export_name("TS_SignOrCreationError_sign_error"))) TS_SignOrCreationError_sign_error() {
83136         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
83137         *ret_copy = SignOrCreationError_sign_error();
83138         uint64_t ret_ref = tag_ptr(ret_copy, true);
83139         return ret_ref;
83140 }
83141
83142 uint64_t  __attribute__((export_name("TS_SignOrCreationError_creation_error"))) TS_SignOrCreationError_creation_error(uint32_t a) {
83143         LDKCreationError a_conv = LDKCreationError_from_js(a);
83144         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
83145         *ret_copy = SignOrCreationError_creation_error(a_conv);
83146         uint64_t ret_ref = tag_ptr(ret_copy, true);
83147         return ret_ref;
83148 }
83149
83150 jboolean  __attribute__((export_name("TS_SignOrCreationError_eq"))) TS_SignOrCreationError_eq(uint64_t a, uint64_t b) {
83151         LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)untag_ptr(a);
83152         LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)untag_ptr(b);
83153         jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
83154         return ret_conv;
83155 }
83156
83157 jstring  __attribute__((export_name("TS_SignOrCreationError_to_str"))) TS_SignOrCreationError_to_str(uint64_t o) {
83158         LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)untag_ptr(o);
83159         LDKStr ret_str = SignOrCreationError_to_str(o_conv);
83160         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
83161         Str_free(ret_str);
83162         return ret_conv;
83163 }
83164
83165 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) {
83166         LDKBolt11Invoice invoice_conv;
83167         invoice_conv.inner = untag_ptr(invoice);
83168         invoice_conv.is_owned = ptr_is_owned(invoice);
83169         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
83170         invoice_conv.is_owned = false;
83171         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
83172         *ret_conv = payment_parameters_from_zero_amount_invoice(&invoice_conv, amount_msat);
83173         return tag_ptr(ret_conv, true);
83174 }
83175
83176 uint64_t  __attribute__((export_name("TS_payment_parameters_from_invoice"))) TS_payment_parameters_from_invoice(uint64_t invoice) {
83177         LDKBolt11Invoice invoice_conv;
83178         invoice_conv.inner = untag_ptr(invoice);
83179         invoice_conv.is_owned = ptr_is_owned(invoice);
83180         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
83181         invoice_conv.is_owned = false;
83182         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
83183         *ret_conv = payment_parameters_from_invoice(&invoice_conv);
83184         return tag_ptr(ret_conv, true);
83185 }
83186
83187 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) {
83188         void* amt_msat_ptr = untag_ptr(amt_msat);
83189         CHECK_ACCESS(amt_msat_ptr);
83190         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
83191         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
83192         void* payment_hash_ptr = untag_ptr(payment_hash);
83193         CHECK_ACCESS(payment_hash_ptr);
83194         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
83195         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
83196         LDKStr description_conv = str_ref_to_owned_c(description);
83197         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
83198         phantom_route_hints_constr.datalen = phantom_route_hints->arr_len;
83199         if (phantom_route_hints_constr.datalen > 0)
83200                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
83201         else
83202                 phantom_route_hints_constr.data = NULL;
83203         uint64_t* phantom_route_hints_vals = phantom_route_hints->elems;
83204         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
83205                 uint64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
83206                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
83207                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
83208                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
83209                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
83210                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
83211                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
83212         }
83213         FREE(phantom_route_hints);
83214         void* entropy_source_ptr = untag_ptr(entropy_source);
83215         CHECK_ACCESS(entropy_source_ptr);
83216         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
83217         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
83218                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83219                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
83220         }
83221         void* node_signer_ptr = untag_ptr(node_signer);
83222         CHECK_ACCESS(node_signer_ptr);
83223         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
83224         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
83225                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83226                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
83227         }
83228         void* logger_ptr = untag_ptr(logger);
83229         CHECK_ACCESS(logger_ptr);
83230         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
83231         if (logger_conv.free == LDKLogger_JCalls_free) {
83232                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83233                 LDKLogger_JCalls_cloned(&logger_conv);
83234         }
83235         LDKCurrency network_conv = LDKCurrency_from_js(network);
83236         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
83237         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
83238         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
83239         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
83240         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
83241         *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);
83242         return tag_ptr(ret_conv, true);
83243 }
83244
83245 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) {
83246         void* amt_msat_ptr = untag_ptr(amt_msat);
83247         CHECK_ACCESS(amt_msat_ptr);
83248         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
83249         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
83250         void* payment_hash_ptr = untag_ptr(payment_hash);
83251         CHECK_ACCESS(payment_hash_ptr);
83252         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
83253         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
83254         LDKSha256 description_hash_conv;
83255         description_hash_conv.inner = untag_ptr(description_hash);
83256         description_hash_conv.is_owned = ptr_is_owned(description_hash);
83257         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
83258         description_hash_conv = Sha256_clone(&description_hash_conv);
83259         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
83260         phantom_route_hints_constr.datalen = phantom_route_hints->arr_len;
83261         if (phantom_route_hints_constr.datalen > 0)
83262                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
83263         else
83264                 phantom_route_hints_constr.data = NULL;
83265         uint64_t* phantom_route_hints_vals = phantom_route_hints->elems;
83266         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
83267                 uint64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
83268                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
83269                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
83270                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
83271                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
83272                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
83273                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
83274         }
83275         FREE(phantom_route_hints);
83276         void* entropy_source_ptr = untag_ptr(entropy_source);
83277         CHECK_ACCESS(entropy_source_ptr);
83278         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
83279         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
83280                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83281                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
83282         }
83283         void* node_signer_ptr = untag_ptr(node_signer);
83284         CHECK_ACCESS(node_signer_ptr);
83285         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
83286         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
83287                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83288                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
83289         }
83290         void* logger_ptr = untag_ptr(logger);
83291         CHECK_ACCESS(logger_ptr);
83292         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
83293         if (logger_conv.free == LDKLogger_JCalls_free) {
83294                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83295                 LDKLogger_JCalls_cloned(&logger_conv);
83296         }
83297         LDKCurrency network_conv = LDKCurrency_from_js(network);
83298         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
83299         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
83300         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
83301         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
83302         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
83303         *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);
83304         return tag_ptr(ret_conv, true);
83305 }
83306
83307 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) {
83308         LDKChannelManager channelmanager_conv;
83309         channelmanager_conv.inner = untag_ptr(channelmanager);
83310         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
83311         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
83312         channelmanager_conv.is_owned = false;
83313         void* node_signer_ptr = untag_ptr(node_signer);
83314         CHECK_ACCESS(node_signer_ptr);
83315         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
83316         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
83317                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83318                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
83319         }
83320         void* logger_ptr = untag_ptr(logger);
83321         CHECK_ACCESS(logger_ptr);
83322         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
83323         if (logger_conv.free == LDKLogger_JCalls_free) {
83324                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83325                 LDKLogger_JCalls_cloned(&logger_conv);
83326         }
83327         LDKCurrency network_conv = LDKCurrency_from_js(network);
83328         void* amt_msat_ptr = untag_ptr(amt_msat);
83329         CHECK_ACCESS(amt_msat_ptr);
83330         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
83331         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
83332         LDKSha256 description_hash_conv;
83333         description_hash_conv.inner = untag_ptr(description_hash);
83334         description_hash_conv.is_owned = ptr_is_owned(description_hash);
83335         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
83336         description_hash_conv = Sha256_clone(&description_hash_conv);
83337         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
83338         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
83339         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
83340         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
83341         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
83342         *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);
83343         return tag_ptr(ret_conv, true);
83344 }
83345
83346 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) {
83347         LDKChannelManager channelmanager_conv;
83348         channelmanager_conv.inner = untag_ptr(channelmanager);
83349         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
83350         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
83351         channelmanager_conv.is_owned = false;
83352         void* node_signer_ptr = untag_ptr(node_signer);
83353         CHECK_ACCESS(node_signer_ptr);
83354         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
83355         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
83356                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83357                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
83358         }
83359         void* logger_ptr = untag_ptr(logger);
83360         CHECK_ACCESS(logger_ptr);
83361         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
83362         if (logger_conv.free == LDKLogger_JCalls_free) {
83363                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83364                 LDKLogger_JCalls_cloned(&logger_conv);
83365         }
83366         LDKCurrency network_conv = LDKCurrency_from_js(network);
83367         void* amt_msat_ptr = untag_ptr(amt_msat);
83368         CHECK_ACCESS(amt_msat_ptr);
83369         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
83370         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
83371         LDKStr description_conv = str_ref_to_owned_c(description);
83372         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
83373         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
83374         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
83375         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
83376         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
83377         *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);
83378         return tag_ptr(ret_conv, true);
83379 }
83380
83381 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) {
83382         LDKChannelManager channelmanager_conv;
83383         channelmanager_conv.inner = untag_ptr(channelmanager);
83384         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
83385         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
83386         channelmanager_conv.is_owned = false;
83387         void* node_signer_ptr = untag_ptr(node_signer);
83388         CHECK_ACCESS(node_signer_ptr);
83389         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
83390         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
83391                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83392                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
83393         }
83394         void* logger_ptr = untag_ptr(logger);
83395         CHECK_ACCESS(logger_ptr);
83396         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
83397         if (logger_conv.free == LDKLogger_JCalls_free) {
83398                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83399                 LDKLogger_JCalls_cloned(&logger_conv);
83400         }
83401         LDKCurrency network_conv = LDKCurrency_from_js(network);
83402         void* amt_msat_ptr = untag_ptr(amt_msat);
83403         CHECK_ACCESS(amt_msat_ptr);
83404         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
83405         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
83406         LDKStr description_conv = str_ref_to_owned_c(description);
83407         LDKThirtyTwoBytes payment_hash_ref;
83408         CHECK(payment_hash->arr_len == 32);
83409         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
83410         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
83411         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
83412         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
83413         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
83414         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
83415         *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);
83416         return tag_ptr(ret_conv, true);
83417 }
83418
83419 uint64_t  __attribute__((export_name("TS_SiPrefix_from_str"))) TS_SiPrefix_from_str(jstring s) {
83420         LDKStr s_conv = str_ref_to_owned_c(s);
83421         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
83422         *ret_conv = SiPrefix_from_str(s_conv);
83423         return tag_ptr(ret_conv, true);
83424 }
83425
83426 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_from_str"))) TS_Bolt11Invoice_from_str(jstring s) {
83427         LDKStr s_conv = str_ref_to_owned_c(s);
83428         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
83429         *ret_conv = Bolt11Invoice_from_str(s_conv);
83430         return tag_ptr(ret_conv, true);
83431 }
83432
83433 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_from_str"))) TS_SignedRawBolt11Invoice_from_str(jstring s) {
83434         LDKStr s_conv = str_ref_to_owned_c(s);
83435         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
83436         *ret_conv = SignedRawBolt11Invoice_from_str(s_conv);
83437         return tag_ptr(ret_conv, true);
83438 }
83439
83440 jstring  __attribute__((export_name("TS_Bolt11ParseError_to_str"))) TS_Bolt11ParseError_to_str(uint64_t o) {
83441         LDKBolt11ParseError* o_conv = (LDKBolt11ParseError*)untag_ptr(o);
83442         LDKStr ret_str = Bolt11ParseError_to_str(o_conv);
83443         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
83444         Str_free(ret_str);
83445         return ret_conv;
83446 }
83447
83448 jstring  __attribute__((export_name("TS_ParseOrSemanticError_to_str"))) TS_ParseOrSemanticError_to_str(uint64_t o) {
83449         LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)untag_ptr(o);
83450         LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
83451         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
83452         Str_free(ret_str);
83453         return ret_conv;
83454 }
83455
83456 jstring  __attribute__((export_name("TS_Bolt11Invoice_to_str"))) TS_Bolt11Invoice_to_str(uint64_t o) {
83457         LDKBolt11Invoice o_conv;
83458         o_conv.inner = untag_ptr(o);
83459         o_conv.is_owned = ptr_is_owned(o);
83460         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
83461         o_conv.is_owned = false;
83462         LDKStr ret_str = Bolt11Invoice_to_str(&o_conv);
83463         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
83464         Str_free(ret_str);
83465         return ret_conv;
83466 }
83467
83468 jstring  __attribute__((export_name("TS_SignedRawBolt11Invoice_to_str"))) TS_SignedRawBolt11Invoice_to_str(uint64_t o) {
83469         LDKSignedRawBolt11Invoice o_conv;
83470         o_conv.inner = untag_ptr(o);
83471         o_conv.is_owned = ptr_is_owned(o);
83472         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
83473         o_conv.is_owned = false;
83474         LDKStr ret_str = SignedRawBolt11Invoice_to_str(&o_conv);
83475         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
83476         Str_free(ret_str);
83477         return ret_conv;
83478 }
83479
83480 jstring  __attribute__((export_name("TS_Currency_to_str"))) TS_Currency_to_str(uint64_t o) {
83481         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
83482         LDKStr ret_str = Currency_to_str(o_conv);
83483         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
83484         Str_free(ret_str);
83485         return ret_conv;
83486 }
83487
83488 jstring  __attribute__((export_name("TS_SiPrefix_to_str"))) TS_SiPrefix_to_str(uint64_t o) {
83489         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
83490         LDKStr ret_str = SiPrefix_to_str(o_conv);
83491         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
83492         Str_free(ret_str);
83493         return ret_conv;
83494 }
83495